From 3c5a1a1203a6749e8a24877459b7b04a79bee58c Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Mon, 1 Apr 2024 01:06:32 +0200 Subject: [PATCH] Engine: flip order of checks Check for cvar or state first before checking the current thread. The cvar/state check is slightly cheaper. --- src/common/callback.cpp | 2 +- src/engine/net_chan.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/callback.cpp b/src/common/callback.cpp index 1a0ef548..8ea1e366 100644 --- a/src/common/callback.cpp +++ b/src/common/callback.cpp @@ -562,7 +562,7 @@ void Cmd_Exec_f(const CCommand& args) // Prevent users from running neo strafe commands and other quick hacks. // TODO: when reBar becomes a thing, we should verify this function and // flag users that patch them out. - if (!ThreadInServerFrameThread() && g_pClientState->IsActive()) + if (g_pClientState->IsActive() && !ThreadInServerFrameThread()) { const int execQuota = sv_quota_scriptExecsPerSecond.GetInt(); diff --git a/src/engine/net_chan.cpp b/src/engine/net_chan.cpp index 16fefd21..bef2d6c6 100644 --- a/src/engine/net_chan.cpp +++ b/src/engine/net_chan.cpp @@ -372,7 +372,7 @@ void CNetChan::_Shutdown(CNetChan* pChan, const char* szReason, uint8_t bBadRep, bool CNetChan::_ProcessMessages(CNetChan* pChan, bf_read* pBuf) { #ifndef CLIENT_DLL - if (!ThreadInServerFrameThread() || !net_processTimeBudget.GetInt()) + if (!net_processTimeBudget.GetInt() || !ThreadInServerFrameThread()) return pChan->ProcessMessages(pBuf); const double flStartTime = Plat_FloatTime();