Fix extra stage crash on songs with more than one stage. Fixes bugs 1905623, 1906055, and 1879968 (probably).

This commit is contained in:
Steve Checkoway
2008-07-23 12:27:12 +00:00
parent 6d8ac95e72
commit 08a504dd8d
2 changed files with 9 additions and 2 deletions
+8 -1
View File
@@ -633,7 +633,11 @@ int GameState::GetNumStagesForCurrentSongAndStepsOrCourse() const
pStyle = vpStyles[0];
}
}
iNumStagesOfThisSong = GameState::GetNumStagesForSongAndStyleType( m_pCurSong, pStyle->m_StyleType );
/* Extra stages need to only count as one stage in case a multistage song is chosen. */
if( IsAnExtraStage() )
iNumStagesOfThisSong = 1;
else
iNumStagesOfThisSong = GameState::GetNumStagesForSongAndStyleType( m_pCurSong, pStyle->m_StyleType );
}
else if( m_pCurCourse )
iNumStagesOfThisSong = PREFSMAN->m_iSongsPerPlay;
@@ -670,7 +674,10 @@ void GameState::BeginStage()
m_iNumStagesOfThisSong = GetNumStagesForCurrentSongAndStepsOrCourse();
ASSERT( m_iNumStagesOfThisSong != -1 );
FOREACH_EnabledPlayer( p )
{
ASSERT( m_iPlayerStageTokens[p] >= m_iNumStagesOfThisSong );
m_iPlayerStageTokens[p] -= m_iNumStagesOfThisSong;
}
FOREACH_HumanPlayer( pn )
if( CurrentOptionsDisqualifyPlayer(pn) )
+1 -1
View File
@@ -867,7 +867,7 @@ void SongUtil::GetPlayableStepsTypes( const Song *pSong, set<StepsType> &vOut )
iNumPlayers = max( iNumPlayers, 1 );
const Style *pStyle = GameManager::GetFirstCompatibleStyle( GAMESTATE->m_pCurGame, iNumPlayers, *st );
bool bEnoughStages = GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer() >= GAMESTATE->GetNumStagesForSongAndStyleType(pSong, pStyle->m_StyleType);
bool bEnoughStages = GAMESTATE->IsAnExtraStage() || GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer() >= GAMESTATE->GetNumStagesForSongAndStyleType(pSong, pStyle->m_StyleType);
if( bShowThisStepsType && bEnoughStages )
vOut.insert( *st );