fix 'Load player edits, play one of the player edits, continue, choose Nontop; crash'

This commit is contained in:
Chris Danford
2007-11-13 12:08:29 +00:00
parent 0acaeecba0
commit 7d3247a8aa
+12 -2
View File
@@ -15,8 +15,13 @@ void ScreenContinue::BeginScreen()
{
GAMESTATE->SetCurrentStyle( NULL );
// unjoin all players with 0 stages left
FOREACH_HumanPlayer( p )
// Unjoin human players with 0 stages left and reset non-human players.
// We need to reset non-human players because data in non-human (CPU)
// players will be filled, and there may be stale pointers to things like
// edit Steps.
FOREACH_ENUM( PlayerNumber, p )
{
if( GAMESTATE->IsHumanPlayer(p) )
{
bool bPlayerDone = GAMESTATE->m_iPlayerStageTokens[p] <= 0;
if( bPlayerDone )
@@ -25,6 +30,11 @@ void ScreenContinue::BeginScreen()
MEMCARDMAN->UnlockCard( p );
}
}
else
{
GAMESTATE->ResetPlayer( p );
}
}
ScreenWithMenuElements::BeginScreen();
}