rework ScreenOptionMaster metric names to not depend on language specific row title

create Mines row in ScreenPlayerOptions and move other options around
This commit is contained in:
Chris Danford
2003-11-07 07:25:52 +00:00
parent f1b019cb5e
commit 768b2e5846
12 changed files with 115 additions and 60 deletions
+54 -7
View File
@@ -240,35 +240,34 @@ ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ):
const CString name = asBits[0];
const CString param = asBits.size() > 1? asBits[1]: "";
CString Title = "";
if( !name.CompareNoCase("title") )
{
TitleSetExplicitly = true;
row.name = param;
row.title = param;
}
else if( !name.CompareNoCase("list") )
{
SetList( row, hand, param, Title );
SetList( row, hand, param, row.name );
}
else if( !name.CompareNoCase("steps") )
{
SetStep( row, hand );
Title = "Steps";
row.name = "Steps";
}
else if( !name.CompareNoCase("conf") )
{
SetConf( row, hand, param, Title );
SetConf( row, hand, param, row.name );
}
else if( !name.CompareNoCase("characters") )
{
SetCharacter( row, hand );
Title = "Characters";
row.name = "Characters";
}
else
RageException::Throw( "Unexpected type '%s' in %s::Line%i", name.c_str(), m_sName.c_str(), i );
if( !TitleSetExplicitly )
row.name = Title;
row.title = row.name;
}
OptionRowHandlers.push_back( hand );
}
@@ -568,3 +567,51 @@ void ScreenOptionsMaster::GoToPrevState()
SCREENMAN->SetNewScreen( PREV_SCREEN ); // (GAMESTATE->m_PlayMode) );
}
void ScreenOptionsMaster::RefreshIcons()
{
ASSERT( m_iNumOptionRows < (int) MAX_OPTION_LINES );
for( int p=0; p<NUM_PLAYERS; p++ ) // foreach player
{
if( !GAMESTATE->IsHumanPlayer(p) )
continue;
for( int i=0; i<m_iNumOptionRows; i++ ) // foreach options line
{
OptionRow &row = m_OptionRow[i];
OptionIcon &icon = m_OptionIcons[p][i];
OptionRowHandler &handler = OptionRowHandlers[i];
int iSelection = m_iSelectedOption[p][i];
if( iSelection >= (int)m_OptionRow[i].choices.size() )
{
/* Invalid selection. Send debug output, to aid debugging. */
CString error = ssprintf("Option row with name '%s' selects item %i, but there are only %i items:\n",
m_OptionRow[i].name.c_str(),
iSelection, m_OptionRow[i].choices.size() );
for( unsigned j = 0; j < m_OptionRow[i].choices.size(); ++j )
error += ssprintf(" %s\n", m_OptionRow[i].choices[j].c_str());
RageException::Throw( "%s", error.c_str() );
}
// set icon name
CString sIcon;
switch( handler.type )
{
case ROW_LIST:
sIcon = handler.ListEntries[iSelection].m_sModifiers;
break;
case ROW_STEP:
case ROW_CHARACTER:
sIcon = row.choices[iSelection];
break;
case ROW_CONFIG:
break;
}
icon.Load( (PlayerNumber)p, sIcon, false );
}
}
}