From d20501c547d434c159bb08ed889fafeac3508797 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Wed, 20 Jul 2011 16:25:48 -0500 Subject: [PATCH] attempt to fix a crash when pressing ctrl+letter during the transition --- src/ScreenSelectMusic.cpp | 66 +++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/ScreenSelectMusic.cpp b/src/ScreenSelectMusic.cpp index dbf4882317..40c387634f 100644 --- a/src/ScreenSelectMusic.cpp +++ b/src/ScreenSelectMusic.cpp @@ -384,39 +384,6 @@ void ScreenSelectMusic::Input( const InputEventPlus &input ) { // LOG->Trace( "ScreenSelectMusic::Input()" ); - bool bHoldingCtrl = - INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL)) || - INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL)); - - wchar_t c = INPUTMAN->DeviceInputToChar(input.DeviceI,false); - MakeUpper( &c, 1 ); - - if( bHoldingCtrl && ( c >= 'A' ) && ( c <= 'Z' ) ) - { - // Only allow changing the sort order if the wheel is not locked - // and we're not in course mode. -aj - if( !m_MusicWheel.WheelIsLocked() && !GAMESTATE->IsCourseMode() ) - { - SortOrder so = GAMESTATE->m_SortOrder; - // When in Artist sort, this means first letter of the artist. - // Otherwise, if not in Title sort already, switch to Title sort. - if ( so != SORT_ARTIST ) - so = SORT_TITLE; - - GAMESTATE->m_PreferredSortOrder = so; - GAMESTATE->m_SortOrder.Set( so ); - // Odd, changing the sort order requires us to call SetOpenSection more than once - m_MusicWheel.ChangeSort( so ); - m_MusicWheel.SetOpenSection( ssprintf("%c", c ) ); - - m_MusicWheel.SelectSection( ssprintf("%c", c ) ); - m_MusicWheel.ChangeSort( so ); - m_MusicWheel.SetOpenSection( ssprintf("%c", c ) ); - AfterMusicChange(); - return; - } - } - // debugging? // I just like being able to see untransliterated titles occasionally. if( input.DeviceI.device == DEVICE_KEYBOARD && input.DeviceI.button == KEY_F9 ) @@ -470,6 +437,39 @@ void ScreenSelectMusic::Input( const InputEventPlus &input ) if( IsTransitioning() ) return; // ignore + bool bHoldingCtrl = + INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL)) || + INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL)); + + wchar_t c = INPUTMAN->DeviceInputToChar(input.DeviceI,false); + MakeUpper( &c, 1 ); + + if( bHoldingCtrl && ( c >= 'A' ) && ( c <= 'Z' ) ) + { + // Only allow changing the sort order if the wheel is not locked + // and we're not in course mode. -aj + if( !m_MusicWheel.WheelIsLocked() && !GAMESTATE->IsCourseMode() ) + { + SortOrder so = GAMESTATE->m_SortOrder; + // When in Artist sort, this means first letter of the artist. + // Otherwise, if not in Title sort already, switch to Title sort. + if ( so != SORT_ARTIST ) + so = SORT_TITLE; + + GAMESTATE->m_PreferredSortOrder = so; + GAMESTATE->m_SortOrder.Set( so ); + // Odd, changing the sort order requires us to call SetOpenSection more than once + m_MusicWheel.ChangeSort( so ); + m_MusicWheel.SetOpenSection( ssprintf("%c", c ) ); + + m_MusicWheel.SelectSection( ssprintf("%c", c ) ); + m_MusicWheel.ChangeSort( so ); + m_MusicWheel.SetOpenSection( ssprintf("%c", c ) ); + AfterMusicChange(); + return; + } + } + // Handle unselect steps // xxx: select button could conflict with OptionsList here -aj if( m_SelectionState == SelectionState_SelectingSteps && m_bStepsChosen[input.pn]