deprecated LoadMaps() and its usage in three plugins

renamed basefun* to fun*
removed map file list cvars

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401895
This commit is contained in:
David Anderson 2008-02-22 21:01:08 +00:00
parent 2edce74e0f
commit 63cb644232
20 changed files with 529 additions and 471 deletions

View File

@ -27,12 +27,33 @@
"target" "mapcyclefile"
}
/* Admin menu, map menu */
"sm_map menu"
{
"file" "addons/sourcemod/configs/adminmenu_maplist.ini"
}
/* Admin menu, map voting menu */
"sm_votemap menu"
{
"file" "addons/sourcemod/configs/adminmenu_maplist.ini"
}
/* For the "randomcycle" plugin */
"randomcycle"
{
"target" "default"
}
/* For the "mapchooser" plugin */
"mapchooser"
{
"target" "default"
}
/* For the "randomcycle" plugin */
"rockthevote"
{
"target" "default"
}
}

View File

@ -40,9 +40,9 @@
public Plugin:myinfo =
{
name = "Basic Fun Commands",
name = "Fun Commands",
author = "AlliedModders LLC",
description = "Basic Fun Commands",
description = "Fun Commands",
version = SOURCEMOD_VERSION,
url = "http://www.sourcemod.net/"
};
@ -93,32 +93,37 @@ new UserMsg:g_FadeUserMsgId;
// Include various commands and supporting functions
#if BEACON
#include "basefuncommands/beacon.sp"
#include "funcommands/beacon.sp"
#endif
#if TIMEBOMB
#include "basefuncommands/timebomb.sp"
#include "funcommands/timebomb.sp"
#endif
#if FIRE
#include "basefuncommands/fire.sp"
#include "funcommands/fire.sp"
#endif
#if ICE
#include "basefuncommands/ice.sp"
#include "funcommands/ice.sp"
#endif
#if GRAVITY
#include "basefuncommands/gravity.sp"
#include "funcommands/gravity.sp"
#endif
#if BLIND
#include "basefuncommands/blind.sp"
#include "funcommands/blind.sp"
#endif
#if NOCLIP
#include "basefuncommands/noclip.sp"
#include "funcommands/noclip.sp"
#endif
#if DRUG
#include "basefuncommands/drug.sp"
#include "funcommands/drug.sp"
#endif
public OnPluginStart()
{
if (FindPluginByFile("basefuncommands.smx") != INVALID_HANDLE)
{
ThrowError("This plugin replaces basefuncommands. You cannot run both at once.");
}
LoadTranslations("common.phrases");
LoadTranslations("basefuncommands.phrases");

View File

@ -41,7 +41,7 @@
public Plugin:myinfo =
{
name = "Basic Fun Votes",
name = "Fun Votes",
author = "AlliedModders LLC",
description = "Fun Vote Commands",
version = SOURCEMOD_VERSION,
@ -85,14 +85,19 @@ new String:g_voteInfo[3][65]; /* Holds the target's name, authid, and IP */
new Handle:hTopMenu = INVALID_HANDLE;
#include "basefunvotes/votegravity.sp"
#include "basefunvotes/voteburn.sp"
#include "basefunvotes/voteslay.sp"
#include "basefunvotes/votealltalk.sp"
#include "basefunvotes/voteff.sp"
#include "funvotes/votegravity.sp"
#include "funvotes/voteburn.sp"
#include "funvotes/voteslay.sp"
#include "funvotes/votealltalk.sp"
#include "funvotes/voteff.sp"
public OnPluginStart()
{
if (FindPluginByFile("basefunvotes.smx") != INVALID_HANDLE)
{
ThrowError("This plugin replaces basefuncommands. You cannot run both at once.");
}
LoadTranslations("common.phrases");
LoadTranslations("basevotes.phrases");
LoadTranslations("basefunvotes.phrases");

View File

@ -202,6 +202,10 @@ stock FindTarget(client, const String:target[], bool:nobots = false, bool:immuni
}
/**
* This function is no longer supported. It has been replaced with ReadMapList(),
* which uses a more unified caching and configuration mechanism. This function also
* has a bug where if the cvar contents changes, the fileTime change won't be recognized.
*
* Loads a specified array with maps. The maps will be either loaded from mapcyclefile, or if supplied
* a cvar containing a file name. If the file in the cvar is bad, it will use mapcyclefile. The fileTime
* parameter is used to store a timestamp of the file. If specified, the file will only be reloaded if it
@ -212,6 +216,7 @@ stock FindTarget(client, const String:target[], bool:nobots = false, bool:immuni
* @param fileCvar CVAR set to the file to be loaded. Optional.
* @return Number of maps loaded or 0 if in error.
*/
#pragma deprecated Use ReadMapList() instead.
stock LoadMaps(Handle:array, &fileTime = 0, Handle:fileCvar = INVALID_HANDLE)
{
decl String:mapPath[256], String:mapFile[64];

View File

@ -56,7 +56,6 @@ new Handle:g_Cvar_StartFrags = INVALID_HANDLE;
new Handle:g_Cvar_ExtendTimeStep = INVALID_HANDLE;
new Handle:g_Cvar_ExtendRoundStep = INVALID_HANDLE;
new Handle:g_Cvar_ExtendFragStep = INVALID_HANDLE;
new Handle:g_Cvar_Mapfile = INVALID_HANDLE;
new Handle:g_Cvar_ExcludeMaps = INVALID_HANDLE;
new Handle:g_Cvar_IncludeMaps = INVALID_HANDLE;
new Handle:g_Cvar_NoVoteMode = INVALID_HANDLE;
@ -74,7 +73,7 @@ new Handle:g_VoteMenu = INVALID_HANDLE;
new g_Extends;
new g_TotalRounds;
new bool:g_HasVoteStarted;
new g_mapFileTime;
new g_mapFileSerial = -1;
#define VOTE_EXTEND "##extend##"
@ -93,7 +92,6 @@ public OnPluginStart()
g_Cvar_ExtendTimeStep = CreateConVar("sm_extendmap_timestep", "15", "Specifies how much many more minutes each extension makes", _, true, 5.0);
g_Cvar_ExtendRoundStep = CreateConVar("sm_extendmap_roundstep", "5", "Specifies how many more rounds each extension makes", _, true, 5.0);
g_Cvar_ExtendFragStep = CreateConVar("sm_extendmap_fragstep", "10", "Specifies how many more frags are allowed when map is extended.", _, true, 5.0);
g_Cvar_Mapfile = CreateConVar("sm_mapvote_file", "configs/maps.ini", "Map file to use. (Def sourcemod/configs/maps.ini)");
g_Cvar_ExcludeMaps = CreateConVar("sm_mapvote_exclude", "5", "Specifies how many past maps to exclude from the vote.", _, true, 0.0);
g_Cvar_IncludeMaps = CreateConVar("sm_mapvote_include", "5", "Specifies how many maps to include in the vote.", _, true, 2.0, true, 6.0);
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);
@ -128,12 +126,22 @@ public OnConfigsExecuted()
SetFailState("sm_nextmap not found");
}
if (LoadMaps(g_MapList, g_mapFileTime, g_Cvar_Mapfile))
if (ReadMapList(g_MapList,
g_mapFileSerial,
"mapchooser",
MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER)
!= INVALID_HANDLE)
{
if (g_mapFileSerial == -1)
{
LogError("Unable to create a valid map list.");
}
}
CreateNextVote();
SetupTimeleftTimer();
SetConVarString(g_Cvar_Nextmap, "Pending Vote");
}
if (g_TeamScores != INVALID_HANDLE)
{

View File

@ -44,12 +44,11 @@ public Plugin:myinfo =
};
new Handle:g_Cvar_Nextmap = INVALID_HANDLE;
new Handle:g_Cvar_Mapfile = INVALID_HANDLE;
new Handle:g_Cvar_ExcludeMaps = INVALID_HANDLE;
new Handle:g_MapList = INVALID_HANDLE;
new Handle:g_OldMapList = INVALID_HANDLE;
new g_mapFileTime;
new g_mapListSerial = -1;
public OnPluginStart()
{
@ -57,7 +56,6 @@ public OnPluginStart()
g_MapList = CreateArray(arraySize);
g_OldMapList = CreateArray(arraySize);
g_Cvar_Mapfile = CreateConVar("sm_randomcycle_file", "configs/maps.ini", "Map file to use. (Def sourcemod/configs/maps.ini)");
g_Cvar_ExcludeMaps = CreateConVar("sm_randomcycle_exclude", "5", "Specifies how many past maps to exclude from the vote.", _, true, 0.0);
AutoExecConfig(true, "randomcycle");
@ -73,10 +71,19 @@ public OnConfigsExecuted()
SetFailState("sm_nextmap not found");
}
if (LoadMaps(g_MapList, g_mapFileTime, g_Cvar_Mapfile))
if (ReadMapList(g_MapList,
g_mapListSerial,
"randomcycle",
MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER)
== INVALID_HANDLE)
{
CreateTimer(5.0, Timer_RandomizeNextmap); // Small delay to give Nextmap time to complete OnMapStart()
if (g_mapListSerial == -1)
{
LogError("Unable to create a valid map list.");
}
}
CreateTimer(5.0, Timer_RandomizeNextmap); // Small delay to give Nextmap time to complete OnMapStart()
}
public Action:Timer_RandomizeNextmap(Handle:timer)

