FOREACH_CONST( PlayerNumber, vpns, iter ) { PlayerNumber p = *iter; INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] ); VerifySelected( m_RowDef.selectType, m_vbSelected[p], m_RowDef.name ); }
FOREACH_CONST( PlayerNumber, vpns, pn ) { PlayerNumber p = *pn; vector<bool> &vbSelOut = vbSelectedOut[p]; bool bUseFallbackOption = true; for( unsigned e = 0; e < m_aListEntries.size(); ++e ) { const GameCommand &mc = m_aListEntries[e]; vbSelOut[e] = false; if( mc.IsZero() ) { /* The entry has no effect. This is usually a default "none * of the above" entry. It will always return true for * DescribesCurrentMode(). It's only the selected choice if * nothing else matches. */ continue; } if( m_Def.m_bOneChoiceForAllPlayers ) { if( mc.DescribesCurrentModeForAllPlayers() ) { bUseFallbackOption = false; if( m_Def.m_selectType != SELECT_MULTIPLE ) OptionRowHandlerUtil::SelectExactlyOne( e, vbSelOut ); else vbSelOut[e] = true; } } else { if( mc.DescribesCurrentMode(p) ) { bUseFallbackOption = false; if( m_Def.m_selectType != SELECT_MULTIPLE ) OptionRowHandlerUtil::SelectExactlyOne( e, vbSelOut ); else vbSelOut[e] = true; } } } if( m_Def.m_selectType == SELECT_ONE && bUseFallbackOption ) { int iFallbackOption = m_Def.m_iDefault; if( iFallbackOption == -1 ) { RString s = ssprintf("No options in row \"list,%s\" were selected, and no fallback row found; selected entry 0", m_Def.m_sName.c_str()); LOG->Warn( "%s", s.c_str() ); CHECKPOINT_M( s ); iFallbackOption = 0; } OptionRowHandlerUtil::SelectExactlyOne( iFallbackOption, vbSelOut ); } VerifySelected( m_Def.m_selectType, vbSelOut, m_Def.m_sName ); }