Fixed a path not using updated mapcycle file detection (bug 5719).
Fixed a path not using updated mapcycle file detection (
bug 5719).
1.1 --- a/core/logic/smn_maplists.cpp Mon Aug 05 08:36:25 2013 -0400
1.2 +++ b/core/logic/smn_maplists.cpp Mon Aug 05 11:36:59 2013 -0400
1.3 @@ -80,6 +80,47 @@
1.4 {
1.5 DumpCache(NULL);
1.6 }
1.7 + void GetMapCycleFilePath(char *pBuffer, int maxlen)
1.8 + {
1.9 + const char *pEngineName = smcore.GetSourceEngineName();
1.10 + const char *pMapCycleFileName = m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt";
1.11 +
1.12 + if (strcmp(pEngineName, "tf2") == 0 || strcmp(pEngineName, "css") == 0
1.13 + || strcmp(pEngineName, "dods") == 0 || strcmp(pEngineName, "hl2dm") == 0)
1.14 + {
1.15 + // These four games and Source SDK 2013 do a lookup in this order; so shall we.
1.16 + g_pSM->BuildPath(Path_Game,
1.17 + pBuffer,
1.18 + maxlen,
1.19 + "cfg/%s",
1.20 + pMapCycleFileName);
1.21 +
1.22 + if (!libsys->PathExists(pBuffer))
1.23 + {
1.24 + g_pSM->BuildPath(Path_Game,
1.25 + pBuffer,
1.26 + maxlen,
1.27 + "%s",
1.28 + pMapCycleFileName);
1.29 +
1.30 + if (!libsys->PathExists(pBuffer))
1.31 + {
1.32 + g_pSM->BuildPath(Path_Game,
1.33 + pBuffer,
1.34 + maxlen,
1.35 + "cfg/mapcycle_default.txt");
1.36 + }
1.37 + }
1.38 + }
1.39 + else
1.40 + {
1.41 + g_pSM->BuildPath(Path_Game,
1.42 + pBuffer,
1.43 + maxlen,
1.44 + "%s",
1.45 + pMapCycleFileName);
1.46 + }
1.47 + }
1.48 void AddOrUpdateDefault(const char *name, const char *file)
1.49 {
1.50 char path[PLATFORM_MAX_PATH];
1.51 @@ -127,8 +168,6 @@
1.52 SMCError error;
1.53 time_t fileTime;
1.54 SMCStates states = {0, 0};
1.55 - const char *pMapCycleFileName;
1.56 - const char *pEngineName;
1.57
1.58 fileFound = libsys->FileTime(m_ConfigFile, FileTime_LastChange, &fileTime);
1.59
1.60 @@ -159,45 +198,7 @@
1.61 pDefList->bIsPath = true;
1.62 smcore.strncopy(pDefList->name, "mapcyclefile", sizeof(pDefList->name));
1.63
1.64 - pMapCycleFileName = m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt";
1.65 -
1.66 - pEngineName = smcore.GetSourceEngineName();
1.67 -
1.68 - if (strcmp(pEngineName, "tf2") == 0 || strcmp(pEngineName, "css") == 0
1.69 - || strcmp(pEngineName, "dods") == 0 || strcmp(pEngineName, "hl2dm") == 0)
1.70 - {
1.71 - // These four games and Source SDK 2013 do a lookup in this order; so shall we.
1.72 - g_pSM->BuildPath(Path_Game,
1.73 - pDefList->path,
1.74 - sizeof(pDefList->path),
1.75 - "cfg/%s",
1.76 - pMapCycleFileName);
1.77 -
1.78 - if (!libsys->PathExists(pDefList->path))
1.79 - {
1.80 - g_pSM->BuildPath(Path_Game,
1.81 - pDefList->path,
1.82 - sizeof(pDefList->path),
1.83 - "%s",
1.84 - pMapCycleFileName);
1.85 -
1.86 - if (!libsys->PathExists(pDefList->path))
1.87 - {
1.88 - g_pSM->BuildPath(Path_Game,
1.89 - pDefList->path,
1.90 - sizeof(pDefList->path),
1.91 - "cfg/mapcycle_default.txt");
1.92 - }
1.93 - }
1.94 - }
1.95 - else
1.96 - {
1.97 - g_pSM->BuildPath(Path_Game,
1.98 - pDefList->path,
1.99 - sizeof(pDefList->path),
1.100 - "%s",
1.101 - pMapCycleFileName);
1.102 - }
1.103 + GetMapCycleFilePath(pDefList->path, sizeof(pDefList->path));
1.104
1.105 pDefList->last_modified_time = 0;
1.106 pDefList->pArray = NULL;
1.107 @@ -513,11 +514,7 @@
1.108 if (m_pMapCycleFile != NULL && strcmp(name, "mapcyclefile") == 0)
1.109 {
1.110 char path[PLATFORM_MAX_PATH];
1.111 - g_pSM->BuildPath(Path_Game,
1.112 - path,
1.113 - sizeof(path),
1.114 - "%s",
1.115 - m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt");
1.116 + GetMapCycleFilePath(path, sizeof(path));
1.117
1.118 if (strcmp(path, pMapList->path) != 0)
1.119 {