From bbbfd4a2233b0eb001c11ab961b95bee4c9fe978 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 10 Nov 2003 19:05:04 +0000 Subject: [PATCH] simplify, fix crash --- stepmania/src/ScreenSelectMaster.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/stepmania/src/ScreenSelectMaster.cpp b/stepmania/src/ScreenSelectMaster.cpp index e68506e3ef..a2869b514e 100644 --- a/stepmania/src/ScreenSelectMaster.cpp +++ b/stepmania/src/ScreenSelectMaster.cpp @@ -231,15 +231,13 @@ void ScreenSelectMaster::UpdateSelectableChoices() bool ScreenSelectMaster::Move( PlayerNumber pn, int dir ) { int iSwitchToIndex = m_iChoice[pn]; - while( iSwitchToIndex >= 0 && iSwitchToIndex < (int) m_aModeChoices.size() ) + do { iSwitchToIndex += dir; - if( m_aModeChoices[iSwitchToIndex].IsPlayable() ) - break; + if( iSwitchToIndex < 0 || iSwitchToIndex >= (int) m_aModeChoices.size() ) + return false; // none found } - - while( iSwitchToIndex < 0 || iSwitchToIndex >= (int) m_aModeChoices.size() ) - return false; // none found + while( !m_aModeChoices[iSwitchToIndex].IsPlayable() ); return ChangeSelection( pn, iSwitchToIndex ); }