simplify, eliminate GetAndClearScreen

This commit is contained in:
Glenn Maynard
2006-01-15 08:09:03 +00:00
parent cb4739ff31
commit 6467fa0bc4
+5 -6
View File
@@ -55,6 +55,7 @@ void ScreenSelect::Init()
CString sChoiceName = asChoiceNames[c]; CString sChoiceName = asChoiceNames[c];
GameCommand mc; GameCommand mc;
mc.ApplyCommitsScreens( false );
mc.m_sName = sChoiceName; mc.m_sName = sChoiceName;
mc.Load( c, CHOICE(sChoiceName) ); mc.Load( c, CHOICE(sChoiceName) );
m_aGameCommands.push_back( mc ); m_aGameCommands.push_back( mc );
@@ -202,12 +203,10 @@ void ScreenSelect::HandleScreenMessage( const ScreenMessage SM )
} }
} }
/* When applying, do make a copy of the GameCommand. That way,
* GetAndClearScreen doesn't mangle m_sScreen on our real copy. */
if( bAllPlayersChoseTheSame ) if( bAllPlayersChoseTheSame )
{ {
GameCommand gc = m_aGameCommands[iMastersIndex]; const GameCommand &gc = m_aGameCommands[iMastersIndex];
CString sThisScreen = gc.GetAndClearScreen(); CString sThisScreen = gc.m_sScreen;
if( m_sNextScreen == "" ) if( m_sNextScreen == "" )
m_sNextScreen = sThisScreen; m_sNextScreen = sThisScreen;
gc.ApplyToAllPlayers(); gc.ApplyToAllPlayers();
@@ -217,8 +216,8 @@ void ScreenSelect::HandleScreenMessage( const ScreenMessage SM )
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
{ {
int iIndex = this->GetSelectionIndex(p); int iIndex = this->GetSelectionIndex(p);
GameCommand gc = m_aGameCommands[iIndex]; const GameCommand &gc = m_aGameCommands[iIndex];
CString sThisScreen = gc.GetAndClearScreen(); CString sThisScreen = gc.m_sScreen;
if( m_sNextScreen == "" ) if( m_sNextScreen == "" )
m_sNextScreen = sThisScreen; m_sNextScreen = sThisScreen;
gc.Apply( p ); gc.Apply( p );