minor cleanup

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2305 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2008-09-27 20:49:11 +00:00
parent 8d48875044
commit faa1ba9161
5 changed files with 8 additions and 45 deletions

View File

@ -596,9 +596,6 @@ void Kart::update(float dt)
// Check if any herring was hit. // Check if any herring was hit.
herring_manager->hitHerring(this); herring_manager->hitHerring(this);
//if(RaceManager::getWorld()->isLinearRace()) updateSectorProgression();
//if(!m_finished_race && RaceManager::getWorld()->isLinearRace()) doLapCounting();
processSkidMarks(); processSkidMarks();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -103,8 +103,6 @@ protected:
and if so assign them to wheel_* variables */ and if so assign them to wheel_* variables */
void load_wheels (ssgBranch* obj); void load_wheels (ssgBranch* obj);
//virtual void doLapCounting ();
public: public:
Kart(const std::string& kart_name, int position, Kart(const std::string& kart_name, int position,
const btTransform& init_transform); const btTransform& init_transform);
@ -124,11 +122,6 @@ public:
virtual void setPosition (int p) virtual void setPosition (int p)
{ m_race_position = p; } { m_race_position = p; }
// these methods only makes sense for linear races
//int getSector () const;
//float getDistanceDownTrack() const;
//float getDistanceToCenter () const;
Attachment *getAttachment () { return &m_attachment; } Attachment *getAttachment () { return &m_attachment; }
void setAttachmentType (attachmentType t, float time_left=0.0f, void setAttachmentType (attachmentType t, float time_left=0.0f,
Kart*k=NULL) Kart*k=NULL)
@ -220,7 +213,6 @@ public:
virtual void crashed (Kart *k); virtual void crashed (Kart *k);
virtual void update (float dt); virtual void update (float dt);
//void updateSectorProgression();
virtual void raceFinished (float time); virtual void raceFinished (float time);
}; };

View File

