Fix extra stage crash on songs with more than one stage. Fixes bugs 1905623, 1906055, and 1879968 (probably).
This commit is contained in:
@@ -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) )
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user