From 15e9259b77e854fe1750ff106bf9c64fa60b2850 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 12 Feb 2023 15:32:34 +0100 Subject: [PATCH] Use server current time for reload logic Use server's current time for reload logic instead of a dedicated fast timer. --- r5dev/engine/host_state.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/r5dev/engine/host_state.cpp b/r5dev/engine/host_state.cpp index 2428f1a1..007ebc36 100644 --- a/r5dev/engine/host_state.cpp +++ b/r5dev/engine/host_state.cpp @@ -230,7 +230,6 @@ FORCEINLINE void CHostState::Think(void) const static bool bInitialized = false; static CFastTimer banListTimer; static CFastTimer pylonTimer; - static CFastTimer reloadTimer; static CFastTimer statsTimer; if (!bInitialized) // Initialize clocks. @@ -241,7 +240,6 @@ FORCEINLINE void CHostState::Think(void) const pylonTimer.Start(); #endif // DEDICATED statsTimer.Start(); - reloadTimer.Start(); #endif // !CLIENT_DLL bInitialized = true; } @@ -281,10 +279,9 @@ FORCEINLINE void CHostState::Think(void) const #ifndef CLIENT_DLL if (sv_autoReloadRate->GetBool()) { - if (reloadTimer.GetDurationInProgress().GetSeconds() > sv_autoReloadRate->GetDouble()) + if (g_ServerGlobalVariables->m_flCurTime > sv_autoReloadRate->GetDouble()) { Cbuf_AddText(Cbuf_GetCurrentPlayer(), "reload\n", cmd_source_t::kCommandSrcCode); - reloadTimer.Start(); } } if (statsTimer.GetDurationInProgress().GetSeconds() > sv_statusRefreshRate->GetDouble())