View File

@ -45,7 +45,6 @@ public Plugin:myinfo =
};
new Handle:g_Cvar_Needed = INVALID_HANDLE;
new Handle:g_Cvar_File = INVALID_HANDLE;
new Handle:g_Cvar_Maps = INVALID_HANDLE;
new Handle:g_Cvar_Nominate = INVALID_HANDLE;
new Handle:g_Cvar_MinPlayers = INVALID_HANDLE;
@ -54,7 +53,7 @@ new Handle:g_MapList = INVALID_HANDLE;
new Handle:g_RTVMapList = INVALID_HANDLE;
new Handle:g_MapMenu = INVALID_HANDLE;
new Handle:g_RetryTimer = INVALID_HANDLE;
new g_mapFileTime;
new g_mapFileSerial = -1;
new bool:g_CanRTV = false; // True if RTV loaded maps and is active.
new bool:g_RTVAllowed = false; // True if RTV is available to players. Used to delay rtv votes.
@ -76,7 +75,6 @@ public OnPluginStart()
g_RTVMapList = CreateArray(arraySize);
g_Cvar_Needed = CreateConVar("sm_rtv_needed", "0.60", "Percentage of players needed to rockthevote (Def 60%)", 0, true, 0.05, true, 1.0);
g_Cvar_File = CreateConVar("sm_rtv_file", "configs/maps.ini", "Map file to use. (Def configs/maps.ini)");
g_Cvar_Maps = CreateConVar("sm_rtv_maps", "4", "Number of maps to be voted on. 2 to 6. (Def 4)", 0, true, 2.0, true, 6.0);
g_Cvar_Nominate = CreateConVar("sm_rtv_nominate", "1", "Enables nomination system.", 0, true, 0.0, true, 1.0);
g_Cvar_MinPlayers = CreateConVar("sm_rtv_minplayers", "0", "Number of players required before RTV will be enabled.", 0, true, 0.0, true, float(MAXPLAYERS));
@ -111,12 +109,21 @@ public OnConfigsExecuted()
ClearArray(g_RTVMapList);
}
if (LoadMaps(g_MapList, g_mapFileTime, g_Cvar_File))
if (ReadMapList(g_MapList,
g_mapFileSerial,
"rockthevote",
MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER)
== INVALID_HANDLE)
{
if (g_mapFileSerial == -1)
{
LogError("Unable to create a valid map list.");
}
}
BuildMapMenu();
g_CanRTV = true;
CreateTimer(30.0, Timer_DelayRTV);
}
}
public bool:OnClientConnect(client, String:rejectmsg[], maxlen)