From 9d06a0261455b330ac2724057bb7b1ec3643f695 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Tue, 9 Aug 2022 02:35:00 +0200 Subject: [PATCH] General cleanup * Use Cbuf functions for executing commands in ImGui panels. * Use const qualifiers for all vftable indexes. --- r5dev/client/cdll_engine_int.h | 2 +- r5dev/engine/sys_engine.cpp | 10 +++---- r5dev/filesystem/filesystem.cpp | 8 +++--- r5dev/game/server/gameinterface.cpp | 10 +++---- r5dev/gameui/IBrowser.cpp | 15 ++++++---- r5dev/gameui/IConsole.cpp | 8 ++---- r5dev/inputsystem/inputsystem.cpp | 6 ++-- r5dev/public/include/idebugoverlay.h | 8 +++--- r5dev/rtech/rui/rui.h | 2 +- r5dev/squirrel/sqscript.cpp | 6 ++-- r5dev/squirrel/sqvm.cpp | 7 ++--- .../Source/DetourTileCacheBuilder.cpp | 2 +- r5dev/tier0/commandline.cpp | 28 +++++++++---------- r5dev/tier1/cvar.cpp | 12 ++++---- r5dev/vstdlib/keyvaluessystem.cpp | 18 ++++++------ 15 files changed, 71 insertions(+), 71 deletions(-) diff --git a/r5dev/client/cdll_engine_int.h b/r5dev/client/cdll_engine_int.h index 33a604ba..c103c2ba 100644 --- a/r5dev/client/cdll_engine_int.h +++ b/r5dev/client/cdll_engine_int.h @@ -37,7 +37,7 @@ public: void* /* CUserCmd* */ GetUserCmd(int sequenceNumber) // @0x1405BB020 in R5pc_r5launch_N1094_CL456479_2019_10_30_05_20_PM { - static int index = 28; + const int index = 28; return CallVFunc(index, this, sequenceNumber); /*48 83 EC 28 48 8B 05 ? ? ? ? 48 8D 0D ? ? ? ? 44 8B C2*/ } }; diff --git a/r5dev/engine/sys_engine.cpp b/r5dev/engine/sys_engine.cpp index 8a344154..2a714b92 100644 --- a/r5dev/engine/sys_engine.cpp +++ b/r5dev/engine/sys_engine.cpp @@ -10,7 +10,7 @@ CEngine* g_pEngine = nullptr; //----------------------------------------------------------------------------- bool CEngine::Load(bool dedicated, const char* rootDir) { - static int index = 1; + const int index = 1; return CallVFunc(index, this, dedicated, rootDir); } @@ -19,7 +19,7 @@ bool CEngine::Load(bool dedicated, const char* rootDir) //----------------------------------------------------------------------------- void CEngine::Unload(void) { - static int index = 2; + const int index = 2; CallVFunc(index, this); } @@ -44,7 +44,7 @@ EngineState_t CEngine::GetState(void) const //----------------------------------------------------------------------------- void CEngine::Frame(void) { - static int index = 5; + const int index = 5; CallVFunc(index, this); } @@ -61,7 +61,7 @@ float CEngine::GetFrameTime(void) const //----------------------------------------------------------------------------- float CEngine::GetPreviousTime(void) // I'm not sure if this is right, should double check. { - static int index = 7; + const int index = 7; return CallVFunc(index, this); } @@ -78,6 +78,6 @@ __m128 __fastcall CEngine::GetCurTime(CEngine *thisPtr) const //----------------------------------------------------------------------------- void CEngine::SetQuitting(EngineDllQuitting_t quitDllState) { - static int index = 9; + const int index = 9; CallVFunc(index, this, quitDllState); } diff --git a/r5dev/filesystem/filesystem.cpp b/r5dev/filesystem/filesystem.cpp index 9dbeaf13..926fa82f 100644 --- a/r5dev/filesystem/filesystem.cpp +++ b/r5dev/filesystem/filesystem.cpp @@ -18,7 +18,7 @@ CFileSystem_Stdio* FileSystem() //----------------------------------------------------------------------------- void IFileSystem::AddSearchPath(const char* pPath, const char* pPathID, SearchPathAdd_t addType) { - static int index = 12; + const int index = 12; CallVFunc(index, this, pPath, pPathID, addType); } @@ -31,7 +31,7 @@ void IFileSystem::AddSearchPath(const char* pPath, const char* pPathID, SearchPa //----------------------------------------------------------------------------- bool IFileSystem::RemoveSearchPath(const char* pPath, const char* pPathID) { - static int index = 13; + const int index = 13; return CallVFunc(index, this, pPath, pPathID); } @@ -43,7 +43,7 @@ bool IFileSystem::RemoveSearchPath(const char* pPath, const char* pPathID) //----------------------------------------------------------------------------- bool IFileSystem::ReadFromCache(const char* pPath, void* pResult) { - static int index = 76; + const int index = 76; return CallVFunc(index, this, pPath, pResult); } @@ -54,7 +54,7 @@ bool IFileSystem::ReadFromCache(const char* pPath, void* pResult) //----------------------------------------------------------------------------- VPKData_t* IFileSystem::MountVPK(const char* pPath) { - static int index = 92; + const int index = 92; return CallVFunc(index, this, pPath); } diff --git a/r5dev/game/server/gameinterface.cpp b/r5dev/game/server/gameinterface.cpp index af5d1e6d..9f280e77 100644 --- a/r5dev/game/server/gameinterface.cpp +++ b/r5dev/game/server/gameinterface.cpp @@ -14,7 +14,7 @@ //----------------------------------------------------------------------------- void CServerGameDLL::GameInit(void) { - static int index = 1; + const int index = 1; CallVFunc(index, this); } @@ -23,7 +23,7 @@ void CServerGameDLL::GameInit(void) //----------------------------------------------------------------------------- void CServerGameDLL::PrecompileScriptsJob(void) { - static int index = 2; + const int index = 2; CallVFunc(index, this); } @@ -32,7 +32,7 @@ void CServerGameDLL::PrecompileScriptsJob(void) //----------------------------------------------------------------------------- void CServerGameDLL::LevelShutdown(void) { - static int index = 8; + const int index = 8; CallVFunc(index, this); } @@ -42,7 +42,7 @@ void CServerGameDLL::LevelShutdown(void) //----------------------------------------------------------------------------- void CServerGameDLL::GameShutdown(void) { - static int index = 9; + const int index = 9; CallVFunc(index, this); } @@ -52,7 +52,7 @@ void CServerGameDLL::GameShutdown(void) //----------------------------------------------------------------------------- float CServerGameDLL::GetTickInterval(void) { - static int index = 11; + const int index = 11; return CallVFunc(index, this); } diff --git a/r5dev/gameui/IBrowser.cpp b/r5dev/gameui/IBrowser.cpp index c8aabf4d..7f9a84bb 100644 --- a/r5dev/gameui/IBrowser.cpp +++ b/r5dev/gameui/IBrowser.cpp @@ -300,6 +300,9 @@ void CBrowser::GetServerList(void) //----------------------------------------------------------------------------- // Purpose: connects to specified server +// Input : &svIp - +// &svPort - +// &svNetKey - //----------------------------------------------------------------------------- void CBrowser::ConnectToServer(const string& svIp, const string& svPort, const string& svNetKey) { @@ -315,6 +318,8 @@ void CBrowser::ConnectToServer(const string& svIp, const string& svPort, const s //----------------------------------------------------------------------------- // Purpose: connects to specified server +// Input : &svServer - +// &svNetKey - //----------------------------------------------------------------------------- void CBrowser::ConnectToServer(const string& svServer, const string& svNetKey) { @@ -675,14 +680,13 @@ void CBrowser::SendHostingPostRequest(void) //----------------------------------------------------------------------------- // Purpose: executes submitted commands in a separate thread +// Input : *pszCommand - //----------------------------------------------------------------------------- void CBrowser::ProcessCommand(const char* pszCommand) { - std::thread t(CEngineClient_CommandExecute, this, pszCommand); - t.detach(); // Detach from render thread. - - // This is to avoid a race condition. - std::this_thread::sleep_for(std::chrono::milliseconds(1)); + Cbuf_AddText(Cbuf_GetCurrentPlayer(), pszCommand, cmd_source_t::kCommandSrcCode); + std::thread t(Cbuf_Execute); + t.detach(); // Detatch from render thread. } //----------------------------------------------------------------------------- @@ -717,6 +721,7 @@ void CBrowser::RegenerateEncryptionKey(void) const //----------------------------------------------------------------------------- // Purpose: changes encryption key to specified one +// Input : &svNetKey - //----------------------------------------------------------------------------- void CBrowser::ChangeEncryptionKey(const string& svNetKey) const { diff --git a/r5dev/gameui/IConsole.cpp b/r5dev/gameui/IConsole.cpp index 74e31820..1fcd40fc 100644 --- a/r5dev/gameui/IConsole.cpp +++ b/r5dev/gameui/IConsole.cpp @@ -530,11 +530,9 @@ void CConsole::ProcessCommand(const char* pszCommand) { DevMsg(eDLL_T::COMMON, "] %s\n", pszCommand); - std::thread t(CEngineClient_CommandExecute, this, pszCommand); - t.detach(); // Detach from render thread. - - // This is to avoid a race condition. - std::this_thread::sleep_for(std::chrono::milliseconds(1)); + Cbuf_AddText(Cbuf_GetCurrentPlayer(), pszCommand, cmd_source_t::kCommandSrcCode); + std::thread t(Cbuf_Execute); + t.detach(); // Detatch from render thread. m_nHistoryPos = -1; for (ssize_t i = static_cast(m_vHistory.size()) - 1; i >= 0; i--) diff --git a/r5dev/inputsystem/inputsystem.cpp b/r5dev/inputsystem/inputsystem.cpp index 098bdf12..a80117c1 100644 --- a/r5dev/inputsystem/inputsystem.cpp +++ b/r5dev/inputsystem/inputsystem.cpp @@ -13,7 +13,7 @@ //----------------------------------------------------------------------------- void CInputSystem::EnableInput(bool bEnabled) { - static int index = 10; + const int index = 10; CallVFunc(index, this, bEnabled); } @@ -22,7 +22,7 @@ void CInputSystem::EnableInput(bool bEnabled) //----------------------------------------------------------------------------- void CInputSystem::EnableMessagePump(bool bEnabled) { - static int index = 11; + const int index = 11; CallVFunc(index, this, bEnabled); } @@ -31,7 +31,7 @@ void CInputSystem::EnableMessagePump(bool bEnabled) //----------------------------------------------------------------------------- bool CInputSystem::IsButtonDown(ButtonCode_t Button) { - static int index = 13; + const int index = 13; return CallVFunc(index, this, Button); } diff --git a/r5dev/public/include/idebugoverlay.h b/r5dev/public/include/idebugoverlay.h index f18f78da..2b4c2aed 100644 --- a/r5dev/public/include/idebugoverlay.h +++ b/r5dev/public/include/idebugoverlay.h @@ -19,22 +19,22 @@ class CIVDebugOverlay : public IVDebugOverlay public: void AddBoxOverlay(__m128i& vTransforms, const Vector3D& vMins, const Vector3D& vMaxs, int r, int g, int b, int a, bool bZBuffer, float flDuration) { - static int index = 1; + const int index = 1; CallVFunc(index, this, vTransforms, vMins, vMaxs, r, g, b, a, bZBuffer, flDuration); } void AddSphereOverlay(const Vector3D& vOrigin, float flRadius, int nTheta, int nPhi, int r, int g, int b, int a, float flDuration) { - static int index = 3; + const int index = 3; CallVFunc(index, this, vOrigin, flRadius, nTheta, nPhi, r, g, b, a, flDuration); } void AddLineOverlay(const Vector3D& vStart, const Vector3D& vEnd, int r, int g, int b, char bZBuffer, float flDuration) { - static int index = 5; + const int index = 5; CallVFunc(index, this, vStart, vEnd, r, g, b, bZBuffer, flDuration); } void AddCapsuleOverlay(const Vector3D& vStart, const Vector3D& vEnd, const Vector3D& vRadius, const Vector3D& vTop, const Vector3D& vBottom, int r, int g, int b, int a, float flDuration) { - static int index = 12; + const int index = 12; CallVFunc(index, this, vStart, vEnd, vRadius, vTop, vBottom, r, g, b, a, flDuration); } }; diff --git a/r5dev/rtech/rui/rui.h b/r5dev/rtech/rui/rui.h index 9af09047..0a90d96a 100644 --- a/r5dev/rtech/rui/rui.h +++ b/r5dev/rtech/rui/rui.h @@ -31,7 +31,7 @@ class VRui : public IDetour p_Rui_LoadAsset = g_mGameDll.FindPatternSIMD(reinterpret_cast("\xE8\x00\x00\x00\x00\xEB\x03\x49\x8B\xC6\x48\x89\x86\x00\x00\x00\x00\x8B\x86\x00\x00\x00\x00"), "x????xxxxxxxx????xx????").FollowNearCallSelf(); v_Rui_LoadAsset = p_Rui_LoadAsset.RCast(); /*E8 ?? ?? ?? ?? EB 03 49 8B C6 48 89 86 ?? ?? ?? ?? 8B 86 ?? ?? ?? ??*/ - p_Rui_GetFontFace = g_mGameDll.FindPatternSIMD(reinterpret_cast("\xF7\x05\x00\x00\x00\x00\x00\x00\x00\x00\x4C\x8D\x0D\x00\x00\x00\x00\x74\x05\x49\x8B\xD1\xEB\x19\x48\x8B\x05\x00\x00\x00\x00\x48\x8D\x15\x00\x00\x00\x00\x48\x8B\x48\x58\x48\x85\xC9\x48\x0F\x45\xD1\xF7\x05\x00\x00\x00\x00\x00\x00\x00\x00\x75\x19\x48\x8B\x05\x00\x00\x00\x00\x4C\x8D\x0D\x00\x00\x00\x00\x4C\x8B\x40\x58\x4D\x85\xC0\x4D\x0F\x45\xC8\x49\x8B\xC9\x48\xFF\x25\x00\x00\x00\x00"), "xx????????xxx????xxxxxxxxxx????xxx????xxxxxxxxxxxxx????????xxxxx????xxx????xxxxxxxxxxxxxxxxx????");; + p_Rui_GetFontFace = g_mGameDll.FindPatternSIMD(reinterpret_cast("\xF7\x05\x00\x00\x00\x00\x00\x00\x00\x00\x4C\x8D\x0D\x00\x00\x00\x00\x74\x05\x49\x8B\xD1\xEB\x19\x48\x8B\x05\x00\x00\x00\x00\x48\x8D\x15\x00\x00\x00\x00\x48\x8B\x48\x58\x48\x85\xC9\x48\x0F\x45\xD1\xF7\x05\x00\x00\x00\x00\x00\x00\x00\x00\x75\x19\x48\x8B\x05\x00\x00\x00\x00\x4C\x8D\x0D\x00\x00\x00\x00\x4C\x8B\x40\x58\x4D\x85\xC0\x4D\x0F\x45\xC8\x49\x8B\xC9\x48\xFF\x25\x00\x00\x00\x00"), "xx????????xxx????xxxxxxxxxx????xxx????xxxxxxxxxxxxx????????xxxxx????xxx????xxxxxxxxxxxxxxxxx????"); v_Rui_GetFontFace = p_Rui_GetFontFace.RCast();/*F7 05 ? ? ? ? ? ? ? ? 4C 8D 0D ? ? ? ? 74 05 49 8B D1 EB 19 48 8B 05 ? ? ? ? 48 8D 15 ? ? ? ? 48 8B 48 58 48 85 C9 48 0F 45 D1 F7 05 ? ? ? ? ? ? ? ? 75 19 48 8B 05 ? ? ? ? 4C 8D 0D ? ? ? ? 4C 8B 40 58 4D 85 C0 4D 0F 45 C8 49 8B C9 48 FF 25 ? ? ? ?*/ } virtual void GetVar(void) const { } diff --git a/r5dev/squirrel/sqscript.cpp b/r5dev/squirrel/sqscript.cpp index 0255fbf4..d213c44a 100644 --- a/r5dev/squirrel/sqscript.cpp +++ b/r5dev/squirrel/sqscript.cpp @@ -246,15 +246,15 @@ SQBool Script_LoadScript(HSQUIRRELVM v, const SQChar* szScriptPath, const SQChar //--------------------------------------------------------------------------------- void Script_Execute(const SQChar* code, SQCONTEXT context) { - CSquirrelVM* scriptVM = Script_GetContextObject(context); + CSquirrelVM* script = Script_GetContextObject(context); - if (!scriptVM) + if (!script) { Error(eDLL_T::ENGINE, "Attempted to run %s script while VM isn't initialized\n", SQVM_GetContextName(context)); return; } - HSQUIRRELVM v = scriptVM->GetVM(); + HSQUIRRELVM v = script->GetVM(); if (!v) { Error(eDLL_T::ENGINE, "Attempted to run %s script while VM isn't initialized\n", SQVM_GetContextName(context)); diff --git a/r5dev/squirrel/sqvm.cpp b/r5dev/squirrel/sqvm.cpp index 370bd9cb..79ce099c 100644 --- a/r5dev/squirrel/sqvm.cpp +++ b/r5dev/squirrel/sqvm.cpp @@ -53,11 +53,8 @@ SQRESULT SQVM_PrintFunc(HSQUIRRELVM v, SQChar* fmt, ...) nResponseId = -4; break; default: -#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) && !defined (GAMEDLL_S2) + context = v->GetContext(); -#else // Nothing equal to 'rdx + 18h' exist in the vm structs for anything below S3. - context = SQVM_GetContextIndex(v); -#endif switch (context) { case SQCONTEXT::SERVER: @@ -154,7 +151,7 @@ SQRESULT SQVM_PrintFunc(HSQUIRRELVM v, SQChar* fmt, ...) } else { - vmStrAnsi = Plat_GetProcessUpTime();; + vmStrAnsi = Plat_GetProcessUpTime(); vmStrAnsi.append(SQVM_ANSI_LOG_T[static_cast(context)]); } vmStrAnsi.append(buf); diff --git a/r5dev/thirdparty/recast/DetourTileCache/Source/DetourTileCacheBuilder.cpp b/r5dev/thirdparty/recast/DetourTileCache/Source/DetourTileCacheBuilder.cpp index 7852bb35..62bd54ab 100644 --- a/r5dev/thirdparty/recast/DetourTileCache/Source/DetourTileCacheBuilder.cpp +++ b/r5dev/thirdparty/recast/DetourTileCache/Source/DetourTileCacheBuilder.cpp @@ -1955,7 +1955,7 @@ dtStatus dtMarkCylinderArea(dtTileCacheLayer& layer, const float* orig, const fl bmin[2] = pos[2]; bmax[0] = pos[0] + radius; bmax[1] = pos[1] + radius; - bmax[2] = pos[2] + height;; + bmax[2] = pos[2] + height; const float r2 = dtSqr(radius/cs + 0.5f); const int w = (int)layer.header->width; diff --git a/r5dev/tier0/commandline.cpp b/r5dev/tier0/commandline.cpp index 3cbef24f..93c02a5d 100644 --- a/r5dev/tier0/commandline.cpp +++ b/r5dev/tier0/commandline.cpp @@ -33,7 +33,7 @@ CCommandLine::~CCommandLine(void) //----------------------------------------------------------------------------- void CCommandLine::CreateCmdLine(const char* pszCommandline) { - static int index = 0; + const int index = 0; CallVFunc(index, this, pszCommandline); } @@ -42,7 +42,7 @@ void CCommandLine::CreateCmdLine(const char* pszCommandline) //----------------------------------------------------------------------------- void CCommandLine::CreateCmdLine(int argc, char** argv) { - static int index = 1; + const int index = 1; CallVFunc(index, this, argc, argv); } @@ -51,7 +51,7 @@ void CCommandLine::CreateCmdLine(int argc, char** argv) //----------------------------------------------------------------------------- void CCommandLine::CreatePool(void* pMem) { - static int index = 2; + const int index = 2; CallVFunc(index, this, pMem); } @@ -61,7 +61,7 @@ void CCommandLine::CreatePool(void* pMem) //----------------------------------------------------------------------------- const char* CCommandLine::GetCmdLine(void) { - static int index = 3; + const int index = 3; return CallVFunc(index, this); } @@ -73,7 +73,7 @@ const char* CCommandLine::GetCmdLine(void) //----------------------------------------------------------------------------- const char* CCommandLine::CheckParm(const char* psz, const char** ppszValue) { - static int index = 4; + const int index = 4; return CallVFunc(index, this, psz, ppszValue); } @@ -83,7 +83,7 @@ const char* CCommandLine::CheckParm(const char* psz, const char** ppszValue) //----------------------------------------------------------------------------- void CCommandLine::RemoveParm(const char* pszParm) { - static int index = 5; + const int index = 5; CallVFunc(index, this, pszParm); } @@ -94,7 +94,7 @@ void CCommandLine::RemoveParm(const char* pszParm) //----------------------------------------------------------------------------- void CCommandLine::AppendParm(const char* pszParm, const char* pszValues) { - static int index = 6; + const int index = 6; CallVFunc(index, this, pszParm, pszValues); } @@ -103,17 +103,17 @@ void CCommandLine::AppendParm(const char* pszParm, const char* pszValues) //----------------------------------------------------------------------------- float CCommandLine::ParmValue(const char* psz, float flDefaultVal) { - static int index = 7; + const int index = 7; return CallVFunc(index, this, psz, flDefaultVal); } int CCommandLine::ParmValue(const char* psz, int nDefaultVal) { - static int index = 8; + const int index = 8; return CallVFunc(index, this, psz, nDefaultVal); } const char* CCommandLine::ParmValue(const char* psz, const char* pDefaultVal) { - static int index = 9; + const int index = 9; return CallVFunc(index, this, psz, pDefaultVal); } @@ -122,25 +122,25 @@ const char* CCommandLine::ParmValue(const char* psz, const char* pDefaultVal) //----------------------------------------------------------------------------- int CCommandLine::ParmCount(void) { - static int index = 10; + const int index = 10; return CallVFunc(index, this); } int CCommandLine::FindParm(const char* psz) { - static int index = 11; + const int index = 11; return CallVFunc(index, this, psz); } const char* CCommandLine::GetParm(int nIndex) { - static int index = 12; + const int index = 12; return CallVFunc(index, this, nIndex); } void CCommandLine::SetParm(int nIndex, char const* pParm) { - static int index = 14; + const int index = 14; CallVFunc(index, this, nIndex, pParm); } diff --git a/r5dev/tier1/cvar.cpp b/r5dev/tier1/cvar.cpp index 9e718e68..f83d60b8 100644 --- a/r5dev/tier1/cvar.cpp +++ b/r5dev/tier1/cvar.cpp @@ -172,7 +172,7 @@ ConVar* rui_drawEnable = nullptr; //----------------------------------------------------------------------------- ConCommandBase* CCVar::RegisterConCommand(ConCommandBase* pCommandToRemove) { - static int index = 9; + const int index = 9; return CallVFunc(index, this, pCommandToRemove); } @@ -182,7 +182,7 @@ ConCommandBase* CCVar::RegisterConCommand(ConCommandBase* pCommandToRemove) //----------------------------------------------------------------------------- ConCommandBase* CCVar::UnregisterConCommand(ConCommandBase* pCommandToRemove) { - static int index = 10; + const int index = 10; return CallVFunc(index, this, pCommandToRemove); } @@ -192,7 +192,7 @@ ConCommandBase* CCVar::UnregisterConCommand(ConCommandBase* pCommandToRemove) //----------------------------------------------------------------------------- ConCommandBase* CCVar::FindCommandBase(const char* pszCommandName) { - static int index = 14; + const int index = 14; return CallVFunc(index, this, pszCommandName); } @@ -202,7 +202,7 @@ ConCommandBase* CCVar::FindCommandBase(const char* pszCommandName) //----------------------------------------------------------------------------- ConVar* CCVar::FindVar(const char* pszVarName) { - static int index = 16; + const int index = 16; return CallVFunc(index, this, pszVarName); } @@ -212,7 +212,7 @@ ConVar* CCVar::FindVar(const char* pszVarName) //----------------------------------------------------------------------------- ConCommand* CCVar::FindCommand(const char* pszCommandName) { - static int index = 18; + const int index = 18; return CallVFunc(index, this, pszCommandName); } @@ -254,7 +254,7 @@ void CCVar::QueueMaterialThreadSetValue(ConVar* pConVar, const char* pValue) //----------------------------------------------------------------------------- CCVarIteratorInternal* CCVar::FactoryInternalIterator(void) { - static int index = 41; + const int index = 41; return CallVFunc(index, this); } diff --git a/r5dev/vstdlib/keyvaluessystem.cpp b/r5dev/vstdlib/keyvaluessystem.cpp index 7a9213e5..cad5c89f 100644 --- a/r5dev/vstdlib/keyvaluessystem.cpp +++ b/r5dev/vstdlib/keyvaluessystem.cpp @@ -24,7 +24,7 @@ CKeyValuesSystem* KeyValuesSystem() //----------------------------------------------------------------------------- void CKeyValuesSystem::RegisterSizeofKeyValues(int64_t nSize) { - static int index = 0; + const int index = 0; CallVFunc(index, this, nSize); } @@ -35,7 +35,7 @@ void CKeyValuesSystem::RegisterSizeofKeyValues(int64_t nSize) //----------------------------------------------------------------------------- void* CKeyValuesSystem::AllocKeyValuesMemory(int64_t nSize) { - static int index = 1; + const int index = 1; return CallVFunc(index, this, nSize); } @@ -45,7 +45,7 @@ void* CKeyValuesSystem::AllocKeyValuesMemory(int64_t nSize) //----------------------------------------------------------------------------- void CKeyValuesSystem::FreeKeyValuesMemory(void* pMem) { - static int index = 2; + const int index = 2; CallVFunc(index, this, pMem); } @@ -57,7 +57,7 @@ void CKeyValuesSystem::FreeKeyValuesMemory(void* pMem) //----------------------------------------------------------------------------- HKeySymbol CKeyValuesSystem::GetSymbolForString(const char* szName, bool bCreate) { - static int index = 3; + const int index = 3; return CallVFunc(index, this, szName, bCreate); } @@ -68,7 +68,7 @@ HKeySymbol CKeyValuesSystem::GetSymbolForString(const char* szName, bool bCreate //----------------------------------------------------------------------------- const char* CKeyValuesSystem::GetStringForSymbol(HKeySymbol symbol) { - static int index = 4; + const int index = 4; return CallVFunc(index, this, symbol); } @@ -78,7 +78,7 @@ const char* CKeyValuesSystem::GetStringForSymbol(HKeySymbol symbol) //----------------------------------------------------------------------------- void* CKeyValuesSystem::GetMemPool(void) { - static int index = 7; + const int index = 7; return CallVFunc(index, this); } @@ -90,7 +90,7 @@ void* CKeyValuesSystem::GetMemPool(void) //----------------------------------------------------------------------------- void CKeyValuesSystem::SetKeyValuesExpressionSymbol(const char* szName, bool bValue) { - static int index = 8; + const int index = 8; CallVFunc(index, this, szName, bValue); } @@ -100,7 +100,7 @@ void CKeyValuesSystem::SetKeyValuesExpressionSymbol(const char* szName, bool bVa //----------------------------------------------------------------------------- bool CKeyValuesSystem::GetKeyValuesExpressionSymbol(const char* szName) { - static int index = 9; + const int index = 9; return CallVFunc(index, this, szName); } @@ -113,6 +113,6 @@ bool CKeyValuesSystem::GetKeyValuesExpressionSymbol(const char* szName) //----------------------------------------------------------------------------- HKeySymbol CKeyValuesSystem::GetSymbolForStringCaseSensitive(HKeySymbol& hCaseInsensitiveSymbol, const char* szName, bool bCreate) { - static int index = 10; + const int index = 10; return CallVFunc(index, this, hCaseInsensitiveSymbol, szName, bCreate); }