From 4d9f64176b56aa08dfd883f743f6e65d68a2f6f9 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Sat, 22 Oct 2022 23:09:56 +0100 Subject: fix typo in ConVar::SetValue( const char* ) (#296) * fix typo in ConVar::SetValue( const char* ) (except this time dont fuck up on git!!) * readd delete --- NorthstarDLL/convar.cpp | 11 +---------- NorthstarDLL/misccommands.cpp | 11 ++++------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/NorthstarDLL/convar.cpp b/NorthstarDLL/convar.cpp index c8f63922..80f93c64 100644 --- a/NorthstarDLL/convar.cpp +++ b/NorthstarDLL/convar.cpp @@ -299,10 +299,7 @@ void ConVar::SetValue(float flValue) void ConVar::SetValue(const char* pszValue) { if (strcmp(this->m_Value.m_pszString, pszValue) == 0) - { return; - } - this->m_Value.m_pszString = pszValue; char szTempValue[32] {}; const char* pszNewValue {}; @@ -382,13 +379,7 @@ void ConVar::ChangeStringValue(const char* pszTempVal, float flOldValue) if (len > m_Value.m_iStringLength) { if (m_Value.m_pszString) - { - // !TODO: Causes issues in tier0.dll, but doesn't in apex. - // Not a big issue since we are creating a new string below - // anyways to prevent buffer overflow if string is longer - // then the old string. - // delete[] m_Value.m_pszString; - } + delete[] m_Value.m_pszString; m_Value.m_pszString = new char[len]; m_Value.m_iStringLength = len; diff --git a/NorthstarDLL/misccommands.cpp b/NorthstarDLL/misccommands.cpp index 06cf1f41..c0100785 100644 --- a/NorthstarDLL/misccommands.cpp +++ b/NorthstarDLL/misccommands.cpp @@ -279,9 +279,9 @@ void FixupCvarFlags() {"_playerSettings_reparse_Server", FCVAR_DEVELOPMENTONLY}, }; - const std::vector> CVAR_FIXUP_DEFAULT_VALUES = { - {"sv_stressbots", 0}, // not currently used but this is probably a bad default if we get bots working - {"cl_pred_optimize", 0} // fixes issues with animation prediction in thirdperson + const std::vector> CVAR_FIXUP_DEFAULT_VALUES = { + {"sv_stressbots", "0"}, // not currently used but this is probably a bad default if we get bots working + {"cl_pred_optimize", "0"} // fixes issues with animation prediction in thirdperson }; for (auto& fixup : CVAR_FIXUP_ADD_FLAGS) @@ -304,10 +304,7 @@ void FixupCvarFlags() if (cvar && !strcmp(cvar->GetString(), cvar->m_pszDefaultValue)) { cvar->SetValue(std::get<1>(fixup)); - - int nLen = strlen(cvar->GetString()); - cvar->m_pszDefaultValue = new char[nLen]; - memcpy((void*)cvar->m_pszDefaultValue, cvar->GetString(), nLen + 1); + cvar->m_pszDefaultValue = std::get<1>(fixup); } } } -- cgit v1.2.3