Corrrect gp info screen to keep consistency with track info screen.

Now num karts config param is updated only if spinner button or start button has been pressed.
This commit is contained in:
Deve 2017-11-15 22:02:19 +01:00
parent 28cd15cf84
commit 4d4c514c75

View File

@ -243,8 +243,6 @@ void GPInfoScreen::init()
}
num_ai = std::max(min_ai, num_ai);
UserConfigParams::m_num_karts = num_ai + local_players;
race_manager->setNumKarts(num_ai + local_players);
m_ai_kart_spinner->setActive(true);
m_ai_kart_spinner->setValue(num_ai);
@ -315,11 +313,24 @@ void GPInfoScreen::eventCallback(Widget *, const std::string &name,
/*new tracks*/ true );
addTracks();
}
else if (button == "start" || button == "continue")
else if (button == "start")
{
// Normal GP: start/continue a saved GP
// Normal GP: start GP
const int local_players = race_manager->getNumLocalPlayers();
const bool has_AI = race_manager->hasAI();
const int num_ai = has_AI ? m_ai_kart_spinner->getValue() : 0;
race_manager->setNumKarts(local_players + num_ai);
UserConfigParams::m_num_karts = local_players + num_ai;
m_gp.changeReverse(getReverse());
race_manager->startGP(m_gp, false, (button == "continue"));
race_manager->startGP(m_gp, false, false);
}
else if (button == "continue")
{
// Normal GP: continue a saved GP
m_gp.changeReverse(getReverse());
race_manager->startGP(m_gp, false, true);
}
} // name=="buttons"
else if (name=="group-spinner")