From 0df2da48ae4c34afd5d4d39331fd58a827224c41 Mon Sep 17 00:00:00 2001 From: Freeze AutoGavy <1021093715@qq.com> Date: Fri, 28 Jun 2024 20:25:21 +0800 Subject: [PATCH] Don't set command with cheat flags at SliderControl init --- .../client/swarm/gameui/swarm/vslidercontrol.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/game/client/swarm/gameui/swarm/vslidercontrol.cpp b/src/game/client/swarm/gameui/swarm/vslidercontrol.cpp index 4947a3572..9f3d370c3 100644 --- a/src/game/client/swarm/gameui/swarm/vslidercontrol.cpp +++ b/src/game/client/swarm/gameui/swarm/vslidercontrol.cpp @@ -167,6 +167,12 @@ void SliderControl::SetConCommand( const char* conCommand ) m_conVarRef = new CGameUIConVarRef( conCommand ); + // don't set command with cheat flags + if (m_conVarRef && m_conVarRef->IsValid() && (m_conVarRef->IsFlagSet(FCVAR_REPLICATED) || m_conVarRef->IsFlagSet(FCVAR_CHEAT))) { + delete m_conVarRef; + m_conVarRef = NULL; + } + Reset(); } else @@ -190,6 +196,12 @@ void SliderControl::SetConCommandDefault( const char* conCommand ) } m_conVarDefaultRef = new CGameUIConVarRef( conCommand ); + + // don't set command with cheat flags + if (m_conVarDefaultRef && m_conVarDefaultRef->IsValid() && (m_conVarDefaultRef->IsFlagSet(FCVAR_REPLICATED) || m_conVarDefaultRef->IsFlagSet(FCVAR_CHEAT))) { + delete m_conVarDefaultRef; + m_conVarDefaultRef = NULL; + } } else {