@ -188,7 +188,6 @@ void LinearWorld::doLapCounting ( KartInfo& kart_info, Kart* kart )
kart_info.m_race_lap++ ; kart_info.m_race_lap++ ;
} }
// Race finished // Race finished
// =============
if(kart_info.m_race_lap >= race_manager->getNumLaps() && if(kart_info.m_race_lap >= race_manager->getNumLaps() &&
race_manager->getMinorMode() != RaceManager::MINOR_MODE_FOLLOW_LEADER) race_manager->getMinorMode() != RaceManager::MINOR_MODE_FOLLOW_LEADER)
{ {
@ -208,6 +207,7 @@ void LinearWorld::doLapCounting ( KartInfo& kart_info, Kart* kart )
time_per_lap=RaceManager::getWorld()->getTime() - kart_info.m_lap_start_time; time_per_lap=RaceManager::getWorld()->getTime() - kart_info.m_lap_start_time;
} }
// if new fastest lap
if(time_per_lap < RaceManager::getWorld()->getFastestLapTime() && if(time_per_lap < RaceManager::getWorld()->getFastestLapTime() &&
race_manager->raceHasLaps()) race_manager->raceHasLaps())
{ {
@ -226,12 +226,7 @@ void LinearWorld::doLapCounting ( KartInfo& kart_info, Kart* kart )
m->addMessage(m_fastest_lap_message, NULL, m->addMessage(m_fastest_lap_message, NULL,
2.0f, 40, 100, 210, 100); 2.0f, 40, 100, 210, 100);
} // if m } // if m
} // if time_per_lap < RaceManager::getWorld()->getFasterstLapTime() } // end if new fastest lap
//if(kart->isPlayerKart())
//{
// Put in in the highscore list???
//printf("Time per lap: %s %f\n", getName().c_str(), time_per_lap);
//}
} }
kart_info.m_lap_start_time = RaceManager::getWorld()->getTime(); kart_info.m_lap_start_time = RaceManager::getWorld()->getTime();
} }
@ -305,7 +300,6 @@ KartIconDisplayInfo* LinearWorld::getKartsDisplayInfo(const RaceGUI* caller)
const float lap_time = getTimeAtLapForKart(kart->getWorldKartId()); const float lap_time = getTimeAtLapForKart(kart->getWorldKartId());
const int current_lap = getLapForKart( kart->getWorldKartId() ); const int current_lap = getLapForKart( kart->getWorldKartId() );
rank_info.lap = current_lap; rank_info.lap = current_lap;
//rank_info.rank = kart->getPosition();
const int position = kart->getPosition(); const int position = kart->getPosition();
if(current_lap > laps_of_leader) if(current_lap > laps_of_leader)
@ -377,6 +371,7 @@ void LinearWorld::terminateRace()
} // if !hasFinishedRace } // if !hasFinishedRace
} // for i } // for i
} }
//-----------------------------------------------------------------------------
float LinearWorld::estimateFinishTimeForKart (Kart* kart, KartInfo& kart_info) float LinearWorld::estimateFinishTimeForKart (Kart* kart, KartInfo& kart_info)
{ {
// Estimate the arrival time of any karts that haven't arrived // Estimate the arrival time of any karts that haven't arrived
@ -400,6 +395,7 @@ float LinearWorld::estimateFinishTimeForKart (Kart* kart, KartInfo& kart_info)
} // estimateFinishTime } // estimateFinishTime
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// override 'forceRescue' to do some linear-race-specific actions
void LinearWorld::forceRescue(Kart* kart, KartInfo& kart_info, bool shortcut) void LinearWorld::forceRescue(Kart* kart, KartInfo& kart_info, bool shortcut)
{ {
// If rescue is triggered while doing a shortcut, reset the kart to the // If rescue is triggered while doing a shortcut, reset the kart to the
@ -413,6 +409,8 @@ void LinearWorld::forceRescue(Kart* kart, KartInfo& kart_info, bool shortcut)
kart->forceRescue(); kart->forceRescue();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Decide where to drop a rescued kart
*/
void LinearWorld::moveKartAfterRescue(Kart* kart, btRigidBody* body) void LinearWorld::moveKartAfterRescue(Kart* kart, btRigidBody* body)
{ {
KartInfo& info = m_kart_info[kart->getWorldKartId()]; KartInfo& info = m_kart_info[kart->getWorldKartId()];
@ -436,8 +434,7 @@ void LinearWorld::moveKartAfterRescue(Kart* kart, btRigidBody* body)
body->setCenterOfMassTransform(pos); body->setCenterOfMassTransform(pos);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** Find the position (rank) of 'kart' /** Find the position (rank) of 'kart' and update it accordingly
*
*/ */
void LinearWorld::updateRacePosition ( Kart* kart, KartInfo& kart_info ) void LinearWorld::updateRacePosition ( Kart* kart, KartInfo& kart_info )
{ {

View File

@ -67,9 +67,6 @@ World::World()
m_eliminated_players = 0; m_eliminated_players = 0;
m_clock.setMode( CHRONO ); m_clock.setMode( CHRONO );
m_linear_race = true;
m_use_highscores = true; m_use_highscores = true;
// Grab the track file // Grab the track file
@ -275,14 +272,7 @@ void World::update(float dt)
projectile_manager->update(dt); projectile_manager->update(dt);
herring_manager->update(dt); herring_manager->update(dt);
/*
for ( Karts::size_type i = 0 ; i < kart_amount; ++i)
{
if(m_kart[i]->isEliminated()) continue; // ignore eliminated kart
//if(isLinearRace() && !m_kart[i]->hasFinishedRace()) updateRacePosition((int)i);
//if(m_kart[i]->isPlayerKart()) m_kart[i]->addMessages(); // add 'wrong direction'
}
*/
/* Routine stuff we do even when paused */ /* Routine stuff we do even when paused */
callback_manager->update(dt); callback_manager->update(dt);
} }

View File

@ -100,12 +100,6 @@ protected:
bool m_faster_music_active; // true if faster music was activated bool m_faster_music_active; // true if faster music was activated
/** whether this kind of race orders karts from first to last, whether
* you can count laps, have some sort of progression record, whether
* sectors and drivelines are used, etc. This will be off for e.g. battle mode.
*/
bool m_linear_race;
/** Whether highscores should be used for this kind of race. /** Whether highscores should be used for this kind of race.
* True by default, change to false in a child class to disable. * True by default, change to false in a child class to disable.
*/ */
@ -187,13 +181,6 @@ public:
m_clock.getPhase() == DELAY_FINISH_PHASE) && m_clock.getPhase() == DELAY_FINISH_PHASE) &&
m_clock.getMode() != CLOCK_NONE); } m_clock.getMode() != CLOCK_NONE); }
/** whether this kind of race orders karts from first to last, whether
* you can count laps, have some sort of progression record, whether
* sectors and drivelines are used, etc. This will be off for e.g. battle mode.
*/
bool isLinearRace() const { return m_linear_race; }
/** Called by the code that draws the list of karts on the race GUI /** Called by the code that draws the list of karts on the race GUI
* to know what needs to be drawn in the current mode * to know what needs to be drawn in the current mode
*/ */