fix pushing players off of unselectable choices

This commit is contained in:
Glenn Maynard
2004-02-02 22:34:49 +00:00
parent 3d1a6e9f05
commit bd9db2a7da
+8 -2
View File
@@ -417,13 +417,19 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
int iSwitchToIndex = -1;
int i;
for( i=m_iChoiceOnPage[p]+1; iSwitchToIndex == -1 && i < (int) m_ModeChoices[m_CurrentPage].size(); ++i )
if( m_ModeChoices[m_CurrentPage][i].IsPlayable() )
{
const ModeChoice &mc = m_ModeChoices[m_CurrentPage][i];
if( mc.IsPlayable() && !BothPlayersModeChoice(mc) )
iSwitchToIndex = i;
}
if( iSwitchToIndex == -1 ) /* couldn't find a spot looking up; look down */
{
for( i=m_iChoiceOnPage[p]-1; iSwitchToIndex == -1 && i >= 0; --i )
if( m_ModeChoices[m_CurrentPage][i].IsPlayable() )
{
const ModeChoice &mc = m_ModeChoices[m_CurrentPage][i];
if( mc.IsPlayable() && !BothPlayersModeChoice(mc) )
iSwitchToIndex = i;
}
}
/* We should always find a place to go--we should at least be able to choose
* the same thing pn picked. */