Tier1: track convar value changes in ConVar::InternalSetValue too

Add the tracker call here too to allow for debugging changes and catching bugs. Remaned the function from TrackDefaultValue to TrackValueChange as its no longer exclusive to the create method.
This commit is contained in:
Kawe Mazidjatari 2025-01-24 02:14:20 +01:00
parent bf7f128acf
commit 726b5c9fbc
2 changed files with 6 additions and 2 deletions

View File

@ -244,7 +244,7 @@ private:
virtual void InternalSetColorValue(Color value);
// DoNothing in the engine, probably for tracking/debugging cvar strings in debug.
virtual void TrackDefaultValue(const char* value) { };
virtual void TrackValueChange(const char* value) { };
virtual bool ClampValue(float& flValue);

View File

@ -680,6 +680,10 @@ void ConVar::InternalSetValue(const char* value)
m_Value.m_nValue = (int)(m_Value.m_fValue);
}
// Note(amos): send the value that can potentially be null,
// since we want to track those too
TrackValueChange(value);
if (!(m_nFlags & FCVAR_NEVER_AS_STRING))
{
ChangeStringValue(newVal);
@ -1020,7 +1024,7 @@ void ConVar::Create(const char* pName, const char* pDefaultValue, int flags /*=
}
TrackDefaultValue(m_Value.m_pszString);
TrackValueChange(m_Value.m_pszString);
// Only 1 of the 2 can be set on a ConVar, both means there is a bug in
// your code, fix it!