From 4734e50a68a7bd7cf9907e12b648620f414f68c4 Mon Sep 17 00:00:00 2001 From: Alayan Date: Fri, 12 Oct 2018 19:10:46 +0200 Subject: [PATCH] Also increase the FTL countdown when the leader is rescued --- src/karts/rescue_animation.cpp | 13 ++++++++++++- src/modes/follow_the_leader.hpp | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/karts/rescue_animation.cpp b/src/karts/rescue_animation.cpp index a20b3589b..b5dc3f1d6 100644 --- a/src/karts/rescue_animation.cpp +++ b/src/karts/rescue_animation.cpp @@ -23,10 +23,12 @@ #include "items/attachment.hpp" #include "karts/abstract_kart.hpp" #include "karts/kart_properties.hpp" +#include "modes/follow_the_leader.hpp" #include "modes/three_strikes_battle.hpp" #include "network/network_config.hpp" #include "physics/physics.hpp" #include "physics/triangle_mesh.hpp" +#include "race/race_manager.hpp" #include "tracks/drive_graph.hpp" #include "tracks/quad.hpp" #include "tracks/track.hpp" @@ -45,7 +47,7 @@ RescueAnimation::RescueAnimation(AbstractKart *kart, bool is_auto_rescue, : AbstractKartAnimation(kart, "RescueAnimation") { btTransform prev_trans = kart->getTrans(); - // Get the required final physicial transform for network, then reset back + // Get the required final physical transform for network, then reset back // to the original transform World::getWorld()->moveKartAfterRescue(kart); @@ -89,6 +91,15 @@ RescueAnimation::RescueAnimation(AbstractKart *kart, bool is_auto_rescue, } } + // Allow FTL mode to apply special action when the leader is rescued + if (race_manager->isFollowMode()) + { + FollowTheLeaderRace *ftl_world = + dynamic_cast(World::getWorld()); + if(ftl_world->isLeader(kart->getWorldKartId())) + ftl_world->leaderRescued(); + } + // Clear powerups when rescue in CTF if (!from_state) { diff --git a/src/modes/follow_the_leader.hpp b/src/modes/follow_the_leader.hpp index d80a6c265..498521a73 100644 --- a/src/modes/follow_the_leader.hpp +++ b/src/modes/follow_the_leader.hpp @@ -63,6 +63,8 @@ public: bool isLeader(int kart_id) { return (kart_id == 0); } void leaderHit(); + // For now, use a similar countdown change as with leaderHit + void leaderRescued() { leaderHit(); } }; // FollowTheLeader