Engine: use CThreadMutex for installed maps global

Use the type used by the engine instead of STD.
This commit is contained in:
Kawe Mazidjatari 2024-08-03 11:03:39 +02:00
parent 93eb3ab3a3
commit 1e667c8f30
5 changed files with 6 additions and 6 deletions

View File

@ -122,7 +122,7 @@ void Mod_GetAllInstalledMaps()
AddFilesToList(fileList, "vpk", "vpk", nullptr, '/'); AddFilesToList(fileList, "vpk", "vpk", nullptr, '/');
std::cmatch regexMatches; std::cmatch regexMatches;
std::lock_guard<std::mutex> l(g_InstalledMapsMutex); AUTO_LOCK(g_InstalledMapsMutex);
g_InstalledMaps.Purge(); // Clear current list. g_InstalledMaps.Purge(); // Clear current list.

View File

@ -129,7 +129,7 @@ inline bool* g_pPakPrecacheJobFinished;
inline void(*Mod_UnloadPendingAndPrecacheRequestedPaks)(void); inline void(*Mod_UnloadPendingAndPrecacheRequestedPaks)(void);
extern CUtlVector<CUtlString> g_InstalledMaps; extern CUtlVector<CUtlString> g_InstalledMaps;
extern std::mutex g_InstalledMapsMutex; extern CThreadMutex g_InstalledMapsMutex;
bool Mod_LevelHasChanged(const char* pszLevelName); bool Mod_LevelHasChanged(const char* pszLevelName);
void Mod_GetAllInstalledMaps(); void Mod_GetAllInstalledMaps();

View File

@ -36,7 +36,7 @@ namespace VScriptCode
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
SQRESULT GetAvailableMaps(HSQUIRRELVM v) SQRESULT GetAvailableMaps(HSQUIRRELVM v)
{ {
std::lock_guard<std::mutex> l(g_InstalledMapsMutex); AUTO_LOCK(g_InstalledMapsMutex);
if (g_InstalledMaps.IsEmpty()) if (g_InstalledMaps.IsEmpty())
SCRIPT_CHECK_AND_RETURN(v, SQ_OK); SCRIPT_CHECK_AND_RETURN(v, SQ_OK);

View File

@ -545,7 +545,7 @@ void CBrowser::DrawHostPanel(void)
if (ImGui::BeginCombo("Map", details.map.c_str())) if (ImGui::BeginCombo("Map", details.map.c_str()))
{ {
g_InstalledMapsMutex.lock(); g_InstalledMapsMutex.Lock();
FOR_EACH_VEC(g_InstalledMaps, i) FOR_EACH_VEC(g_InstalledMaps, i)
{ {
@ -558,7 +558,7 @@ void CBrowser::DrawHostPanel(void)
} }
} }
g_InstalledMapsMutex.unlock(); g_InstalledMapsMutex.Unlock();
ImGui::EndCombo(); ImGui::EndCombo();
} }

View File

@ -19,4 +19,4 @@ void VKeyValues::Detour(const bool bAttach) const
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
std::mutex g_InstalledMapsMutex; CThreadMutex g_InstalledMapsMutex;