Applied patch by 'lutzfischer' (sourceforge patch forum):

- fixed --numkarts/-k command line option (including
  using '-1' meaning 'all karts').
- the default number of karts (used for quickstart) is now
  taken from the user config file, i.e. once you've set  your
  preferred number of karts, you will get this number withouth
  having to specify it all the time).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1242 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2007-09-19 03:28:11 +00:00
parent 612a847dbd
commit 329696f5a6
2 changed files with 14 additions and 4 deletions

View File

@ -333,7 +333,6 @@ void InitTuxkart()
// default settings for Quickstart // default settings for Quickstart
race_manager->setNumPlayers(1); race_manager->setNumPlayers(1);
race_manager->setNumKarts (4);
race_manager->setNumLaps (3); race_manager->setNumLaps (3);
race_manager->setRaceMode (RaceSetup::RM_QUICK_RACE); race_manager->setRaceMode (RaceSetup::RM_QUICK_RACE);
race_manager->setDifficulty(RD_MEDIUM); race_manager->setDifficulty(RD_MEDIUM);

View File

@ -28,6 +28,7 @@
#include "gui/menu_manager.hpp" #include "gui/menu_manager.hpp"
#include "world.hpp" #include "world.hpp"
#include "scene.hpp" #include "scene.hpp"
#include "user_config.hpp"
RaceManager* race_manager= NULL; RaceManager* race_manager= NULL;
@ -61,11 +62,17 @@ GrandPrixMode::GrandPrixMode(const std::vector<std::string>& players_,
: m_difficulty(difficulty_), m_num_karts(numKarts_), m_players(players_), : m_difficulty(difficulty_), m_num_karts(numKarts_), m_players(players_),
m_cup(cup_), m_track(0) m_cup(cup_), m_track(0)
{ {
const int NUM_PLAYERS = m_players.size();
std::vector<std::string> kart_names; std::vector<std::string> kart_names;
// make sure we have a valid number of karts
if ((m_num_karts < 0) || (m_num_karts > NUM_PLAYERS + int(kart_properties_manager->getNumberOfKarts()))) {
m_num_karts = NUM_PLAYERS + kart_properties_manager->getNumberOfKarts();
}
kart_names.resize(m_num_karts); kart_names.resize(m_num_karts);
const int NUM_PLAYERS = m_players.size();
for(int i = 0; i < NUM_PLAYERS; ++i) for(int i = 0; i < NUM_PLAYERS; ++i)
{ {
/*Players position is behind the AI in the first race*/ /*Players position is behind the AI in the first race*/
@ -159,7 +166,11 @@ QuickRaceMode::QuickRaceMode(const std::string& track_,
int numKarts_, int numLaps_) int numKarts_, int numLaps_)
: m_track(track_), m_players(players_), m_difficulty(difficulty_), : m_track(track_), m_players(players_), m_difficulty(difficulty_),
m_num_karts(numKarts_), m_num_laps(numLaps_) m_num_karts(numKarts_), m_num_laps(numLaps_)
{} {
if ((m_num_karts<0) || (m_num_karts > int(kart_properties_manager->getNumberOfKarts() + m_players.size()))) {
m_num_karts = kart_properties_manager->getNumberOfKarts() + m_players.size();
}
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
@ -222,7 +233,7 @@ TimeTrialMode::start()
RaceManager::RaceManager() RaceManager::RaceManager()
{ {
m_mode = 0; m_mode = 0;
m_num_karts = 6; m_num_karts = user_config->m_karts;
m_difficulty = RD_MEDIUM; m_difficulty = RD_MEDIUM;
m_race_mode = RaceSetup::RM_QUICK_RACE; m_race_mode = RaceSetup::RM_QUICK_RACE;
m_track = "race"; m_track = "race";