From 610262a46c5a7d7fb6ec12f28474cf5176c705d0 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 10 Oct 2005 22:27:09 +0000 Subject: [PATCH] use standard load path, not ActorUtil::LoadFromActorFile directly --- stepmania/src/ComboGraph.cpp | 37 +++++++++++++++--------------------- stepmania/src/ComboGraph.h | 4 ++-- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/stepmania/src/ComboGraph.cpp b/stepmania/src/ComboGraph.cpp index 270c6cbd1f..ab4735df1d 100644 --- a/stepmania/src/ComboGraph.cpp +++ b/stepmania/src/ComboGraph.cpp @@ -12,41 +12,34 @@ REGISTER_ACTOR_CLASS( ComboGraph ) ComboGraph::ComboGraph() { + DeleteChildrenWhenDone( true ); + m_pNormalCombo = NULL; m_pMaxCombo = NULL; -} - -ComboGraph::~ComboGraph() -{ - delete m_pNormalCombo; - delete m_pMaxCombo; - this->DeleteAllChildren(); + m_pMaxComboText = NULL; } void ComboGraph::LoadFromNode( const CString& sDir, const XNode* pNode ) { ActorFrame::LoadFromNode( sDir, pNode ); - const XNode *pChild = pNode->GetChild( "MaxComboText" ); - if( pChild == NULL ) - RageException::Throw( ssprintf("ComboGraph in \"%s\" is missing the node \"MaxComboText\"", sDir.c_str()) ); - m_MaxComboText.LoadFromNode( sDir, pChild ); + m_pMaxComboText = (BitmapText *) this->GetChild( "MaxComboText" ); + if( m_pMaxComboText == NULL ) + RageException::Throw( ssprintf("ComboGraph in \"%s\" must have a child named \"MaxComboText\"", sDir.c_str()) ); + if( !m_pMaxComboText->IsType("BitmapText") ) + RageException::Throw( ssprintf("ComboGraph in \"%s\" has a child named \"MaxComboText\" that is not a BitmapText", sDir.c_str()) ); - pChild = pNode->GetChild( "NormalCombo" ); - if( pChild == NULL ) - RageException::Throw( ssprintf("ComboGraph in \"%s\" is missing the node \"NormalCombo\"", sDir.c_str()) ); - m_pNormalCombo = ActorUtil::LoadFromActorFile( sDir, pChild ); + m_pNormalCombo = this->GetChild( "NormalCombo" ); + if( m_pNormalCombo == NULL ) + RageException::Throw( ssprintf("ComboGraph in \"%s\" must have a child named \"NormalCombo\"", sDir.c_str()) ); - pChild = pNode->GetChild( "MaxCombo" ); - if( pChild == NULL ) - RageException::Throw( ssprintf("ComboGraph in \"%s\" is missing the node \"MaxCombo\"", sDir.c_str()) ); - m_pMaxCombo = ActorUtil::LoadFromActorFile( sDir, pChild ); + m_pMaxCombo = this->GetChild( "MaxCombo" ); + if( m_pMaxCombo == NULL ) + RageException::Throw( ssprintf("ComboGraph in \"%s\" must have a child named \"MaxCombo\"", sDir.c_str()) ); } void ComboGraph::Load( const StageStats &s, const PlayerStageStats &pss ) { - ASSERT( m_SubActors.size() == 0 ); - const float fFirstSecond = 0; const float fLastSecond = s.GetTotalPossibleStepsSeconds(); @@ -90,7 +83,7 @@ void ComboGraph::Load( const StageStats &s, const PlayerStageStats &pss ) if( !bIsMax ) continue; - BitmapText *pText = (BitmapText *) m_MaxComboText.Copy(); // XXX Copy should be covariant + BitmapText *pText = (BitmapText *) m_pMaxComboText->Copy(); // XXX Copy should be covariant const float fStart = SCALE( combo.fStartSecond, fFirstSecond, fLastSecond, 0.0f, 1.0f ); const float fSize = SCALE( combo.fSizeSeconds, 0, fLastSecond-fFirstSecond, 0.0f, 1.0f ); diff --git a/stepmania/src/ComboGraph.h b/stepmania/src/ComboGraph.h index cb3d926118..84c7e622e6 100644 --- a/stepmania/src/ComboGraph.h +++ b/stepmania/src/ComboGraph.h @@ -11,10 +11,10 @@ class ComboGraph: public ActorFrame { public: ComboGraph(); - ~ComboGraph(); void Load( const StageStats &s, const PlayerStageStats &pss ); virtual void LoadFromNode( const CString& sDir, const XNode* pNode ); virtual Actor *Copy() const; + virtual bool AutoLoadChildren() const { return true; } // // Commands @@ -24,7 +24,7 @@ public: private: Actor *m_pNormalCombo; Actor *m_pMaxCombo; - BitmapText m_MaxComboText; + BitmapText *m_pMaxComboText; }; #endif