OptionRowHandlers were originally exclusive to SOMaster, but

they're accessible by SOptions now, too.  Move this slightly
tricky next-screen logic into SOptions, since it can apply
to any screen that sets OptionRowHandlers.

(Actually, this doesn't really belong in BeginFadingOut, since
it's not called "MaybeBeginFadingOutDependingOnTheCurrentOption".
Maybe this should be done in ExportOptions, I'm not sure yet,
but this is a step in the right direction.)
This commit is contained in:
Glenn Maynard
2006-01-16 20:30:55 +00:00
parent 0d5f75e736
commit 5320b3e92e
4 changed files with 31 additions and 33 deletions
+30
View File
@@ -960,6 +960,36 @@ void ScreenOptions::StoreFocus( PlayerNumber pn )
m_iCurrentRow[pn], row.GetChoiceInRowWithFocus(pn), m_iFocusX[pn]);
}
void ScreenOptions::BeginFadingOut()
{
/* If the selection is on a LIST, and the selected LIST option sets the screen,
* honor it. */
int iCurRow = this->GetCurrentRow();
ASSERT( iCurRow >= 0 && iCurRow < (int)m_pRows.size() );
const OptionRow &row = *m_pRows[iCurRow];
{
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
if( row.GetFirstItemGoesDown() )
iChoice--;
// not the "goes down" item
if( iChoice != -1 )
{
const OptionRowHandler *pHand = row.GetHandler();
if( pHand != NULL )
{
CString sThisScreen = pHand->GetScreen( iChoice );
if( sThisScreen != "" )
m_sNextScreen = sThisScreen;
}
}
}
// If options set a NextScreen or one is specified in metrics, then fade out
if( GetNextScreen() != "" )
this->PostScreenMessage( SM_BeginFadingOut, 0 );
}
/* Left/right */
void ScreenOptions::ChangeValueInRowAbsolute( int iRow, PlayerNumber pn, int iChoiceIndex, bool bRepeat )
{