mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Rename 'g_vAllMaps' to 'g_InstalledMaps'
This commit is contained in:
parent
1a361d9961
commit
29616f4810
@ -20,7 +20,7 @@
|
|||||||
#include "client/clientstate.h"
|
#include "client/clientstate.h"
|
||||||
#endif // !DEDICATED
|
#endif // !DEDICATED
|
||||||
|
|
||||||
vector<string> g_vAllMaps;
|
vector<string> g_InstalledMaps;
|
||||||
string s_svLevelName;
|
string s_svLevelName;
|
||||||
bool s_bLevelResourceInitialized = false;
|
bool s_bLevelResourceInitialized = false;
|
||||||
bool s_bBasePaksInitialized = false;
|
bool s_bBasePaksInitialized = false;
|
||||||
@ -41,8 +41,8 @@ bool Mod_LevelHasChanged(const char* pszLevelName)
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void Mod_GetAllInstalledMaps()
|
void Mod_GetAllInstalledMaps()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> l(g_MapVecMutex);
|
std::lock_guard<std::mutex> l(g_InstalledMapsMutex);
|
||||||
g_vAllMaps.clear(); // Clear current list.
|
g_InstalledMaps.clear(); // Clear current list.
|
||||||
|
|
||||||
fs::directory_iterator fsDir("vpk");
|
fs::directory_iterator fsDir("vpk");
|
||||||
std::regex rgArchiveRegex{ R"([^_]*_(.*)(.bsp.pak000_dir).*)" };
|
std::regex rgArchiveRegex{ R"([^_]*_(.*)(.bsp.pak000_dir).*)" };
|
||||||
@ -60,13 +60,13 @@ void Mod_GetAllInstalledMaps()
|
|||||||
|
|
||||||
else if (smRegexMatches[1].str().compare("mp_common") == 0)
|
else if (smRegexMatches[1].str().compare("mp_common") == 0)
|
||||||
{
|
{
|
||||||
if (std::find(g_vAllMaps.begin(), g_vAllMaps.end(), "mp_lobby") == g_vAllMaps.end())
|
if (std::find(g_InstalledMaps.begin(), g_InstalledMaps.end(), "mp_lobby") == g_InstalledMaps.end())
|
||||||
g_vAllMaps.push_back("mp_lobby");
|
g_InstalledMaps.push_back("mp_lobby");
|
||||||
continue; // Common contains mp_lobby.
|
continue; // Common contains mp_lobby.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::find(g_vAllMaps.begin(), g_vAllMaps.end(), smRegexMatches[1].str()) == g_vAllMaps.end())
|
if (std::find(g_InstalledMaps.begin(), g_InstalledMaps.end(), smRegexMatches[1].str()) == g_InstalledMaps.end())
|
||||||
g_vAllMaps.push_back(smRegexMatches[1].str());
|
g_InstalledMaps.push_back(smRegexMatches[1].str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ inline auto sub_14045A1D0 = p_Mod_ProcessPakQueue.RCast<__int64(*)(unsigned __in
|
|||||||
inline auto sub_140441220 = p_Mod_ProcessPakQueue.RCast<void(*)(__int64 a1, __int64 a2)>();
|
inline auto sub_140441220 = p_Mod_ProcessPakQueue.RCast<void(*)(__int64 a1, __int64 a2)>();
|
||||||
|
|
||||||
extern bool s_bBasePaksInitialized;
|
extern bool s_bBasePaksInitialized;
|
||||||
extern vector<string> g_vAllMaps;
|
extern vector<string> g_InstalledMaps;
|
||||||
|
|
||||||
bool Mod_LevelHasChanged(const char* pszLevelName);
|
bool Mod_LevelHasChanged(const char* pszLevelName);
|
||||||
void Mod_GetAllInstalledMaps();
|
void Mod_GetAllInstalledMaps();
|
||||||
|
@ -503,8 +503,8 @@ void CBrowser::HostPanel(void)
|
|||||||
|
|
||||||
if (ImGui::BeginCombo("Map", g_pServerListManager->m_Server.m_svHostMap.c_str()))
|
if (ImGui::BeginCombo("Map", g_pServerListManager->m_Server.m_svHostMap.c_str()))
|
||||||
{
|
{
|
||||||
g_MapVecMutex.lock();
|
g_InstalledMapsMutex.lock();
|
||||||
for (const string& svMap : g_vAllMaps)
|
for (const string& svMap : g_InstalledMaps)
|
||||||
{
|
{
|
||||||
if (ImGui::Selectable(svMap.c_str(), svMap == g_pServerListManager->m_Server.m_svHostMap))
|
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();
|
ImGui::EndCombo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,13 +56,13 @@ namespace VSquirrel
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
SQRESULT GetAvailableMaps(HSQUIRRELVM v)
|
SQRESULT GetAvailableMaps(HSQUIRRELVM v)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> l(g_MapVecMutex);
|
std::lock_guard<std::mutex> l(g_InstalledMapsMutex);
|
||||||
|
|
||||||
if (g_vAllMaps.empty())
|
if (g_InstalledMaps.empty())
|
||||||
return SQ_OK;
|
return SQ_OK;
|
||||||
|
|
||||||
sq_newarray(v, 0);
|
sq_newarray(v, 0);
|
||||||
for (const string& it : g_vAllMaps)
|
for (const string& it : g_InstalledMaps)
|
||||||
{
|
{
|
||||||
sq_pushstring(v, it.c_str(), -1);
|
sq_pushstring(v, it.c_str(), -1);
|
||||||
sq_arrayappend(v, -2);
|
sq_arrayappend(v, -2);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
extern vector<string> g_vAllPlaylists;
|
extern vector<string> g_vAllPlaylists;
|
||||||
extern vector<string> g_vGameInfoPaths;
|
extern vector<string> g_vGameInfoPaths;
|
||||||
|
|
||||||
inline std::mutex g_MapVecMutex;
|
inline std::mutex g_InstalledMapsMutex;
|
||||||
inline std::mutex g_PlaylistsVecMutex;
|
inline std::mutex g_PlaylistsVecMutex;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
|
@ -27,7 +27,7 @@ int _Host_Map_f_CompletionFunc(char const* cmdname, char const* partial, char co
|
|||||||
substring = (char*)partial + strlen(cmdname);
|
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 longest = COMMAND_COMPLETION_ITEM_LENGTH;
|
||||||
const int count = MIN(mapcount, COMMAND_COMPLETION_MAXITEMS);
|
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++)
|
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];
|
char old[COMMAND_COMPLETION_ITEM_LENGTH];
|
||||||
strncpy(old, commands[i], sizeof(old));
|
strncpy(old, commands[i], sizeof(old));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user