fix multiselect + options icon crash
This commit is contained in:
@@ -58,7 +58,8 @@ void OptionIcon::Load( PlayerNumber pn, CString sText, bool bHeader )
|
|||||||
sText.Replace( " ", "\n" );
|
sText.Replace( " ", "\n" );
|
||||||
|
|
||||||
bool bVacant = (sText=="");
|
bool bVacant = (sText=="");
|
||||||
m_spr.SetState( pn*3 + (bHeader?0:(bVacant?1:2)) );
|
int iState = pn*3 + (bHeader?0:(bVacant?1:2));
|
||||||
|
m_spr.SetState( iState );
|
||||||
|
|
||||||
m_text.SetText( bHeader ? "" : sText );
|
m_text.SetText( bHeader ? "" : sText );
|
||||||
m_text.SetZoom( TEXT_ZOOM );
|
m_text.SetZoom( TEXT_ZOOM );
|
||||||
|
|||||||
@@ -1113,6 +1113,8 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type )
|
|||||||
m_SoundToggleOn.Play();
|
m_SoundToggleOn.Play();
|
||||||
else
|
else
|
||||||
m_SoundToggleOff.Play();
|
m_SoundToggleOff.Play();
|
||||||
|
PositionUnderlines();
|
||||||
|
RefreshIcons();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -598,35 +598,45 @@ void ScreenOptionsMaster::RefreshIcons()
|
|||||||
Row &row = *m_Rows[i];
|
Row &row = *m_Rows[i];
|
||||||
const OptionRowData &data = row.m_RowDef;
|
const OptionRowData &data = row.m_RowDef;
|
||||||
|
|
||||||
int iSelection = row.GetOneSelection((PlayerNumber)p);
|
// find first selection and whether multiple are selected
|
||||||
if( iSelection >= (int)data.choices.size() )
|
int iFirstSelection = -1;
|
||||||
|
bool bMultipleSelected = false;
|
||||||
|
for( int j=0; j<row.m_vbSelected[p].size(); j++ )
|
||||||
{
|
{
|
||||||
/* Invalid selection. Send debug output, to aid debugging. */
|
if( row.m_vbSelected[p][j] )
|
||||||
CString error = ssprintf("Option row with name '%s' selects item %i, but there are only %i items:\n",
|
{
|
||||||
data.name.c_str(),
|
if( iFirstSelection != -1 )
|
||||||
iSelection, (int) data.choices.size() );
|
bMultipleSelected = true;
|
||||||
|
else
|
||||||
|
iFirstSelection = j;
|
||||||
|
}
|
||||||
|
|
||||||
for( unsigned j = 0; j < data.choices.size(); ++j )
|
|
||||||
error += ssprintf(" %s\n", data.choices[j].c_str());
|
|
||||||
|
|
||||||
RageException::Throw( "%s", error.c_str() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set icon name
|
// set icon name
|
||||||
CString sIcon;
|
CString sIcon;
|
||||||
const OptionRowHandler &handler = OptionRowHandlers[i];
|
|
||||||
switch( handler.type )
|
if( bMultipleSelected )
|
||||||
{
|
{
|
||||||
case ROW_LIST:
|
sIcon = "Multiple";
|
||||||
sIcon = handler.ListEntries[iSelection].m_sModifiers;
|
|
||||||
break;
|
|
||||||
case ROW_STEP:
|
|
||||||
case ROW_CHARACTER:
|
|
||||||
sIcon = data.choices[iSelection];
|
|
||||||
break;
|
|
||||||
case ROW_CONFIG:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else if( iFirstSelection != -1 )
|
||||||
|
{
|
||||||
|
const OptionRowHandler &handler = OptionRowHandlers[i];
|
||||||
|
switch( handler.type )
|
||||||
|
{
|
||||||
|
case ROW_LIST:
|
||||||
|
sIcon = handler.ListEntries[iFirstSelection].m_sModifiers;
|
||||||
|
break;
|
||||||
|
case ROW_STEP:
|
||||||
|
case ROW_CHARACTER:
|
||||||
|
sIcon = data.choices[iFirstSelection];
|
||||||
|
break;
|
||||||
|
case ROW_CONFIG:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* XXX: hack to not display text in the song options menu */
|
/* XXX: hack to not display text in the song options menu */
|
||||||
if( data.bOneChoiceForAllPlayers )
|
if( data.bOneChoiceForAllPlayers )
|
||||||
|
|||||||
Reference in New Issue
Block a user