From 1f81a20838a8cec0bf7aaa9939e41b33ed4879e6 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Mon, 26 Oct 2009 03:05:08 +0000 Subject: [PATCH] Hack to get the decorations to be deleted. Fixes crashes, but probably not the best way to go about this. --- stepmania/src/ActorFrame.h | 1 + stepmania/src/ScreenWithMenuElements.cpp | 15 +++++++++++---- stepmania/src/ScreenWithMenuElements.h | 1 + 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/stepmania/src/ActorFrame.h b/stepmania/src/ActorFrame.h index 69f4a8a25e..33eb630092 100644 --- a/stepmania/src/ActorFrame.h +++ b/stepmania/src/ActorFrame.h @@ -20,6 +20,7 @@ public: virtual void RemoveChild( Actor *pActor ); void TransferChildren( ActorFrame *pTo ); Actor* GetChild( const RString &sName ); + vector GetChildren() { return m_SubActors; } int GetNumChildren() const { return m_SubActors.size(); } void RemoveAllChildren(); diff --git a/stepmania/src/ScreenWithMenuElements.cpp b/stepmania/src/ScreenWithMenuElements.cpp index 3137987e4f..69b758d390 100644 --- a/stepmania/src/ScreenWithMenuElements.cpp +++ b/stepmania/src/ScreenWithMenuElements.cpp @@ -78,11 +78,18 @@ void ScreenWithMenuElements::Init() /* Experimental: Load "decorations" and make them children of the screen. */ { - AutoActor decorations; - decorations.LoadB( m_sName, "decorations" ); - ActorFrame *pFrame = dynamic_cast((Actor*)decorations); + m_Decorations.LoadB( m_sName, "decorations" ); + ActorFrame *pFrame = dynamic_cast(static_cast(m_Decorations)); + vector children = pFrame->GetChildren(); if( pFrame ) - pFrame->TransferChildren( this ); + { + FOREACH( Actor*, children, child ) + this->AddChild( *child ); + } + else + { + m_Decorations.Unload(); + } } m_In.SetName( "In" ); diff --git a/stepmania/src/ScreenWithMenuElements.h b/stepmania/src/ScreenWithMenuElements.h index 5e9c4a082c..fc58be45a9 100644 --- a/stepmania/src/ScreenWithMenuElements.h +++ b/stepmania/src/ScreenWithMenuElements.h @@ -43,6 +43,7 @@ protected: MemoryCardDisplay *m_MemoryCardDisplay[NUM_PLAYERS]; MenuTimer *m_MenuTimer; AutoActor m_sprOverlay; + AutoActor m_Decorations; Transition m_In; Transition m_Out;