Make the FTL countdown addition work for all type of explosion affecting the leader
This commit is contained in:
parent
089f6d108e
commit
a4142c13c1
@ -23,8 +23,10 @@
|
||||
#include "items/attachment.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "modes/follow_the_leader.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "network/network_config.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
|
||||
/** A static create function that does only create an explosion if
|
||||
@ -51,6 +53,14 @@ ExplosionAnimation *ExplosionAnimation::create(AbstractKart *kart,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (race_manager->isFollowMode())
|
||||
{
|
||||
FollowTheLeaderRace *ftl_world =
|
||||
dynamic_cast<FollowTheLeaderRace*>(World::getWorld());
|
||||
if(ftl_world->isLeader(kart->getWorldKartId()))
|
||||
ftl_world->leaderHit();
|
||||
}
|
||||
|
||||
return new ExplosionAnimation(kart, pos, direct_hit);
|
||||
} // create
|
||||
|
||||
|
@ -223,17 +223,12 @@ bool FollowTheLeaderRace::isRaceOver()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** If the leader kart is hit, increase the delay to the next elimination */
|
||||
bool FollowTheLeaderRace::kartHit(int kart_id, int hitter)
|
||||
void FollowTheLeaderRace::leaderHit()
|
||||
{
|
||||
if (kart_id == 0)
|
||||
{
|
||||
int countdown = getTimeTicks();
|
||||
countdown += stk_config->time2Ticks(5.0f);
|
||||
setTicks(countdown);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
int countdown = getTimeTicks();
|
||||
countdown += stk_config->time2Ticks(5.0f);
|
||||
setTicks(countdown);
|
||||
} // leaderHit
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Called at the end of a race. Updates highscores, pauses the game, and
|
||||
|
@ -54,13 +54,15 @@ public:
|
||||
virtual void init() OVERRIDE;
|
||||
virtual void terminateRace() OVERRIDE;
|
||||
virtual bool isRaceOver() OVERRIDE;
|
||||
virtual bool kartHit(int kart_id, int hitter = -1) OVERRIDE;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns if this type of race has laps. */
|
||||
virtual bool raceHasLaps() OVERRIDE { return false; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns if faster music should be used at the end. */
|
||||
virtual bool useFastMusicNearEnd() const OVERRIDE { return false; }
|
||||
|
||||
bool isLeader(int kart_id) { return (kart_id == 0); }
|
||||
void leaderHit();
|
||||
}; // FollowTheLeader
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user