attempt to fix a crash when pressing ctrl+letter during the transition

This commit is contained in:
AJ Kelly
2011-07-20 16:25:48 -05:00
parent 7bd6462929
commit d20501c547
+33 -33
View File
@@ -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]