fixed bonus boxes appearing in time trial mode

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2422 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2008-11-08 02:07:54 +00:00
parent f7d0e38a87
commit 576d1c3265
7 changed files with 24 additions and 2 deletions

View File

@@ -26,8 +26,8 @@
FollowTheLeaderRace::FollowTheLeaderRace() : LinearWorld()
{
m_leader_intervals = stk_config->m_leader_intervals;
TimedRace::setClockMode(COUNTDOWN, m_leader_intervals[0]);
LinearWorld::init();
}
//-----------------------------------------------------------------------------

View File

@@ -32,6 +32,10 @@
//-----------------------------------------------------------------------------
LinearWorld::LinearWorld() : World()
{
}
void LinearWorld::init()
{
World::init();
const unsigned int kart_amount = m_kart.size();
m_kart_display_info = new KartIconDisplayInfo[kart_amount];

View File

@@ -62,6 +62,10 @@ protected:
void updateRacePosition ( Kart* kart, KartInfo& kart_info );
public:
LinearWorld();
/** call just after instanciating. can't be moved to the contructor as child
classes must be instanciated, otherwise polymorphism will fail and the
results will be incorrect */
void init();
virtual ~LinearWorld();
/** This vector contains an 'KartInfo' struct for every kart in the race.
@@ -86,6 +90,7 @@ public:
virtual void restartRace();
virtual bool raceHasLaps(){ return true; }
virtual bool enableBonusBoxes(){ return true; }
/** Called by the race result GUI at the end of the race to know the final order
(fill in the 'order' array) */

View File

@@ -24,6 +24,7 @@
StandardRace::StandardRace() : LinearWorld()
{
TimedRace::setClockMode(CHRONO);
LinearWorld::init();
}
//-----------------------------------------------------------------------------
@@ -101,6 +102,8 @@ void StandardRace::getDefaultCollectibles(int& collectible_type, int& amount)
//-----------------------------------------------------------------------------
bool StandardRace::enableBonusBoxes()
{
printf("StandardRace::enableBonusBoxes() -- are we in time trial? %i \n", (race_manager->getMinorMode() == RaceManager::MINOR_MODE_TIME_TRIAL) );
// in time trial mode, don't use bonus boxes
return race_manager->getMinorMode() != RaceManager::MINOR_MODE_TIME_TRIAL;
}

View File

@@ -27,10 +27,12 @@ ThreeStrikesBattle::ThreeStrikesBattle() : World()
TimedRace::setClockMode(CHRONO);
m_use_highscores = false;
World::init();
// check for possible problems if AI karts were incorrectly added
if(race_manager->getNumKarts() > race_manager->getNumPlayers())
{
fprintf(stderr, "No AI exists for this game mode");
fprintf(stderr, "No AI exists for this game mode\n");
exit(1);
}

View File

@@ -56,6 +56,9 @@
//-----------------------------------------------------------------------------
World::World() : TimedRace()
{
}
void World::init()
{
RaceManager::setWorld(this);
race_state = new RaceState();

View File

@@ -121,6 +121,11 @@ public:
std::string m_debug_text[10];
World();
/** call just after instanciating. can't be moved to the contructor as child
classes must be instanciated, otherwise polymorphism will fail and the
results will be incorrect */
void init();
virtual ~World();
virtual void update(float delta);
virtual void restartRace();