From dc11040312995fe7b009bbc05a2086620f3f5421 Mon Sep 17 00:00:00 2001 From: Benau Date: Sat, 13 Apr 2019 13:12:02 +0800 Subject: [PATCH] Use a special variable to save confirmed finish ticks --- src/karts/kart.cpp | 11 +++++++++-- src/karts/kart.hpp | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index f60ec0cd7..c29ea3389 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -323,6 +323,7 @@ void Kart::reset() } m_network_finish_check_ticks = 0; + m_network_confirmed_finish_ticks = 0; m_enabled_network_spectator = false; // Add karts back in case that they have been removed (i.e. in battle // mode) - but only if they actually have a body (e.g. ghost karts @@ -990,6 +991,12 @@ void Kart::finishedRace(float time, bool from_server) } } // !from_server + if (NetworkConfig::get()->isClient()) + { + m_network_confirmed_finish_ticks = + World::getWorld()->getTicksSinceStart(); + } + m_finished_race = true; m_finish_time = time; @@ -1370,9 +1377,9 @@ void Kart::update(int ticks) race_manager->getNumLocalPlayers() == 1 && race_manager->modeHasLaps() && World::getWorld()->isActiveRacePhase() && - m_network_finish_check_ticks > 0 && + m_network_confirmed_finish_ticks > 0 && World::getWorld()->getTicksSinceStart() > - m_network_finish_check_ticks + stk_config->time2Ticks(1.0f) && + m_network_confirmed_finish_ticks + stk_config->time2Ticks(1.0f) && !m_enabled_network_spectator) { static bool msg_shown = false; diff --git a/src/karts/kart.hpp b/src/karts/kart.hpp index 058b4643e..af5d87bb1 100644 --- a/src/karts/kart.hpp +++ b/src/karts/kart.hpp @@ -70,6 +70,7 @@ class Kart : public AbstractKart friend class Skidding; private: int m_network_finish_check_ticks; + int m_network_confirmed_finish_ticks; protected: /** Offset of the graphical kart chassis from the physical chassis. */ float m_graphical_y_offset;