Skip to content

Commit

Permalink
Removed cache of cvar sv_cheats ValveSoftware/halflife#2511
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Jun 8, 2019
1 parent 01e6889 commit 6342fc2
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion regamedll/dlls/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3298,7 +3298,7 @@ void EXT_FUNC InternalCommand(edict_t *pEntity, const char *pcmd, const char *pa
else if (FStrEq(pcmd, "fov"))
{
#if 0
if (g_flWeaponCheat && CMD_ARGC() > 1)
if (CVAR_GET_FLOAT("sv_cheats") != 0.0f && CMD_ARGC() > 1)
GetClassPtr<CCSPlayer>((CBasePlayer *)pev)->m_iFOV = Q_atoi(CMD_ARGV(1));
else
CLIENT_PRINTF(pEntity, print_console, UTIL_VarArgs("\"fov\" is \"%d\"\n", int(GetClassPtr<CCSPlayer>((CBasePlayer *)pev)->m_iFOV)));
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/multiplay_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3243,7 +3243,7 @@ void CHalfLifeMultiplay::InitHUD(CBasePlayer *pl)

UpdateGameMode(pl);

if (!g_flWeaponCheat)
if (!CVAR_GET_FLOAT("sv_cheats"))
{
MESSAGE_BEGIN(MSG_ONE, gmsgViewMode, nullptr, pl->edict());
MESSAGE_END();
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6060,7 +6060,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(ImpulseCommands)()

void CBasePlayer::CheatImpulseCommands(int iImpulse)
{
if (!g_flWeaponCheat)
if (!CVAR_GET_FLOAT("sv_cheats"))
return;

CBaseEntity *pEntity;
Expand Down
3 changes: 0 additions & 3 deletions regamedll/dlls/world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

edict_t *g_pBodyQueueHead;
CGlobalState gGlobalState;
float g_flWeaponCheat;

DLL_DECALLIST gDecals[] =
{
Expand Down Expand Up @@ -216,7 +215,6 @@ void CWorld::Spawn()
EmptyEntityHashTable();
Precache();

g_flWeaponCheat = CVAR_GET_FLOAT("sv_cheats");
g_szMapBriefingText[0] = '\0';
Q_sprintf(szMapBriefingFile, "maps/%s.txt", STRING(gpGlobals->mapname));

Expand Down Expand Up @@ -251,7 +249,6 @@ void CWorld::Spawn()
EmptyEntityHashTable();
Precache();

g_flWeaponCheat = CVAR_GET_FLOAT("sv_cheats");
g_szMapBriefingText[0] = '\0';

int flength = 0;
Expand Down
1 change: 0 additions & 1 deletion regamedll/dlls/world.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,4 @@ class CWorld: public CBaseEntity {
void CopyToBodyQue(entvars_t *pev);
void ClearBodyQue();

extern float g_flWeaponCheat;
extern char g_szMapBriefingText[512];

0 comments on commit 6342fc2

Please sign in to comment.