diff --git a/stepmania/src/GameCommand.cpp b/stepmania/src/GameCommand.cpp index 79bd26cf81..cc1793543e 100644 --- a/stepmania/src/GameCommand.cpp +++ b/stepmania/src/GameCommand.cpp @@ -608,6 +608,29 @@ static HighScore MakeRandomHighScore( float fPercentDP ) return hs; } +/* Hack: if this GameCommand would set the screen, clear the setting and return + * the screen that would have been set. */ +CString GameCommand::GetAndClearScreen() +{ + CString sRet; + FOREACH( Command, m_Commands.v, cmd ) + { + GameCommand gc; + gc.m_bInvalid = false; + gc.LoadOne( *cmd ); + if( gc.m_sScreen != "" ) + { + sRet = gc.m_sScreen; + m_Commands.v.erase( cmd ); + break; + } + } + + m_sScreen = ""; + + return sRet; +} + void GameCommand::Apply( const vector &vpns ) const { if( m_Commands.v.size() ) diff --git a/stepmania/src/GameCommand.h b/stepmania/src/GameCommand.h index 473139ca80..baaee30a2f 100644 --- a/stepmania/src/GameCommand.h +++ b/stepmania/src/GameCommand.h @@ -37,6 +37,7 @@ public: bool DescribesCurrentModeForAllPlayers() const; bool IsPlayable( CString *why = NULL ) const; bool IsZero() const; + CString GetAndClearScreen(); // Same as what was passed to Load. We need to keep the original commands // so that we know the order of commands when it comes time to Apply. diff --git a/stepmania/src/ScreenSelect.cpp b/stepmania/src/ScreenSelect.cpp index 36e22c07ff..e27d0cbcc4 100644 --- a/stepmania/src/ScreenSelect.cpp +++ b/stepmania/src/ScreenSelect.cpp @@ -212,9 +212,9 @@ void ScreenSelect::HandleScreenMessage( const ScreenMessage SM ) FOREACH_HumanPlayer( p ) { GameCommand gc = m_aGameCommands[this->GetSelectionIndex(p)]; + CString sThisScreen = gc.GetAndClearScreen(); if( sScreen == "" ) - sScreen = gc.m_sScreen; - gc.m_sScreen = ""; + sScreen = sThisScreen; gc.Apply( p ); }