Added string array for karts per gamemode, and references to it to replace num_karts
This commit is contained in:
parent
6dcee109b5
commit
74cdd07ba7
@ -369,7 +369,22 @@ namespace UserConfigParams
|
||||
PARAM_PREFIX StringUserConfigParam m_last_used_kart_group
|
||||
PARAM_DEFAULT( StringUserConfigParam("all", "last_kart_group",
|
||||
"Last selected kart group") );
|
||||
|
||||
// ---- Gamemode setup
|
||||
|
||||
PARAM_PREFIX StringListUserConfigParam m_karts_per_gamemode
|
||||
PARAM_DEFAULT(StringListUserConfigParam("karts_per_gamemode",
|
||||
"Number of karts per gamemode. Order corresponds to Enum value",
|
||||
10,
|
||||
"3",
|
||||
"3",
|
||||
"3",
|
||||
"3",
|
||||
"3",
|
||||
"3",
|
||||
"3",
|
||||
"3",
|
||||
"3",
|
||||
"3"));
|
||||
// ---- Wiimote data
|
||||
PARAM_PREFIX GroupUserConfigParam m_wiimote_group
|
||||
PARAM_DEFAULT( GroupUserConfigParam("WiiMote",
|
||||
|
@ -163,15 +163,20 @@ void TrackInfoScreen::init()
|
||||
race_manager->hasAI());
|
||||
m_ai_kart_spinner->setVisible(has_AI);
|
||||
getWidget<LabelWidget>("ai-text")->setVisible(has_AI);
|
||||
|
||||
std::vector<std::string> karts_per_gamemode = UserConfigParams::m_karts_per_gamemode;
|
||||
|
||||
if (has_AI)
|
||||
{
|
||||
m_ai_kart_spinner->setActive(true);
|
||||
|
||||
|
||||
int num_ai = stoi(karts_per_gamemode[race_manager->getMinorMode()]) - local_players;
|
||||
// Avoid negative numbers (which can happen if e.g. the number of karts
|
||||
// in a previous race was lower than the number of players now.
|
||||
int num_ai = UserConfigParams::m_num_karts - local_players;
|
||||
|
||||
if (num_ai < 0) num_ai = 0;
|
||||
m_ai_kart_spinner->setValue(num_ai);
|
||||
|
||||
race_manager->setNumKarts(num_ai + local_players);
|
||||
// Set the max karts supported based on the battle arena selected
|
||||
if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_3_STRIKES ||
|
||||
@ -240,6 +245,8 @@ void TrackInfoScreen::init()
|
||||
m_ai_kart_spinner->setValue(0);
|
||||
m_ai_kart_spinner->setActive(false);
|
||||
race_manager->setNumKarts(race_manager->getNumLocalPlayers());
|
||||
karts_per_gamemode[race_manager->getMinorMode()] = race_manager->getNumLocalPlayers();
|
||||
UserConfigParams::m_karts_per_gamemode = karts_per_gamemode;
|
||||
UserConfigParams::m_num_karts = race_manager->getNumLocalPlayers();
|
||||
}
|
||||
else if (record_available)
|
||||
|
Loading…
Reference in New Issue
Block a user