nextmap now use ReadMapList() and OnConfigsExecuted() instead of OnMapStart
authorDavid Anderson <dvander@alliedmods.net>
Sun Dec 02 16:30:47 2007 +0000 (2007-12-02)
changeset 174482283e45f24a
parent 1743 4af92f17de5c
child 1745 6f11b5b0241f
nextmap now use ReadMapList() and OnConfigsExecuted() instead of OnMapStart
plugins/nextmap.sp
     1.1 --- a/plugins/nextmap.sp	Sun Dec 02 05:38:58 2007 +0000
     1.2 +++ b/plugins/nextmap.sp	Sun Dec 02 16:30:47 2007 +0000
     1.3 @@ -52,7 +52,7 @@
     1.4  
     1.5  new g_MapPos = -1;
     1.6  new Handle:g_MapList = INVALID_HANDLE;
     1.7 -new g_mapFileTime;
     1.8 +new g_MapListSerial = -1;
     1.9   
    1.10  public OnPluginStart()
    1.11  {
    1.12 @@ -68,12 +68,6 @@
    1.13  	
    1.14  	g_MapList = CreateArray(32);
    1.15  
    1.16 -	if (!LoadMaps(g_MapList, g_mapFileTime))
    1.17 -	{
    1.18 -		LogError("FATAL: Cannot load map cycle. Nextmap not loaded.");
    1.19 -		SetFailState("Mapcycle Not Found");		
    1.20 -	}	
    1.21 -	
    1.22  	HookUserMessage(g_VGUIMenu, UserMsg_VGUIMenu);
    1.23  	
    1.24  	g_Cvar_Nextmap = CreateConVar("sm_nextmap", "", "Sets the Next Map", FCVAR_NOTIFY);
    1.25 @@ -91,7 +85,7 @@
    1.26  	SetConVarString(g_Cvar_Nextmap, currentMap);
    1.27  }
    1.28   
    1.29 -public OnMapStart()
    1.30 +public OnConfigsExecuted()
    1.31  {
    1.32  	decl String:lastMap[64], String:currentMap[64];
    1.33  	GetConVarString(g_Cvar_Nextmap, lastMap, 64);
    1.34 @@ -102,11 +96,18 @@
    1.35  	// not in mapcyclefile. So we keep it set to the last expected nextmap. - ferret
    1.36  	if (strcmp(lastMap, currentMap) == 0)
    1.37  	{
    1.38 -		if (!LoadMaps(g_MapList, g_mapFileTime))
    1.39 +		if (ReadMapList(g_MapList, 
    1.40 +				g_MapListSerial, 
    1.41 +				"mapcyclefile", 
    1.42 +				MAPLIST_FLAG_CLEARARRAY)
    1.43 +			== INVALID_HANDLE)
    1.44  		{
    1.45 -			LogError("FATAL: Cannot load map cycle. Nextmap not loaded.");
    1.46 -			SetFailState("Mapcycle Not Found");	
    1.47 -		}		
    1.48 +			if (g_MapListSerial == -1)
    1.49 +			{
    1.50 +				LogError("FATAL: Cannot load map cycle. Nextmap not loaded.");
    1.51 +				SetFailState("Mapcycle Not Found");
    1.52 +			}
    1.53 +		}
    1.54  		
    1.55  		FindAndSetNextMap();
    1.56  	}