diff --git a/src/karts/abstract_kart.cpp b/src/karts/abstract_kart.cpp index d6fda8d50..6880fd22e 100644 --- a/src/karts/abstract_kart.cpp +++ b/src/karts/abstract_kart.cpp @@ -72,8 +72,11 @@ AbstractKart::AbstractKart(const std::string& ident, AbstractKart::~AbstractKart() { delete m_kart_model; - if(m_kart_animation) + if (m_kart_animation) + { + m_kart_animation->handleResetRace(); delete m_kart_animation; + } } // ~AbstractKart // ---------------------------------------------------------------------------- @@ -82,8 +85,9 @@ void AbstractKart::reset() // important to delete animations before calling reset, as some animations // set the kart velocity in their destructor (e.g. cannon) which "reset" // can then cancel. See #2738 - if(m_kart_animation) + if (m_kart_animation) { + m_kart_animation->handleResetRace(); delete m_kart_animation; m_kart_animation = NULL; } diff --git a/src/karts/abstract_kart_animation.hpp b/src/karts/abstract_kart_animation.hpp index 7e2fd94fb..f0e79fc57 100644 --- a/src/karts/abstract_kart_animation.hpp +++ b/src/karts/abstract_kart_animation.hpp @@ -108,6 +108,10 @@ public: int getEndTicks() const { return m_end_ticks; } // ------------------------------------------------------------------------ virtual KartAnimationType getAnimationType() const = 0; + // ------------------------------------------------------------------------ + /* Remove the timer changes by checkNetworkAnimationCreationSucceed if + * m_kart has been eliminated by network. */ + void handleResetRace() { m_timer = 9999; } }; // AbstractKartAnimation #endif