Fix #4742
This commit is contained in:
parent
5bfb9aa054
commit
e165a5680b
@ -47,6 +47,7 @@ FollowTheLeaderRace::FollowTheLeaderRace() : LinearWorld()
|
||||
m_use_highscores = false; // disable high scores
|
||||
setClockMode(WorldStatus::CLOCK_COUNTDOWN, m_leader_intervals[0]);
|
||||
m_is_over_delay = 5.0f;
|
||||
m_leader_hit_count = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -89,6 +90,7 @@ void FollowTheLeaderRace::reset(bool restart)
|
||||
m_leader_intervals[0]);
|
||||
|
||||
m_is_over_delay = 2.0f;
|
||||
m_leader_hit_count = 0;
|
||||
} // reset
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -122,7 +124,8 @@ const btTransform &FollowTheLeaderRace::getStartTransform(int index)
|
||||
*/
|
||||
void FollowTheLeaderRace::countdownReachedZero()
|
||||
{
|
||||
m_last_eliminated_time += m_leader_intervals[0];
|
||||
m_last_eliminated_time += m_leader_intervals[0] + m_leader_hit_count * LEADER_HIT_TIME;
|
||||
m_leader_hit_count = 0; // Reset the hit counter
|
||||
if(m_leader_intervals.size()>1)
|
||||
m_leader_intervals.erase(m_leader_intervals.begin());
|
||||
WorldStatus::setTime(m_leader_intervals[0]);
|
||||
@ -146,7 +149,7 @@ void FollowTheLeaderRace::countdownReachedZero()
|
||||
{
|
||||
if(UserConfigParams::m_ftl_debug)
|
||||
{
|
||||
Log::debug("[FTL", "Eliminiating kart '%s' at position %d.",
|
||||
Log::debug("[FTL", "Eliminating kart '%s' at position %d.",
|
||||
kart->getIdent().c_str(), position_to_remove);
|
||||
}
|
||||
eliminateKart(kart->getWorldKartId());
|
||||
@ -227,8 +230,9 @@ bool FollowTheLeaderRace::isRaceOver()
|
||||
void FollowTheLeaderRace::leaderHit()
|
||||
{
|
||||
int countdown = getTimeTicks();
|
||||
countdown += stk_config->time2Ticks(5.0f);
|
||||
countdown += stk_config->time2Ticks(LEADER_HIT_TIME);
|
||||
setTicks(countdown);
|
||||
m_leader_hit_count++;
|
||||
} // leaderHit
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -18,6 +18,8 @@
|
||||
#ifndef _follow_the_leader_hpp_
|
||||
#define _follow_the_leader_hpp_
|
||||
|
||||
#define LEADER_HIT_TIME 5.0f
|
||||
|
||||
#include "modes/linear_world.hpp"
|
||||
|
||||
/**
|
||||
@ -27,9 +29,12 @@
|
||||
class FollowTheLeaderRace : public LinearWorld
|
||||
{
|
||||
private:
|
||||
// time till elimination in follow leader
|
||||
// time till elimination in follow leader
|
||||
std::vector<float> m_leader_intervals;
|
||||
|
||||
// Number of rescue/hit endured by the leader since the previous kart elimination
|
||||
unsigned int m_leader_hit_count;
|
||||
|
||||
/** A timer used before terminating the race. */
|
||||
float m_is_over_delay;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user