Use server current time for reload logic

Use server's current time for reload logic instead of a dedicated fast timer.
This commit is contained in:
Kawe Mazidjatari 2023-02-12 15:32:34 +01:00
parent 612ab83b20
commit 15e9259b77

View File

@ -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())