Fixed a path not using updated mapcycle file detection (bug 5719).
This commit is contained in:
parent
8b26ce73c2
commit
696f702204
@ -80,6 +80,47 @@ public:
|
|||||||
{
|
{
|
||||||
DumpCache(NULL);
|
DumpCache(NULL);
|
||||||
}
|
}
|
||||||
|
void GetMapCycleFilePath(char *pBuffer, int maxlen)
|
||||||
|
{
|
||||||
|
const char *pEngineName = smcore.GetSourceEngineName();
|
||||||
|
const char *pMapCycleFileName = m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt";
|
||||||
|
|
||||||
|
if (strcmp(pEngineName, "tf2") == 0 || strcmp(pEngineName, "css") == 0
|
||||||
|
|| strcmp(pEngineName, "dods") == 0 || strcmp(pEngineName, "hl2dm") == 0)
|
||||||
|
{
|
||||||
|
// These four games and Source SDK 2013 do a lookup in this order; so shall we.
|
||||||
|
g_pSM->BuildPath(Path_Game,
|
||||||
|
pBuffer,
|
||||||
|
maxlen,
|
||||||
|
"cfg/%s",
|
||||||
|
pMapCycleFileName);
|
||||||
|
|
||||||
|
if (!libsys->PathExists(pBuffer))
|
||||||
|
{
|
||||||
|
g_pSM->BuildPath(Path_Game,
|
||||||
|
pBuffer,
|
||||||
|
maxlen,
|
||||||
|
"%s",
|
||||||
|
pMapCycleFileName);
|
||||||
|
|
||||||
|
if (!libsys->PathExists(pBuffer))
|
||||||
|
{
|
||||||
|
g_pSM->BuildPath(Path_Game,
|
||||||
|
pBuffer,
|
||||||
|
maxlen,
|
||||||
|
"cfg/mapcycle_default.txt");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_pSM->BuildPath(Path_Game,
|
||||||
|
pBuffer,
|
||||||
|
maxlen,
|
||||||
|
"%s",
|
||||||
|
pMapCycleFileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
void AddOrUpdateDefault(const char *name, const char *file)
|
void AddOrUpdateDefault(const char *name, const char *file)
|
||||||
{
|
{
|
||||||
char path[PLATFORM_MAX_PATH];
|
char path[PLATFORM_MAX_PATH];
|
||||||
@ -127,8 +168,6 @@ public:
|
|||||||
SMCError error;
|
SMCError error;
|
||||||
time_t fileTime;
|
time_t fileTime;
|
||||||
SMCStates states = {0, 0};
|
SMCStates states = {0, 0};
|
||||||
const char *pMapCycleFileName;
|
|
||||||
const char *pEngineName;
|
|
||||||
|
|
||||||
fileFound = libsys->FileTime(m_ConfigFile, FileTime_LastChange, &fileTime);
|
fileFound = libsys->FileTime(m_ConfigFile, FileTime_LastChange, &fileTime);
|
||||||
|
|
||||||
@ -159,45 +198,7 @@ public:
|
|||||||
pDefList->bIsPath = true;
|
pDefList->bIsPath = true;
|
||||||
smcore.strncopy(pDefList->name, "mapcyclefile", sizeof(pDefList->name));
|
smcore.strncopy(pDefList->name, "mapcyclefile", sizeof(pDefList->name));
|
||||||
|
|
||||||
pMapCycleFileName = m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt";
|
GetMapCycleFilePath(pDefList->path, sizeof(pDefList->path));
|
||||||
|
|
||||||
pEngineName = smcore.GetSourceEngineName();
|
|
||||||
|
|
||||||
if (strcmp(pEngineName, "tf2") == 0 || strcmp(pEngineName, "css") == 0
|
|
||||||
|| strcmp(pEngineName, "dods") == 0 || strcmp(pEngineName, "hl2dm") == 0)
|
|
||||||
{
|
|
||||||
// These four games and Source SDK 2013 do a lookup in this order; so shall we.
|
|
||||||
g_pSM->BuildPath(Path_Game,
|
|
||||||
pDefList->path,
|
|
||||||
sizeof(pDefList->path),
|
|
||||||
"cfg/%s",
|
|
||||||
pMapCycleFileName);
|
|
||||||
|
|
||||||
if (!libsys->PathExists(pDefList->path))
|
|
||||||
{
|
|
||||||
g_pSM->BuildPath(Path_Game,
|
|
||||||
pDefList->path,
|
|
||||||
sizeof(pDefList->path),
|
|
||||||
"%s",
|
|
||||||
pMapCycleFileName);
|
|
||||||
|
|
||||||
if (!libsys->PathExists(pDefList->path))
|
|
||||||
{
|
|
||||||
g_pSM->BuildPath(Path_Game,
|
|
||||||
pDefList->path,
|
|
||||||
sizeof(pDefList->path),
|
|
||||||
"cfg/mapcycle_default.txt");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_pSM->BuildPath(Path_Game,
|
|
||||||
pDefList->path,
|
|
||||||
sizeof(pDefList->path),
|
|
||||||
"%s",
|
|
||||||
pMapCycleFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
pDefList->last_modified_time = 0;
|
pDefList->last_modified_time = 0;
|
||||||
pDefList->pArray = NULL;
|
pDefList->pArray = NULL;
|
||||||
@ -513,11 +514,7 @@ private:
|
|||||||
if (m_pMapCycleFile != NULL && strcmp(name, "mapcyclefile") == 0)
|
if (m_pMapCycleFile != NULL && strcmp(name, "mapcyclefile") == 0)
|
||||||
{
|
{
|
||||||
char path[PLATFORM_MAX_PATH];
|
char path[PLATFORM_MAX_PATH];
|
||||||
g_pSM->BuildPath(Path_Game,
|
GetMapCycleFilePath(path, sizeof(path));
|
||||||
path,
|
|
||||||
sizeof(path),
|
|
||||||
"%s",
|
|
||||||
m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt");
|
|
||||||
|
|
||||||
if (strcmp(path, pMapList->path) != 0)
|
if (strcmp(path, pMapList->path) != 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user