Few loops here.

This commit is contained in:
Jason Felds
2013-04-30 22:12:54 -04:00
parent 246d25ba60
commit dd5480c69f
+9 -7
View File
@@ -108,12 +108,12 @@ void ScreenOptionsManageProfiles::BeginScreen()
PROFILEMAN->GetLocalProfileIDs( m_vsLocalProfileID ); PROFILEMAN->GetLocalProfileIDs( m_vsLocalProfileID );
FOREACH_CONST( RString, m_vsLocalProfileID, s ) for (RString const &s : m_vsLocalProfileID)
{ {
Profile *pProfile = PROFILEMAN->GetLocalProfile( *s ); Profile *pProfile = PROFILEMAN->GetLocalProfile( s );
ASSERT( pProfile != NULL ); ASSERT( pProfile != NULL );
RString sCommand = ssprintf( "gamecommand;screen,ScreenOptionsEditProfile;profileid,%s;name,dummy", s->c_str() ); RString sCommand = ssprintf( "gamecommand;screen,ScreenOptionsEditProfile;profileid,%s;name,dummy", s.c_str() );
OptionRowHandler *pHand = OptionRowHandlerUtil::Make( ParseCommands(sCommand) ); OptionRowHandler *pHand = OptionRowHandlerUtil::Make( ParseCommands(sCommand) );
OptionRowDefinition &def = pHand->m_Def; OptionRowDefinition &def = pHand->m_Def;
def.m_layoutType = LAYOUT_SHOW_ALL_IN_ROW; def.m_layoutType = LAYOUT_SHOW_ALL_IN_ROW;
@@ -124,7 +124,7 @@ void ScreenOptionsManageProfiles::BeginScreen()
PlayerNumber pn = PLAYER_INVALID; PlayerNumber pn = PLAYER_INVALID;
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
if( *s == ProfileManager::m_sDefaultLocalProfileID[p].Get() ) if( s == ProfileManager::m_sDefaultLocalProfileID[p].Get() )
pn = p; pn = p;
if( pn != PLAYER_INVALID ) if( pn != PLAYER_INVALID )
def.m_vsChoices.push_back( PlayerNumberToLocalizedString(pn) ); def.m_vsChoices.push_back( PlayerNumberToLocalizedString(pn) );
@@ -198,14 +198,16 @@ void ScreenOptionsManageProfiles::HandleScreenMessage( const ScreenMessage SM )
if( iNumProfiles < NUM_PLAYERS ) if( iNumProfiles < NUM_PLAYERS )
{ {
int iFirstUnused = -1; int iFirstUnused = -1;
FOREACH_CONST( Preference<RString>*, PROFILEMAN->m_sDefaultLocalProfileID.m_v, i ) int index = 0;
for (Preference<RString> const *i : PROFILEMAN->m_sDefaultLocalProfileID.m_v)
{ {
RString sLocalProfileID = (*i)->Get(); RString sLocalProfileID = i->Get();
if( sLocalProfileID.empty() ) if( sLocalProfileID.empty() )
{ {
iFirstUnused = i - PROFILEMAN->m_sDefaultLocalProfileID.m_v.begin(); iFirstUnused = index;
break; break;
} }
++index;
} }
if( iFirstUnused != -1 ) if( iFirstUnused != -1 )
{ {