plugins/mapchooser.sp
changeset 1889 5b4d6acc4d82
parent 1862 2220462e2237
child 1947 e73a1e51833b
     1.1 --- a/plugins/mapchooser.sp	Fri Feb 22 19:22:22 2008 +0000
     1.2 +++ b/plugins/mapchooser.sp	Fri Feb 22 21:01:08 2008 +0000
     1.3 @@ -56,7 +56,6 @@
     1.4  new Handle:g_Cvar_ExtendTimeStep = INVALID_HANDLE;
     1.5  new Handle:g_Cvar_ExtendRoundStep = INVALID_HANDLE;
     1.6  new Handle:g_Cvar_ExtendFragStep = INVALID_HANDLE;
     1.7 -new Handle:g_Cvar_Mapfile = INVALID_HANDLE;
     1.8  new Handle:g_Cvar_ExcludeMaps = INVALID_HANDLE;
     1.9  new Handle:g_Cvar_IncludeMaps = INVALID_HANDLE;
    1.10  new Handle:g_Cvar_NoVoteMode = INVALID_HANDLE;
    1.11 @@ -74,7 +73,7 @@
    1.12  new g_Extends;
    1.13  new g_TotalRounds;
    1.14  new bool:g_HasVoteStarted;
    1.15 -new g_mapFileTime;
    1.16 +new g_mapFileSerial = -1;
    1.17  
    1.18  #define VOTE_EXTEND "##extend##"
    1.19  
    1.20 @@ -93,7 +92,6 @@
    1.21  	g_Cvar_ExtendTimeStep = CreateConVar("sm_extendmap_timestep", "15", "Specifies how much many more minutes each extension makes", _, true, 5.0);
    1.22  	g_Cvar_ExtendRoundStep = CreateConVar("sm_extendmap_roundstep", "5", "Specifies how many more rounds each extension makes", _, true, 5.0);
    1.23  	g_Cvar_ExtendFragStep = CreateConVar("sm_extendmap_fragstep", "10", "Specifies how many more frags are allowed when map is extended.", _, true, 5.0);	
    1.24 -	g_Cvar_Mapfile = CreateConVar("sm_mapvote_file", "configs/maps.ini", "Map file to use. (Def sourcemod/configs/maps.ini)");
    1.25  	g_Cvar_ExcludeMaps = CreateConVar("sm_mapvote_exclude", "5", "Specifies how many past maps to exclude from the vote.", _, true, 0.0);
    1.26  	g_Cvar_IncludeMaps = CreateConVar("sm_mapvote_include", "5", "Specifies how many maps to include in the vote.", _, true, 2.0, true, 6.0);
    1.27  	g_Cvar_NoVoteMode = CreateConVar("sm_mapvote_novote", "1", "Specifies whether or not MapChooser should pick a map if no votes are received.", _, true, 0.0, true, 1.0);
    1.28 @@ -128,13 +126,23 @@
    1.29  		SetFailState("sm_nextmap not found");
    1.30  	}
    1.31  	
    1.32 -	if (LoadMaps(g_MapList, g_mapFileTime, g_Cvar_Mapfile))
    1.33 +	if (ReadMapList(g_MapList,
    1.34 +					 g_mapFileSerial, 
    1.35 +					 "mapchooser",
    1.36 +					 MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER)
    1.37 +		!= INVALID_HANDLE)
    1.38 +		
    1.39  	{
    1.40 -		CreateNextVote();
    1.41 -		SetupTimeleftTimer();
    1.42 -		SetConVarString(g_Cvar_Nextmap, "Pending Vote");
    1.43 +		if (g_mapFileSerial == -1)
    1.44 +		{
    1.45 +			LogError("Unable to create a valid map list.");
    1.46 +		}
    1.47  	}
    1.48  	
    1.49 +	CreateNextVote();
    1.50 +	SetupTimeleftTimer();
    1.51 +	SetConVarString(g_Cvar_Nextmap, "Pending Vote");
    1.52 +	
    1.53  	if (g_TeamScores != INVALID_HANDLE)
    1.54  	{
    1.55  		CloseHandle(g_TeamScores);