fix next screen logic
This commit is contained in:
@@ -34,12 +34,14 @@ CString ICONS_X_NAME( size_t p ) { return ssprintf("IconsP%dX",p+1); }
|
||||
|
||||
OptionRow::OptionRow()
|
||||
{
|
||||
m_pHand = NULL;
|
||||
|
||||
Clear();
|
||||
|
||||
FOREACH_PlayerNumber( p )
|
||||
this->AddChild( &m_OptionIcons[p] );
|
||||
this->AddChild( &m_sprBullet );
|
||||
this->AddChild( &m_textTitle );
|
||||
|
||||
m_pHand = NULL;
|
||||
}
|
||||
|
||||
OptionRow::~OptionRow()
|
||||
@@ -68,6 +70,7 @@ void OptionRow::Clear()
|
||||
|
||||
m_bFirstItemGoesDown = false;
|
||||
ZERO( m_bRowHasFocus );
|
||||
ZERO( m_iChoiceInRowWithFocus );
|
||||
}
|
||||
|
||||
void OptionRow::DetachHandler()
|
||||
|
||||
@@ -106,14 +106,14 @@ public:
|
||||
if( m_RowDef.bOneChoiceForAllPlayers )
|
||||
pn = PLAYER_1;
|
||||
int iChoice = m_iChoiceInRowWithFocus[pn];
|
||||
ASSERT(iChoice<(int)m_RowDef.choices.size());
|
||||
ASSERT(iChoice >= 0 && iChoice < (int)m_RowDef.choices.size());
|
||||
return iChoice;
|
||||
}
|
||||
void SetChoiceInRowWithFocus( PlayerNumber pn, int iChoice )
|
||||
{
|
||||
if( m_RowDef.bOneChoiceForAllPlayers )
|
||||
pn = PLAYER_1;
|
||||
ASSERT(iChoice<(int)m_RowDef.choices.size());
|
||||
ASSERT(iChoice >= 0 && iChoice < (int)m_RowDef.choices.size());
|
||||
m_iChoiceInRowWithFocus[pn] = iChoice;
|
||||
}
|
||||
bool GetSelected( PlayerNumber pn, int iChoice ) const
|
||||
|
||||
@@ -1013,6 +1013,7 @@ void ScreenOptions::MoveRow( PlayerNumber pn, int dir, bool Repeat )
|
||||
const unsigned iOldSelection = row.GetChoiceInRowWithFocus(p);
|
||||
|
||||
m_iCurrentRow[p] = r;
|
||||
ASSERT( r >= 0 && r < (int)m_Rows.size() );
|
||||
|
||||
OptionRow &row = *m_Rows[r];
|
||||
|
||||
@@ -1088,10 +1089,6 @@ void ScreenOptions::MenuDown( PlayerNumber pn, const InputEventType type )
|
||||
int ScreenOptions::GetCurrentRow( PlayerNumber pn ) const
|
||||
{
|
||||
const int r = m_iCurrentRow[pn];
|
||||
OptionRow &row = *m_Rows[r];
|
||||
|
||||
if( row.GetRowType() != OptionRow::ROW_NORMAL )
|
||||
return -1;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,26 +154,18 @@ void ScreenOptionsMaster::BeginFadingOut()
|
||||
* honor it. */
|
||||
m_sNextScreen = "";
|
||||
|
||||
const unsigned uFocusRow = this->GetCurrentRow();
|
||||
int iCurRow = this->GetCurrentRow();
|
||||
ASSERT( iCurRow >= 0 && iCurRow < (int)m_Rows.size() );
|
||||
OptionRow &row = *m_Rows[iCurRow];
|
||||
|
||||
for( unsigned r = 0; r < OptionRowHandlers.size(); ++r )
|
||||
if( iCurRow < (int)OptionRowHandlers.size() )
|
||||
{
|
||||
OptionRow &row = *m_Rows[r];
|
||||
|
||||
CHECKPOINT_M( ssprintf("%i/%i", r, int(OptionRowHandlers.size())) );
|
||||
|
||||
/* If SELECT_NONE, only apply it if it's the selected option. */
|
||||
if( row.GetRowDef().selectType == SELECT_NONE && r != uFocusRow )
|
||||
continue;
|
||||
|
||||
OptionRowHandler *pHand = OptionRowHandlers[r];
|
||||
|
||||
const int iChoice = row.GetChoiceInRowWithFocus(GAMESTATE->m_MasterPlayerNumber);
|
||||
OptionRowHandler *pHand = OptionRowHandlers[iCurRow];
|
||||
CString sScreen = pHand->GetAndEraseScreen( iChoice );
|
||||
if( !sScreen.empty() )
|
||||
m_sNextScreen = sScreen;
|
||||
}
|
||||
CHECKPOINT;
|
||||
|
||||
// NEXT_SCREEN;
|
||||
if( m_sNextScreen == "" )
|
||||
|
||||
Reference in New Issue
Block a user