convert ints and casts to use PlayerNumber and macros

This commit is contained in:
Chris Danford
2004-08-30 04:35:14 +00:00
parent 081c1e24b5
commit cf9b4af6cb
9 changed files with 110 additions and 157 deletions
+6 -7
View File
@@ -22,18 +22,17 @@ ScreenEndlessBreak::ScreenEndlessBreak( CString sName ) : Screen( sName )
m_sprBreakPicture.Load( THEME->GetPathToG("Common fallback takingabreak") );
else if( GAMESTATE->GetNumPlayersEnabled() > 1 ) // More than 1 player is present.
{
int PlayerToUse = 999; /* If this was 0 by default, the first player would
always be selected. Make it an insane number so
we always generate a random player. */
while (!GAMESTATE->IsPlayerEnabled(PlayerToUse))
PlayerNumber pn;
do
{
PlayerToUse = (int)(rand()*NUM_PLAYERS); // Is there a danger of this becoming an endless loop??
if( (GAMESTATE->IsPlayerEnabled(PlayerToUse)) && (GAMESTATE->m_pCurCharacters[PlayerToUse] != NULL) )
pn = (PlayerNumber)(rand()%NUM_PLAYERS);
if( GAMESTATE->IsPlayerEnabled(pn) && (GAMESTATE->m_pCurCharacters[pn] != NULL) )
{
m_sprBreakPicture.LoadTABreakFromCharacter( GAMESTATE->m_pCurCharacters[PlayerToUse] );
m_sprBreakPicture.LoadTABreakFromCharacter( GAMESTATE->m_pCurCharacters[pn] );
break;
}
}
while( !GAMESTATE->IsPlayerEnabled(pn) );
}
}
else // Characters not enabled.