From 4361bcd7e32dfb86e7e7a5f72d2c449ae09067b0 Mon Sep 17 00:00:00 2001 From: Kyzentun Keeslala Date: Thu, 19 May 2016 11:19:55 -0600 Subject: [PATCH] Don't invalidate the current song or steps until after the music wheel has been constructed, so that themes can safely touch it when handling current song changed. --- src/MusicWheel.cpp | 51 +++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/src/MusicWheel.cpp b/src/MusicWheel.cpp index 745bd3670e..538e5475fa 100644 --- a/src/MusicWheel.cpp +++ b/src/MusicWheel.cpp @@ -183,29 +183,6 @@ void MusicWheel::BeginScreen() if( GAMESTATE->m_PreferredSortOrder == SortOrder_Invalid ) GAMESTATE->m_PreferredSortOrder = GAMESTATE->m_SortOrder; - /* Invalidate current Song if it can't be played - * because there are not enough stages remaining. */ - if( GAMESTATE->m_pCurSong != NULL && - GameState::GetNumStagesMultiplierForSong( GAMESTATE->m_pCurSong ) > GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer() ) - { - GAMESTATE->m_pCurSong.Set( NULL ); - } - - /* Invalidate current Steps if it can't be played - * because there are not enough stages remaining. */ - FOREACH_ENUM( PlayerNumber, p ) - { - if( GAMESTATE->m_pCurSteps[p] != NULL ) - { - vector vpPossibleSteps; - if( GAMESTATE->m_pCurSong != NULL ) - SongUtil::GetPlayableSteps( GAMESTATE->m_pCurSong, vpPossibleSteps ); - bool bStepsIsPossible = find( vpPossibleSteps.begin(), vpPossibleSteps.end(), GAMESTATE->m_pCurSteps[p] ) == vpPossibleSteps.end(); - if( !bStepsIsPossible ) - GAMESTATE->m_pCurSteps[p].Set( NULL ); - } - } - if(GAMESTATE->m_sPreferredSongGroup != GROUP_ALL) { // If a preferred song group is set, open the group and select the @@ -241,6 +218,34 @@ void MusicWheel::BeginScreen() // rebuild the WheelItems that appear on screen RebuildWheelItems(); + + /* Invalidate current Song if it can't be played + * because there are not enough stages remaining. */ + if(GAMESTATE->m_pCurSong != NULL && + GameState::GetNumStagesMultiplierForSong(GAMESTATE->m_pCurSong) > + GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer()) + { + GAMESTATE->m_pCurSong.Set(NULL); + } + + /* Invalidate current Steps if it can't be played + * because there are not enough stages remaining. */ + FOREACH_ENUM(PlayerNumber, p) + { + if(GAMESTATE->m_pCurSteps[p] != NULL) + { + vector vpPossibleSteps; + if(GAMESTATE->m_pCurSong != NULL) + { + SongUtil::GetPlayableSteps(GAMESTATE->m_pCurSong, vpPossibleSteps); + } + bool bStepsIsPossible = find(vpPossibleSteps.begin(), vpPossibleSteps.end(), GAMESTATE->m_pCurSteps[p]) == vpPossibleSteps.end(); + if(!bStepsIsPossible) + { + GAMESTATE->m_pCurSteps[p].Set(NULL); + } + } + } } MusicWheel::~MusicWheel()