# HG changeset patch # User Nicholas Hastings # Date 1375325870 14400 # Node ID 5d8b87f983553ffcf0400cca026ec17c4f93f4b9 # Parent 86dedf4462d8b297f26c1163e009ec60ec5e82b3 Check all possible mapcycle paths on newer orangebox games (bug 5719, r=asherkin). diff -r 86dedf4462d8 -r 5d8b87f98355 core/logic/smn_maplists.cpp --- a/core/logic/smn_maplists.cpp Wed Jul 31 22:11:15 2013 -0400 +++ b/core/logic/smn_maplists.cpp Wed Jul 31 22:57:50 2013 -0400 @@ -127,6 +127,8 @@ SMCError error; time_t fileTime; SMCStates states = {0, 0}; + const char *pMapCycleFileName; + const char *pEngineName; fileFound = libsys->FileTime(m_ConfigFile, FileTime_LastChange, &fileTime); @@ -156,11 +158,47 @@ pDefList->bIsPath = true; smcore.strncopy(pDefList->name, "mapcyclefile", sizeof(pDefList->name)); - g_pSM->BuildPath(Path_Game, - pDefList->path, - sizeof(pDefList->path), - "%s", - m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt"); + + pMapCycleFileName = m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt"; + + 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->pArray = NULL; pDefList->serial = 0;