copy children if m_bDeleteChildren; this allows copying ActorFrames, including

ones loaded from XML
This commit is contained in:
Glenn Maynard
2005-07-18 22:59:34 +00:00
parent ab07232a8b
commit 47489964d2
2 changed files with 29 additions and 0 deletions
+28
View File
@@ -39,6 +39,34 @@ ActorFrame::~ActorFrame()
DeleteAllChildren();
}
ActorFrame::ActorFrame( const ActorFrame &cpy ):
Actor( cpy )
{
#define CPY(x) this->x = cpy.x;
CPY( m_bPropagateCommands );
CPY( m_bDeleteChildren );
CPY( m_bDrawByZPosition );
CPY( m_fUpdateRate );
CPY( m_fFOV );
CPY( m_fVanishX );
CPY( m_fVanishY );
CPY( m_bOverrideLighting );
CPY( m_bLighting );
#undef CPY
/* If m_bDeleteChildren, we own our children and it's up to us to copy
* them. If not, the derived class owns the children. This must preserve
* the current order of m_SubActors. */
if( m_bDeleteChildren )
{
for( unsigned i = 0; i < cpy.m_SubActors.size(); ++i )
{
Actor *pActor = cpy.m_SubActors[i]->Copy();
this->AddChild( pActor );
}
}
}
void ActorFrame::LoadFromNode( const CString& sDir, const XNode* pNode )
{
Actor::LoadFromNode( sDir, pNode );
+1
View File
@@ -9,6 +9,7 @@ class ActorFrame : public Actor
{
public:
ActorFrame();
ActorFrame( const ActorFrame &cpy );
virtual ~ActorFrame();
void LoadFromNode( const CString& sDir, const XNode* pNode );