nextmap now use ReadMapList() and OnConfigsExecuted() instead of OnMapStart

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401750
This commit is contained in:
David Anderson 2007-12-02 16:30:47 +00:00
parent 7e013d8343
commit b6bb09e0b8

View File

@ -52,7 +52,7 @@ new Handle:g_Cvar_Nextmap;
new g_MapPos = -1; new g_MapPos = -1;
new Handle:g_MapList = INVALID_HANDLE; new Handle:g_MapList = INVALID_HANDLE;
new g_mapFileTime; new g_MapListSerial = -1;
public OnPluginStart() public OnPluginStart()
{ {
@ -68,12 +68,6 @@ public OnPluginStart()
g_MapList = CreateArray(32); g_MapList = CreateArray(32);
if (!LoadMaps(g_MapList, g_mapFileTime))
{
LogError("FATAL: Cannot load map cycle. Nextmap not loaded.");
SetFailState("Mapcycle Not Found");
}
HookUserMessage(g_VGUIMenu, UserMsg_VGUIMenu); HookUserMessage(g_VGUIMenu, UserMsg_VGUIMenu);
g_Cvar_Nextmap = CreateConVar("sm_nextmap", "", "Sets the Next Map", FCVAR_NOTIFY); g_Cvar_Nextmap = CreateConVar("sm_nextmap", "", "Sets the Next Map", FCVAR_NOTIFY);
@ -91,7 +85,7 @@ public OnPluginStart()
SetConVarString(g_Cvar_Nextmap, currentMap); SetConVarString(g_Cvar_Nextmap, currentMap);
} }
public OnMapStart() public OnConfigsExecuted()
{ {
decl String:lastMap[64], String:currentMap[64]; decl String:lastMap[64], String:currentMap[64];
GetConVarString(g_Cvar_Nextmap, lastMap, 64); GetConVarString(g_Cvar_Nextmap, lastMap, 64);
@ -102,11 +96,18 @@ public OnMapStart()
// not in mapcyclefile. So we keep it set to the last expected nextmap. - ferret // not in mapcyclefile. So we keep it set to the last expected nextmap. - ferret
if (strcmp(lastMap, currentMap) == 0) if (strcmp(lastMap, currentMap) == 0)
{ {
if (!LoadMaps(g_MapList, g_mapFileTime)) if (ReadMapList(g_MapList,
g_MapListSerial,
"mapcyclefile",
MAPLIST_FLAG_CLEARARRAY)
== INVALID_HANDLE)
{
if (g_MapListSerial == -1)
{ {
LogError("FATAL: Cannot load map cycle. Nextmap not loaded."); LogError("FATAL: Cannot load map cycle. Nextmap not loaded.");
SetFailState("Mapcycle Not Found"); SetFailState("Mapcycle Not Found");
} }
}
FindAndSetNextMap(); FindAndSetNextMap();
} }