Avoid invaild Ai karts number during switching game modes

This commit is contained in:
Benau 2015-12-09 01:27:02 +08:00
parent 140a229f71
commit aac5a368b8

View File

@ -290,6 +290,16 @@ void TrackInfoScreen::onEnterPressedInternal()
m_track->setActualNumberOfLaps(num_laps);
race_manager->setReverseTrack(reverse_track);
// Avoid invaild Ai karts number during switching game modes
const int num_ai = m_ai_kart_spinner->getValue();
if (UserConfigParams::m_num_karts != (signed)(race_manager
->getNumLocalPlayers() + num_ai))
{
race_manager->setNumKarts(race_manager->getNumLocalPlayers() + num_ai);
UserConfigParams::m_num_karts = race_manager->getNumLocalPlayers() +
num_ai;
}
// Disable accidentally unlocking of a challenge
PlayerManager::getCurrentPlayer()->setCurrentChallenge("");