From 29616f481006cdeee2083b84dea3c38a7df8deba Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Fri, 31 Mar 2023 00:35:01 +0200 Subject: [PATCH] Rename 'g_vAllMaps' to 'g_InstalledMaps' --- r5dev/engine/cmodel_bsp.cpp | 14 +++++++------- r5dev/engine/cmodel_bsp.h | 2 +- r5dev/gameui/IBrowser.cpp | 6 +++--- r5dev/squirrel/sqinit.cpp | 6 +++--- r5dev/vpc/keyvalues.h | 2 +- r5dev/vstdlib/completion.cpp | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/r5dev/engine/cmodel_bsp.cpp b/r5dev/engine/cmodel_bsp.cpp index 4478d61e..b13a2d81 100644 --- a/r5dev/engine/cmodel_bsp.cpp +++ b/r5dev/engine/cmodel_bsp.cpp @@ -20,7 +20,7 @@ #include "client/clientstate.h" #endif // !DEDICATED -vector g_vAllMaps; +vector g_InstalledMaps; string s_svLevelName; bool s_bLevelResourceInitialized = false; bool s_bBasePaksInitialized = false; @@ -41,8 +41,8 @@ bool Mod_LevelHasChanged(const char* pszLevelName) //----------------------------------------------------------------------------- void Mod_GetAllInstalledMaps() { - std::lock_guard l(g_MapVecMutex); - g_vAllMaps.clear(); // Clear current list. + std::lock_guard l(g_InstalledMapsMutex); + g_InstalledMaps.clear(); // Clear current list. fs::directory_iterator fsDir("vpk"); std::regex rgArchiveRegex{ R"([^_]*_(.*)(.bsp.pak000_dir).*)" }; @@ -60,13 +60,13 @@ void Mod_GetAllInstalledMaps() else if (smRegexMatches[1].str().compare("mp_common") == 0) { - if (std::find(g_vAllMaps.begin(), g_vAllMaps.end(), "mp_lobby") == g_vAllMaps.end()) - g_vAllMaps.push_back("mp_lobby"); + if (std::find(g_InstalledMaps.begin(), g_InstalledMaps.end(), "mp_lobby") == g_InstalledMaps.end()) + g_InstalledMaps.push_back("mp_lobby"); continue; // Common contains mp_lobby. } - if (std::find(g_vAllMaps.begin(), g_vAllMaps.end(), smRegexMatches[1].str()) == g_vAllMaps.end()) - g_vAllMaps.push_back(smRegexMatches[1].str()); + if (std::find(g_InstalledMaps.begin(), g_InstalledMaps.end(), smRegexMatches[1].str()) == g_InstalledMaps.end()) + g_InstalledMaps.push_back(smRegexMatches[1].str()); } } } diff --git a/r5dev/engine/cmodel_bsp.h b/r5dev/engine/cmodel_bsp.h index f978cd25..38852580 100644 --- a/r5dev/engine/cmodel_bsp.h +++ b/r5dev/engine/cmodel_bsp.h @@ -27,7 +27,7 @@ inline auto sub_14045A1D0 = p_Mod_ProcessPakQueue.RCast<__int64(*)(unsigned __in inline auto sub_140441220 = p_Mod_ProcessPakQueue.RCast(); extern bool s_bBasePaksInitialized; -extern vector g_vAllMaps; +extern vector g_InstalledMaps; bool Mod_LevelHasChanged(const char* pszLevelName); void Mod_GetAllInstalledMaps(); diff --git a/r5dev/gameui/IBrowser.cpp b/r5dev/gameui/IBrowser.cpp index 63eed7e4..00ecead9 100644 --- a/r5dev/gameui/IBrowser.cpp +++ b/r5dev/gameui/IBrowser.cpp @@ -503,8 +503,8 @@ void CBrowser::HostPanel(void) if (ImGui::BeginCombo("Map", g_pServerListManager->m_Server.m_svHostMap.c_str())) { - g_MapVecMutex.lock(); - for (const string& svMap : g_vAllMaps) + g_InstalledMapsMutex.lock(); + for (const string& svMap : g_InstalledMaps) { if (ImGui::Selectable(svMap.c_str(), svMap == g_pServerListManager->m_Server.m_svHostMap)) { @@ -512,7 +512,7 @@ void CBrowser::HostPanel(void) } } - g_MapVecMutex.unlock(); + g_InstalledMapsMutex.unlock(); ImGui::EndCombo(); } diff --git a/r5dev/squirrel/sqinit.cpp b/r5dev/squirrel/sqinit.cpp index f2a5200c..2c0e9327 100644 --- a/r5dev/squirrel/sqinit.cpp +++ b/r5dev/squirrel/sqinit.cpp @@ -56,13 +56,13 @@ namespace VSquirrel //----------------------------------------------------------------------------- SQRESULT GetAvailableMaps(HSQUIRRELVM v) { - std::lock_guard l(g_MapVecMutex); + std::lock_guard l(g_InstalledMapsMutex); - if (g_vAllMaps.empty()) + if (g_InstalledMaps.empty()) return SQ_OK; sq_newarray(v, 0); - for (const string& it : g_vAllMaps) + for (const string& it : g_InstalledMaps) { sq_pushstring(v, it.c_str(), -1); sq_arrayappend(v, -2); diff --git a/r5dev/vpc/keyvalues.h b/r5dev/vpc/keyvalues.h index 06f8e138..2f667dae 100644 --- a/r5dev/vpc/keyvalues.h +++ b/r5dev/vpc/keyvalues.h @@ -9,7 +9,7 @@ extern vector g_vAllPlaylists; extern vector g_vGameInfoPaths; -inline std::mutex g_MapVecMutex; +inline std::mutex g_InstalledMapsMutex; inline std::mutex g_PlaylistsVecMutex; //--------------------------------------------------------------------------------- diff --git a/r5dev/vstdlib/completion.cpp b/r5dev/vstdlib/completion.cpp index 3d6ec49a..e12e9037 100644 --- a/r5dev/vstdlib/completion.cpp +++ b/r5dev/vstdlib/completion.cpp @@ -27,7 +27,7 @@ int _Host_Map_f_CompletionFunc(char const* cmdname, char const* partial, char co substring = (char*)partial + strlen(cmdname); } - const int mapcount = (int)g_vAllMaps.size(); + const int mapcount = (int)g_InstalledMaps.size(); const int longest = COMMAND_COMPLETION_ITEM_LENGTH; const int count = MIN(mapcount, COMMAND_COMPLETION_MAXITEMS); @@ -35,7 +35,7 @@ int _Host_Map_f_CompletionFunc(char const* cmdname, char const* partial, char co { for (int i = 0; i < count; i++) { - strncpy(commands[i], g_vAllMaps[i].c_str(), longest); + strncpy(commands[i], g_InstalledMaps[i].c_str(), longest); char old[COMMAND_COMPLETION_ITEM_LENGTH]; strncpy(old, commands[i], sizeof(old));