From 47489964d29351a34855c6466941e5d8190e6204 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 18 Jul 2005 22:59:34 +0000 Subject: [PATCH] copy children if m_bDeleteChildren; this allows copying ActorFrames, including ones loaded from XML --- stepmania/src/ActorFrame.cpp | 28 ++++++++++++++++++++++++++++ stepmania/src/ActorFrame.h | 1 + 2 files changed, 29 insertions(+) diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index 329d9e0873..ce5ef27107 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -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 ); diff --git a/stepmania/src/ActorFrame.h b/stepmania/src/ActorFrame.h index 592938ae7d..c5a6c8e41f 100644 --- a/stepmania/src/ActorFrame.h +++ b/stepmania/src/ActorFrame.h @@ -9,6 +9,7 @@ class ActorFrame : public Actor { public: ActorFrame(); + ActorFrame( const ActorFrame &cpy ); virtual ~ActorFrame(); void LoadFromNode( const CString& sDir, const XNode* pNode );