From 36f30957a65a209fa50f303b744c1ee92a0d7f33 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 8 Sep 2005 05:52:37 +0000 Subject: [PATCH] simplify --- stepmania/src/GameState.cpp | 8 +++---- stepmania/src/GameState.h | 2 +- stepmania/src/ScreenWithMenuElements.cpp | 28 ++++++++++++++---------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 53fe3b3ee8..67c0931f35 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -718,12 +718,10 @@ Stage GameState::GetCurrentStage() const else return (Stage)(STAGE_1+m_iCurrentStageIndex); } -void GameState::GetPossibleStages( vector &out ) const +bool GameState::IsStagePossible( Stage s ) const { - // Optimze me so that we don't load graphics that can't possibly be shown - out.clear(); - FOREACH_Stage( s ) - out.push_back( s ); + // Optimize me so that we don't load graphics that can't possibly be shown + return true; } int GameState::GetCourseSongIndex() const diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index d5b1f6cb87..eb03884508 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -126,7 +126,7 @@ public: bool IsExtraStage() const; bool IsExtraStage2() const; Stage GetCurrentStage() const; - void GetPossibleStages( vector &out ) const; + bool IsStagePossible( Stage s ) const; int GetCourseSongIndex() const; CString GetPlayerDisplayName( PlayerNumber pn ) const; diff --git a/stepmania/src/ScreenWithMenuElements.cpp b/stepmania/src/ScreenWithMenuElements.cpp index 51346695be..202fb0acd6 100644 --- a/stepmania/src/ScreenWithMenuElements.cpp +++ b/stepmania/src/ScreenWithMenuElements.cpp @@ -59,12 +59,12 @@ void ScreenWithMenuElements::Init() if( SHOW_STAGE && GAMESTATE->m_pCurStyle ) { - vector vStages; - GAMESTATE->GetPossibleStages( vStages ); - FOREACH_CONST( Stage, vStages, s ) + FOREACH_Stage( s ) { - m_sprStage[*s].Load( THEME->GetPathG(m_sName,"stage "+StageToString(*s)) ); - m_sprStage[*s]->SetName( "Stage" ); + if( !GAMESTATE->IsStagePossible(s) ) + continue; + m_sprStage[s].Load( THEME->GetPathG(m_sName,"stage "+StageToString(s)) ); + m_sprStage[s]->SetName( "Stage" ); } // UpdateStage to hide/show the appropriate stage graphic. Do this before @@ -72,10 +72,12 @@ void ScreenWithMenuElements::Init() // to hide the graphic. UpdateStage(); - FOREACH_CONST( Stage, vStages, s ) + FOREACH_Stage( s ) { - SET_XY( m_sprStage[*s] ); - this->AddChild( m_sprStage[*s] ); + if( !GAMESTATE->IsStagePossible(s) ) + continue; + SET_XY( m_sprStage[s] ); + this->AddChild( m_sprStage[s] ); } } @@ -175,10 +177,12 @@ void ScreenWithMenuElements::TweenOnScreen() // to hide the graphic. UpdateStage(); - vector vStages; - GAMESTATE->GetPossibleStages( vStages ); - FOREACH_CONST( Stage, vStages, s ) - ON_COMMAND( m_sprStage[*s] ); + FOREACH_Stage( s ) + { + if( !GAMESTATE->IsStagePossible(s) ) + continue; + ON_COMMAND( m_sprStage[s] ); + } } if( MEMORY_CARD_ICONS )