From 225494b5599ed6dc013532bcf6b91e257340b46f Mon Sep 17 00:00:00 2001 From: Vincent Herbet Date: Wed, 7 Aug 2013 16:46:40 +0200 Subject: [PATCH] Fix tfcstats_pause imcomplete implementation (bug 5836, r=Nextra) Former-commit-id: ea7b0f56fd2ea2f8d59d5b30172d8d9bfe4079f9 --- dlls/tfcx/CMisc.cpp | 15 ++++++++++++--- dlls/tfcx/Utils.cpp | 2 +- dlls/tfcx/moduleconfig.cpp | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/dlls/tfcx/CMisc.cpp b/dlls/tfcx/CMisc.cpp index e4384490..44641183 100755 --- a/dlls/tfcx/CMisc.cpp +++ b/dlls/tfcx/CMisc.cpp @@ -161,7 +161,10 @@ void CPlayer::Init( int pi, edict_t* pe ) bot = false; } -void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk){ +void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk) +{ + if (!isModuleActive()) + return; if ( ignoreBots(pEdict,pVictim->pEdict) ) return; @@ -218,7 +221,10 @@ void CPlayer::saveKill(CPlayer* pVictim, int wweapon, int hhs, int ttk){ life.tks += ttk; } -void CPlayer::saveHit(CPlayer* pVictim, int wweapon, int ddamage, int bbody){ +void CPlayer::saveHit(CPlayer* pVictim, int wweapon, int ddamage, int bbody) +{ + if (!isModuleActive()) + return; if ( ignoreBots(pEdict,pVictim->pEdict) ) return; @@ -264,7 +270,10 @@ void CPlayer::saveHit(CPlayer* pVictim, int wweapon, int ddamage, int bbody){ life.bodyHits[bbody]++; } -void CPlayer::saveShot(int weapon){ +void CPlayer::saveShot(int weapon) +{ + if (!isModuleActive()) + return; //PRINT_CONSOLE("Shot! Weapon:%d\n",weapon); diff --git a/dlls/tfcx/Utils.cpp b/dlls/tfcx/Utils.cpp index ec867908..e8f504e0 100755 --- a/dlls/tfcx/Utils.cpp +++ b/dlls/tfcx/Utils.cpp @@ -57,7 +57,7 @@ bool ignoreBots (edict_t *pEnt, edict_t *pOther) } bool isModuleActive(){ - if ( !(int)CVAR_GET_FLOAT("tfcstats_pause") ) + if (!(int)tfcstats_pause->value) return true; return false; } diff --git a/dlls/tfcx/moduleconfig.cpp b/dlls/tfcx/moduleconfig.cpp index c9a94223..c958188d 100755 --- a/dlls/tfcx/moduleconfig.cpp +++ b/dlls/tfcx/moduleconfig.cpp @@ -134,8 +134,8 @@ void ServerActivate_Post( edict_t *pEdictList, int edictCount, int clientMax ){ void PlayerPreThink_Post( edict_t *pEntity ) { CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); - if ( !isModuleActive() ) // stats only - return; + if (!isModuleActive()) // stats only + RETURN_META(MRES_IGNORED); if (pPlayer->clearStats && pPlayer->clearStats < gpGlobals->time && pPlayer->ingame){