Fixed crash in case that not enough AI are selected in a FTL

race (now there will be at least three karts in a FTL race).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6118 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-09-23 03:13:54 +00:00
parent 366395d565
commit 6b3d0db0fa
2 changed files with 4 additions and 2 deletions

View File

@ -297,9 +297,7 @@ void startGame(const std::string trackIdent, const int num_laps)
race_manager->setMajorMode(RaceManager::MAJOR_MODE_SINGLE); race_manager->setMajorMode(RaceManager::MAJOR_MODE_SINGLE);
race_manager->setCoinTarget( 0 ); // Might still be set from a previous challenge race_manager->setCoinTarget( 0 ); // Might still be set from a previous challenge
//race_manager->setNumKarts( 1 );
network_manager->setupPlayerKartInfo(); network_manager->setupPlayerKartInfo();
//race_manager->getKartType(1) = KT_PLAYER;
race_manager->startNew(); race_manager->startNew();
} }

View File

@ -107,6 +107,10 @@ void RaceSetupScreen::eventCallback(Widget* widget, const std::string& name, con
} }
else if (selectedMode == "ftl") else if (selectedMode == "ftl")
{ {
// Make sure there are at least three karts, otherwise FTL doesn't
if(race_manager->getNumberOfKarts()<3)
race_manager->setNumKarts(3);
race_manager->setMinorMode(RaceManager::MINOR_MODE_FOLLOW_LEADER); race_manager->setMinorMode(RaceManager::MINOR_MODE_FOLLOW_LEADER);
StateManager::get()->pushScreen( TracksScreen::getInstance() ); StateManager::get()->pushScreen( TracksScreen::getInstance() );
} }