Update plugins for transitional methods.

This commit is contained in:
David Anderson
2014-12-13 13:29:15 -08:00
parent 722a23c818
commit 1328984e0b
48 changed files with 620 additions and 620 deletions
+67 -67
View File
@@ -73,12 +73,12 @@ new Handle:g_VoteTimer = INVALID_HANDLE;
new Handle:g_RetryTimer = INVALID_HANDLE;
/* Data Handles */
new Handle:g_MapList = INVALID_HANDLE;
new Handle:g_NominateList = INVALID_HANDLE;
new Handle:g_NominateOwners = INVALID_HANDLE;
new Handle:g_OldMapList = INVALID_HANDLE;
new Handle:g_NextMapList = INVALID_HANDLE;
new Handle:g_VoteMenu = INVALID_HANDLE;
new Handle:g_MapList = null;
new Handle:g_NominateList = null;
new Handle:g_NominateOwners = null;
new Handle:g_OldMapList = null;
new Handle:g_NextMapList = null;
Menu g_VoteMenu;
new g_Extends;
new g_TotalRounds;
@@ -91,8 +91,8 @@ new g_mapFileSerial = -1;
new MapChange:g_ChangeTime;
new Handle:g_NominationsResetForward = INVALID_HANDLE;
new Handle:g_MapVoteStartedForward = INVALID_HANDLE;
new Handle:g_NominationsResetForward = null;
new Handle:g_MapVoteStartedForward = null;
/* Upper bound of how many team there could be */
#define MAXTEAMS 10
@@ -200,7 +200,7 @@ public OnConfigsExecuted()
g_mapFileSerial,
"mapchooser",
MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER)
!= INVALID_HANDLE)
!= null)
{
if (g_mapFileSerial == -1)
@@ -244,8 +244,8 @@ public OnMapEnd()
g_ChangeMapAtRoundEnd = false;
g_ChangeMapInProgress = false;
g_VoteTimer = INVALID_HANDLE;
g_RetryTimer = INVALID_HANDLE;
g_VoteTimer = null;
g_RetryTimer = null;
decl String:map[PLATFORM_MAX_PATH];
GetCurrentMap(map, sizeof(map));
@@ -319,14 +319,14 @@ SetupTimeleftTimer()
new startTime = g_Cvar_StartTime.IntValue * 60;
if (time - startTime < 0 && g_Cvar_EndOfMapVote.BoolValue && !g_MapVoteCompleted && !g_HasVoteStarted)
{
InitiateVote(MapChange_MapEnd, INVALID_HANDLE);
InitiateVote(MapChange_MapEnd, null);
}
else
{
if (g_VoteTimer != INVALID_HANDLE)
if (g_VoteTimer != null)
{
KillTimer(g_VoteTimer);
g_VoteTimer = INVALID_HANDLE;
g_VoteTimer = null;
}
//g_VoteTimer = CreateTimer(float(time - startTime), Timer_StartMapVote, _, TIMER_FLAG_NO_MAPCHANGE);
@@ -344,11 +344,11 @@ public Action:Timer_StartMapVote(Handle:timer, Handle:data)
if (timer == g_RetryTimer)
{
g_WaitingForVote = false;
g_RetryTimer = INVALID_HANDLE;
g_RetryTimer = null;
}
else
{
g_VoteTimer = INVALID_HANDLE;
g_VoteTimer = null;
}
if (!GetArraySize(g_MapList) || !g_Cvar_EndOfMapVote.BoolValue || g_MapVoteCompleted || g_HasVoteStarted)
@@ -464,7 +464,7 @@ public CheckWinLimit(winner_score)
{
if (winner_score >= (winlimit - g_Cvar_StartRounds.IntValue))
{
InitiateVote(MapChange_MapEnd, INVALID_HANDLE);
InitiateVote(MapChange_MapEnd, null);
}
}
}
@@ -479,7 +479,7 @@ public CheckMaxRounds(roundcount)
{
if (roundcount >= (maxrounds - g_Cvar_StartRounds.IntValue))
{
InitiateVote(MapChange_MapEnd, INVALID_HANDLE);
InitiateVote(MapChange_MapEnd, null);
}
}
}
@@ -511,13 +511,13 @@ public Event_PlayerDeath(Event event, const String:name[], bool:dontBroadcast)
if (GetClientFrags(fragger) >= (g_Cvar_Fraglimit.IntValue - g_Cvar_StartFrags.IntValue))
{
InitiateVote(MapChange_MapEnd, INVALID_HANDLE);
InitiateVote(MapChange_MapEnd, null);
}
}
public Action:Command_Mapvote(client, args)
{
InitiateVote(MapChange_MapEnd, INVALID_HANDLE);
InitiateVote(MapChange_MapEnd, null);
return Plugin_Handled;
}
@@ -529,7 +529,7 @@ public Action:Command_Mapvote(client, args)
* @param inputlist Optional list of maps to use for the vote, otherwise an internal list of nominations + random maps will be used.
* @param noSpecials Block special vote options like extend/nochange (upgrade this to bitflags instead?)
*/
InitiateVote(MapChange:when, Handle:inputlist=INVALID_HANDLE)
InitiateVote(MapChange:when, Handle:inputlist=null)
{
g_WaitingForVote = true;
@@ -557,9 +557,9 @@ InitiateVote(MapChange:when, Handle:inputlist=INVALID_HANDLE)
g_WaitingForVote = false;
g_HasVoteStarted = true;
g_VoteMenu = CreateMenu(Handler_MapVoteMenu, MenuAction:MENU_ACTIONS_ALL);
SetMenuTitle(g_VoteMenu, "Vote Nextmap");
SetVoteResultCallback(g_VoteMenu, Handler_MapVoteFinished);
g_VoteMenu = new Menu(Handler_MapVoteMenu, MenuAction:MENU_ACTIONS_ALL);
g_VoteMenu.SetTitle("Vote Nextmap");
g_VoteMenu.VoteResultCallback = Handler_MapVoteFinished;
/* Call OnMapVoteStarted() Forward */
Call_StartForward(g_MapVoteStartedForward);
@@ -575,7 +575,7 @@ InitiateVote(MapChange:when, Handle:inputlist=INVALID_HANDLE)
char map[PLATFORM_MAX_PATH];
/* No input given - User our internal nominations and maplist */
if (inputlist == INVALID_HANDLE)
if (inputlist == null)
{
int nominateCount = GetArraySize(g_NominateList);
int voteSize = g_Cvar_IncludeMaps.IntValue;
@@ -587,7 +587,7 @@ InitiateVote(MapChange:when, Handle:inputlist=INVALID_HANDLE)
for (new i=0; i<nominationsToAdd; i++)
{
GetArrayString(g_NominateList, i, map, sizeof(map));
AddMenuItem(g_VoteMenu, map, map);
g_VoteMenu.AddItem(map, map);
RemoveStringFromArray(g_NextMapList, map);
/* Notify Nominations that this map is now free */
@@ -628,7 +628,7 @@ InitiateVote(MapChange:when, Handle:inputlist=INVALID_HANDLE)
count++;
/* Insert the map and increment our count */
AddMenuItem(g_VoteMenu, map, map);
g_VoteMenu.AddItem(map, map);
i++;
}
@@ -646,7 +646,7 @@ InitiateVote(MapChange:when, Handle:inputlist=INVALID_HANDLE)
if (IsMapValid(map))
{
AddMenuItem(g_VoteMenu, map, map);
g_VoteMenu.AddItem(map, map);
}
}
}
@@ -654,32 +654,32 @@ InitiateVote(MapChange:when, Handle:inputlist=INVALID_HANDLE)
/* Do we add any special items? */
if ((when == MapChange_Instant || when == MapChange_RoundEnd) && g_Cvar_DontChange.BoolValue)
{
AddMenuItem(g_VoteMenu, VOTE_DONTCHANGE, "Don't Change");
g_VoteMenu.AddItem(VOTE_DONTCHANGE, "Don't Change");
}
else if (g_Cvar_Extend.BoolValue && g_Extends < g_Cvar_Extend.IntValue)
{
AddMenuItem(g_VoteMenu, VOTE_EXTEND, "Extend Map");
g_VoteMenu.AddItem(VOTE_EXTEND, "Extend Map");
}
/* There are no maps we could vote for. Don't show anything. */
if (GetMenuItemCount(g_VoteMenu) == 0)
if (g_VoteMenu.ItemCount == 0)
{
g_HasVoteStarted = false;
CloseHandle(g_VoteMenu);
g_VoteMenu = INVALID_HANDLE;
delete g_VoteMenu;
g_VoteMenu = null;
return;
}
int voteDuration = g_Cvar_VoteDuration.IntValue;
SetMenuExitButton(g_VoteMenu, false);
VoteMenuToAll(g_VoteMenu, voteDuration);
g_VoteMenu.ExitButton = false;
g_VoteMenu.DisplayVoteToAll(voteDuration);
LogAction(-1, -1, "Voting for next map has started.");
PrintToChatAll("[SM] %t", "Nextmap Voting Started");
}
public Handler_VoteFinishedGeneric(Handle:menu,
public Handler_VoteFinishedGeneric(Menu menu,
num_votes,
num_clients,
const client_info[][2],
@@ -687,7 +687,7 @@ public Handler_VoteFinishedGeneric(Handle:menu,
const item_info[][2])
{
char map[PLATFORM_MAX_PATH];
GetMenuItem(menu, item_info[0][VOTEINFO_ITEM_INDEX], map, sizeof(map));
menu.GetItem(item_info[0][VOTEINFO_ITEM_INDEX], map, sizeof(map));
if (strcmp(map, VOTE_EXTEND, false) == 0)
{
@@ -774,11 +774,11 @@ public Handler_VoteFinishedGeneric(Handle:menu,
}
}
public Handler_MapVoteFinished(Handle:menu,
num_votes,
num_clients,
public Handler_MapVoteFinished(Menu menu,
int num_votes,
int num_clients,
const client_info[][2],
num_items,
int num_items,
const item_info[][2])
{
if (g_Cvar_RunOff.BoolValue && num_items > 1)
@@ -790,25 +790,25 @@ public Handler_MapVoteFinished(Handle:menu,
{
/* Insufficient Winning margin - Lets do a runoff */
g_VoteMenu = CreateMenu(Handler_MapVoteMenu, MenuAction:MENU_ACTIONS_ALL);
SetMenuTitle(g_VoteMenu, "Runoff Vote Nextmap");
g_VoteMenu.SetTitle("Runoff Vote Nextmap");
SetVoteResultCallback(g_VoteMenu, Handler_VoteFinishedGeneric);
char map[PLATFORM_MAX_PATH];
char info1[PLATFORM_MAX_PATH];
char info2[PLATFORM_MAX_PATH];
GetMenuItem(menu, item_info[0][VOTEINFO_ITEM_INDEX], map, sizeof(map), _, info1, sizeof(info1));
AddMenuItem(g_VoteMenu, map, info1);
GetMenuItem(menu, item_info[1][VOTEINFO_ITEM_INDEX], map, sizeof(map), _, info2, sizeof(info2));
AddMenuItem(g_VoteMenu, map, info2);
menu.GetItem(item_info[0][VOTEINFO_ITEM_INDEX], map, sizeof(map), _, info1, sizeof(info1));
g_VoteMenu.AddItem(map, info1);
menu.GetItem(item_info[1][VOTEINFO_ITEM_INDEX], map, sizeof(map), _, info2, sizeof(info2));
g_VoteMenu.AddItem(map, info2);
int voteDuration = g_Cvar_VoteDuration.IntValue;
SetMenuExitButton(g_VoteMenu, false);
VoteMenuToAll(g_VoteMenu, voteDuration);
g_VoteMenu.ExitButton = false;
g_VoteMenu.DisplayVoteToAll(voteDuration);
/* Notify */
new Float:map1percent = float(item_info[0][VOTEINFO_ITEM_VOTES])/ float(num_votes) * 100;
new Float:map2percent = float(item_info[1][VOTEINFO_ITEM_VOTES])/ float(num_votes) * 100;
float map1percent = float(item_info[0][VOTEINFO_ITEM_VOTES])/ float(num_votes) * 100;
float map2percent = float(item_info[1][VOTEINFO_ITEM_VOTES])/ float(num_votes) * 100;
PrintToChatAll("[SM] %t", "Starting Runoff", g_Cvar_RunOffPercent.FloatValue, info1, map1percent, info2, map2percent);
@@ -821,14 +821,14 @@ public Handler_MapVoteFinished(Handle:menu,
Handler_VoteFinishedGeneric(menu, num_votes, num_clients, client_info, num_items, item_info);
}
public Handler_MapVoteMenu(Handle:menu, MenuAction:action, param1, param2)
public Handler_MapVoteMenu(Menu menu, MenuAction action, int param1, int param2)
{
switch (action)
{
case MenuAction_End:
{
g_VoteMenu = INVALID_HANDLE;
CloseHandle(menu);
g_VoteMenu = null;
delete menu;
}
case MenuAction_Display:
@@ -836,16 +836,16 @@ public Handler_MapVoteMenu(Handle:menu, MenuAction:action, param1, param2)
decl String:buffer[255];
Format(buffer, sizeof(buffer), "%T", "Vote Nextmap", param1);
new Handle:panel = Handle:param2;
SetPanelTitle(panel, buffer);
Panel panel = Panel:param2;
panel.SetTitle(buffer);
}
case MenuAction_DisplayItem:
{
if (GetMenuItemCount(menu) - 1 == param2)
if (menu.ItemCount - 1 == param2)
{
decl String:map[PLATFORM_MAX_PATH], String:buffer[255];
GetMenuItem(menu, param2, map, sizeof(map));
char map[PLATFORM_MAX_PATH], buffer[255];
menu.GetItem(param2, map, sizeof(map));
if (strcmp(map, VOTE_EXTEND, false) == 0)
{
Format(buffer, sizeof(buffer), "%T", "Extend Map", param1);
@@ -864,9 +864,9 @@ public Handler_MapVoteMenu(Handle:menu, MenuAction:action, param1, param2)
// If we receive 0 votes, pick at random.
if (param1 == VoteCancel_NoVotes && g_Cvar_NoVoteMode.BoolValue)
{
new count = GetMenuItemCount(menu);
new count = menu.ItemCount;
decl String:map[PLATFORM_MAX_PATH];
GetMenuItem(menu, 0, map, sizeof(map));
menu.GetItem(0, map, sizeof(map));
// Make sure the first map in the menu isn't one of the special items.
// This would mean there are no real maps in the menu, because the special items are added after all maps. Don't do anything if that's the case.
@@ -874,13 +874,13 @@ public Handler_MapVoteMenu(Handle:menu, MenuAction:action, param1, param2)
{
// Get a random map from the list.
new item = GetRandomInt(0, count - 1);
GetMenuItem(menu, item, map, sizeof(map));
menu.GetItem(item, map, sizeof(map));
// Make sure it's not one of the special items.
while (strcmp(map, VOTE_EXTEND, false) == 0 || strcmp(map, VOTE_DONTCHANGE, false) == 0)
{
item = GetRandomInt(0, count - 1);
GetMenuItem(menu, item, map, sizeof(map));
menu.GetItem(item, map, sizeof(map));
}
SetNextMap(map);
@@ -905,7 +905,7 @@ public Action:Timer_ChangeMap(Handle:hTimer, Handle:dp)
new String:map[PLATFORM_MAX_PATH];
if (dp == INVALID_HANDLE)
if (dp == null)
{
if (!GetNextMap(map, sizeof(map)))
{
@@ -964,7 +964,7 @@ CreateNextVote()
RemoveFromArray(tempMaps, b);
}
CloseHandle(tempMaps);
delete tempMaps;
}
bool:CanVoteStart()
@@ -1149,7 +1149,7 @@ public Native_GetExcludeMapList(Handle:plugin, numParams)
{
new Handle:array = Handle:GetNativeCell(1);
if (array == INVALID_HANDLE)
if (array == null)
{
return;
}
@@ -1170,7 +1170,7 @@ public Native_GetNominatedMapList(Handle:plugin, numParams)
new Handle:maparray = Handle:GetNativeCell(1);
new Handle:ownerarray = Handle:GetNativeCell(2);
if (maparray == INVALID_HANDLE)
if (maparray == null)
return;
decl String:map[PLATFORM_MAX_PATH];
@@ -1181,7 +1181,7 @@ public Native_GetNominatedMapList(Handle:plugin, numParams)
PushArrayString(maparray, map);
// If the optional parameter for an owner list was passed, then we need to fill that out as well
if(ownerarray != INVALID_HANDLE)
if(ownerarray != null)
{
new index = GetArrayCell(g_NominateOwners, i);
PushArrayCell(ownerarray, index);