|
pred@2133
|
1 |
/** |
|
pred@2133
|
2 |
* vim: set ts=4 : |
|
pred@2133
|
3 |
* ============================================================================= |
|
pred@2133
|
4 |
* SourceMod Rock The Vote Plugin |
|
pred@2133
|
5 |
* Creates a map vote when the required number of players have requested one. |
|
pred@2133
|
6 |
* |
|
pred@2133
|
7 |
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved. |
|
pred@2133
|
8 |
* ============================================================================= |
|
pred@2133
|
9 |
* |
|
pred@2133
|
10 |
* This program is free software; you can redistribute it and/or modify it under |
|
pred@2133
|
11 |
* the terms of the GNU General Public License, version 3.0, as published by the |
|
pred@2133
|
12 |
* Free Software Foundation. |
|
pred@2133
|
13 |
* |
|
pred@2133
|
14 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
pred@2133
|
15 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
pred@2133
|
16 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
pred@2133
|
17 |
* details. |
|
pred@2133
|
18 |
* |
|
pred@2133
|
19 |
* You should have received a copy of the GNU General Public License along with |
|
pred@2133
|
20 |
* this program. If not, see <http://www.gnu.org/licenses/>. |
|
pred@2133
|
21 |
* |
|
pred@2133
|
22 |
* As a special exception, AlliedModders LLC gives you permission to link the |
|
pred@2133
|
23 |
* code of this program (as well as its derivative works) to "Half-Life 2," the |
|
pred@2133
|
24 |
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software |
|
pred@2133
|
25 |
* by the Valve Corporation. You must obey the GNU General Public License in |
|
pred@2133
|
26 |
* all respects for all other code used. Additionally, AlliedModders LLC grants |
|
pred@2133
|
27 |
* this exception to all derivative works. AlliedModders LLC defines further |
|
pred@2133
|
28 |
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), |
|
pred@2133
|
29 |
* or <http://www.sourcemod.net/license.php>. |
|
pred@2133
|
30 |
* |
|
pred@2133
|
31 |
* Version: $Id$ |
|
pred@2133
|
32 |
*/ |
|
pred@2133
|
33 |
|
|
pred@2133
|
34 |
#include <sourcemod> |
|
pred@2133
|
35 |
#include <mapchooser> |
|
pred@2133
|
36 |
|
|
pred@2133
|
37 |
#pragma semicolon 1 |
|
pred@2133
|
38 |
|
|
pred@2133
|
39 |
public Plugin:myinfo = |
|
pred@2133
|
40 |
{ |
|
pred@2133
|
41 |
name = "Map Nominations", |
|
pred@2133
|
42 |
author = "AlliedModders LLC", |
|
pred@2133
|
43 |
description = "Provides Map Nominations", |
|
pred@2133
|
44 |
version = SOURCEMOD_VERSION, |
|
pred@2133
|
45 |
url = "http://www.sourcemod.net/" |
|
pred@2133
|
46 |
}; |
|
pred@2133
|
47 |
|
|
pred@2133
|
48 |
new Handle:g_Cvar_ExcludeOld = INVALID_HANDLE; |
|
pred@2133
|
49 |
new Handle:g_Cvar_ExcludeCurrent = INVALID_HANDLE; |
|
pred@2133
|
50 |
|
|
pred@2133
|
51 |
new Handle:g_MapList = INVALID_HANDLE; |
|
pred@2133
|
52 |
new Handle:g_MapMenu = INVALID_HANDLE; |
|
pred@2133
|
53 |
new g_mapFileSerial = -1; |
|
pred@2133
|
54 |
|
|
pred@2350
|
55 |
#define MAPSTATUS_ENABLED (1<<0) |
|
pred@2350
|
56 |
#define MAPSTATUS_DISABLED (1<<1) |
|
pred@2350
|
57 |
#define MAPSTATUS_EXCLUDE_CURRENT (1<<2) |
|
pred@2350
|
58 |
#define MAPSTATUS_EXCLUDE_PREVIOUS (1<<3) |
|
pred@2350
|
59 |
#define MAPSTATUS_EXCLUDE_NOMINATED (1<<4) |
|
pred@2350
|
60 |
|
|
pred@2350
|
61 |
new Handle:g_mapTrie; |
|
pred@2350
|
62 |
|
|
pred@2133
|
63 |
public OnPluginStart() |
|
pred@2133
|
64 |
{ |
|
pred@2133
|
65 |
LoadTranslations("common.phrases"); |
|
pred@2133
|
66 |
LoadTranslations("nominations.phrases"); |
|
pred@2133
|
67 |
|
|
pred@2133
|
68 |
new arraySize = ByteCountToCells(33); |
|
pred@2133
|
69 |
g_MapList = CreateArray(arraySize); |
|
pred@2133
|
70 |
|
|
pred@2133
|
71 |
g_Cvar_ExcludeOld = CreateConVar("sm_nominate_excludeold", "1", "Specifies if the current map should be excluded from the Nominations list", 0, true, 0.00, true, 1.0); |
|
pred@2133
|
72 |
g_Cvar_ExcludeCurrent = CreateConVar("sm_nominate_excludecurrent", "1", "Specifies if the MapChooser excluded maps should also be excluded from Nominations", 0, true, 0.00, true, 1.0); |
|
pred@2133
|
73 |
|
|
pred@2133
|
74 |
RegConsoleCmd("sm_nominate", Command_Nominate); |
|
pred@2133
|
75 |
|
|
pred@2133
|
76 |
RegAdminCmd("sm_nominate_addmap", Command_Addmap, ADMFLAG_CHANGEMAP, "sm_nominate_addmap <mapname> - Forces a map to be on the next mapvote."); |
|
pred@2350
|
77 |
|
|
pred@2350
|
78 |
g_mapTrie = CreateTrie(); |
|
pred@2133
|
79 |
} |
|
pred@2133
|
80 |
|
|
pred@2133
|
81 |
public OnConfigsExecuted() |
|
pred@2133
|
82 |
{ |
|
pred@2133
|
83 |
if (ReadMapList(g_MapList, |
|
pred@2133
|
84 |
g_mapFileSerial, |
|
pred@2133
|
85 |
"nominations", |
|
pred@2133
|
86 |
MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER) |
|
pred@2133
|
87 |
== INVALID_HANDLE) |
|
pred@2133
|
88 |
{ |
|
pred@2133
|
89 |
if (g_mapFileSerial == -1) |
|
pred@2133
|
90 |
{ |
|
pred@2133
|
91 |
SetFailState("Unable to create a valid map list."); |
|
pred@2133
|
92 |
} |
|
pred@2133
|
93 |
} |
|
pred@2133
|
94 |
|
|
pred@2133
|
95 |
BuildMapMenu(); |
|
pred@2133
|
96 |
} |
|
pred@2133
|
97 |
|
|
pred@2350
|
98 |
public OnNominationRemoved(const String:map[], owner) |
|
pred@2133
|
99 |
{ |
|
pred@2350
|
100 |
new status; |
|
pred@2350
|
101 |
|
|
pred@2350
|
102 |
/* Is the map in our list? */ |
|
pred@2350
|
103 |
if (!GetTrieValue(g_mapTrie, map, status)) |
|
pred@2350
|
104 |
{ |
|
pred@2350
|
105 |
return; |
|
pred@2350
|
106 |
} |
|
pred@2350
|
107 |
|
|
pred@2350
|
108 |
/* Was the map disabled due to being nominated */ |
|
pred@2350
|
109 |
if ((status & MAPSTATUS_EXCLUDE_NOMINATED) != MAPSTATUS_EXCLUDE_NOMINATED) |
|
pred@2350
|
110 |
{ |
|
pred@2350
|
111 |
return; |
|
pred@2350
|
112 |
} |
|
pred@2350
|
113 |
|
|
pred@2350
|
114 |
SetTrieValue(g_mapTrie, map, MAPSTATUS_ENABLED); |
|
pred@2133
|
115 |
} |
|
pred@2133
|
116 |
|
|
pred@2133
|
117 |
public Action:Command_Addmap(client, args) |
|
pred@2133
|
118 |
{ |
|
pred@2133
|
119 |
if (args < 1) |
|
pred@2133
|
120 |
{ |
|
pred@2133
|
121 |
ReplyToCommand(client, "[SM] Usage: sm_nominate_addmap <mapname>"); |
|
pred@2133
|
122 |
return Plugin_Handled; |
|
pred@2133
|
123 |
} |
|
pred@2133
|
124 |
|
|
pred@2133
|
125 |
decl String:mapname[64]; |
|
pred@2133
|
126 |
GetCmdArg(1, mapname, sizeof(mapname)); |
|
pred@2133
|
127 |
|
|
pred@2350
|
128 |
|
|
pred@2350
|
129 |
new status; |
|
pred@2350
|
130 |
if (!GetTrieValue(g_mapTrie, mapname, status)) |
|
pred@2133
|
131 |
{ |
|
pred@2133
|
132 |
ReplyToCommand(client, "%t", "Map was not found", mapname); |
|
pred@2350
|
133 |
return Plugin_Handled; |
|
pred@2133
|
134 |
} |
|
pred@2133
|
135 |
|
|
pred@2133
|
136 |
new NominateResult:result = NominateMap(mapname, true, 0); |
|
pred@2133
|
137 |
|
|
pred@2133
|
138 |
if (result > Nominate_Replaced) |
|
pred@2133
|
139 |
{ |
|
pred@2133
|
140 |
/* We assume already in vote is the casue because the maplist does a Map Validity check and we forced, so it can't be full */ |
|
pred@2133
|
141 |
ReplyToCommand(client, "%t", "Map Already In Vote", mapname); |
|
pred@2133
|
142 |
|
|
pred@2133
|
143 |
return Plugin_Handled; |
|
pred@2133
|
144 |
} |
|
pred@2133
|
145 |
|
|
pred@2350
|
146 |
|
|
pred@2350
|
147 |
SetTrieValue(g_mapTrie, mapname, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED); |
|
pred@2350
|
148 |
|
|
pred@2133
|
149 |
|
|
pred@2133
|
150 |
ReplyToCommand(client, "%t", "Map Inserted", mapname); |
|
pred@2133
|
151 |
LogAction(client, -1, "\"%L\" inserted map \"%s\".", client, mapname); |
|
pred@2133
|
152 |
|
|
pred@2133
|
153 |
return Plugin_Handled; |
|
pred@2133
|
154 |
} |
|
pred@2133
|
155 |
|
|
systematicmania@4298
|
156 |
public OnClientSayCommand_Post(client, const String:command[], const String:sArgs[]) |
|
pred@2133
|
157 |
{ |
|
pred@2133
|
158 |
if (!client) |
|
pred@2133
|
159 |
{ |
|
systematicmania@4298
|
160 |
return; |
|
pred@2133
|
161 |
} |
|
pred@2133
|
162 |
|
|
systematicmania@4298
|
163 |
if (strcmp(sArgs, "nominate", false) == 0) |
|
pred@2133
|
164 |
{ |
|
systematicmania@4298
|
165 |
new ReplySource:old = SetCmdReplySource(SM_REPLY_TO_CHAT); |
|
systematicmania@4298
|
166 |
|
|
systematicmania@4298
|
167 |
AttemptNominate(client); |
|
systematicmania@4298
|
168 |
|
|
systematicmania@4298
|
169 |
SetCmdReplySource(old); |
|
pred@2133
|
170 |
} |
|
pred@2133
|
171 |
} |
|
pred@2133
|
172 |
|
|
pred@2133
|
173 |
public Action:Command_Nominate(client, args) |
|
pred@2133
|
174 |
{ |
|
pred@2133
|
175 |
if (!client) |
|
pred@2133
|
176 |
{ |
|
erik@3187
|
177 |
return Plugin_Handled; |
|
pred@2133
|
178 |
} |
|
pred@2133
|
179 |
|
|
pred@2133
|
180 |
if (args == 0) |
|
pred@2133
|
181 |
{ |
|
pred@2133
|
182 |
AttemptNominate(client); |
|
erik@3187
|
183 |
return Plugin_Handled; |
|
pred@2133
|
184 |
} |
|
pred@2133
|
185 |
|
|
pred@2133
|
186 |
decl String:mapname[64]; |
|
pred@2133
|
187 |
GetCmdArg(1, mapname, sizeof(mapname)); |
|
pred@2133
|
188 |
|
|
pred@2350
|
189 |
new status; |
|
pred@2350
|
190 |
if (!GetTrieValue(g_mapTrie, mapname, status)) |
|
pred@2133
|
191 |
{ |
|
pred@2350
|
192 |
ReplyToCommand(client, "%t", "Map was not found", mapname); |
|
pred@2350
|
193 |
return Plugin_Handled; |
|
pred@2133
|
194 |
} |
|
pred@2133
|
195 |
|
|
pred@2350
|
196 |
if ((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED) |
|
pred@2350
|
197 |
{ |
|
pred@2350
|
198 |
if ((status & MAPSTATUS_EXCLUDE_CURRENT) == MAPSTATUS_EXCLUDE_CURRENT) |
|
pred@2350
|
199 |
{ |
|
pred@2350
|
200 |
ReplyToCommand(client, "[SM] %t", "Can't Nominate Current Map"); |
|
pred@2350
|
201 |
} |
|
pred@2350
|
202 |
|
|
pred@2350
|
203 |
if ((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS) |
|
pred@2350
|
204 |
{ |
|
pred@2350
|
205 |
ReplyToCommand(client, "[SM] %t", "Map in Exclude List"); |
|
pred@2350
|
206 |
} |
|
pred@2350
|
207 |
|
|
pred@2350
|
208 |
if ((status & MAPSTATUS_EXCLUDE_NOMINATED) == MAPSTATUS_EXCLUDE_NOMINATED) |
|
pred@2350
|
209 |
{ |
|
pred@2350
|
210 |
ReplyToCommand(client, "[SM] %t", "Map Already Nominated"); |
|
pred@2350
|
211 |
} |
|
pred@2350
|
212 |
|
|
pred@2350
|
213 |
return Plugin_Handled; |
|
pred@2350
|
214 |
} |
|
pred@2350
|
215 |
|
|
pred@2350
|
216 |
new NominateResult:result = NominateMap(mapname, false, client); |
|
pred@2350
|
217 |
|
|
pred@2350
|
218 |
if (result > Nominate_Replaced) |
|
pred@2350
|
219 |
{ |
|
pred@2350
|
220 |
if (result == Nominate_AlreadyInVote) |
|
pred@2350
|
221 |
{ |
|
pred@2350
|
222 |
ReplyToCommand(client, "%t", "Map Already In Vote", mapname); |
|
pred@2350
|
223 |
} |
|
pred@2350
|
224 |
else |
|
pred@2350
|
225 |
{ |
|
pred@2350
|
226 |
ReplyToCommand(client, "[SM] %t", "Map Already Nominated"); |
|
pred@2350
|
227 |
} |
|
pred@2350
|
228 |
|
|
pred@2350
|
229 |
return Plugin_Handled; |
|
pred@2350
|
230 |
} |
|
pred@2350
|
231 |
|
|
pred@2350
|
232 |
/* Map was nominated! - Disable the menu item and update the trie */ |
|
pred@2350
|
233 |
|
|
pred@2350
|
234 |
SetTrieValue(g_mapTrie, mapname, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED); |
|
pred@2350
|
235 |
|
|
pred@2350
|
236 |
decl String:name[64]; |
|
pred@2350
|
237 |
GetClientName(client, name, sizeof(name)); |
|
pred@2350
|
238 |
PrintToChatAll("[SM] %t", "Map Nominated", name, mapname); |
|
pred@2350
|
239 |
|
|
pred@2350
|
240 |
return Plugin_Continue; |
|
pred@2133
|
241 |
} |
|
pred@2133
|
242 |
|
|
pred@2133
|
243 |
AttemptNominate(client) |
|
pred@2133
|
244 |
{ |
|
kyle@4060
|
245 |
SetMenuTitle(g_MapMenu, "%T", "Nominate Title", client); |
|
pred@2133
|
246 |
DisplayMenu(g_MapMenu, client, MENU_TIME_FOREVER); |
|
pred@2133
|
247 |
|
|
pred@2133
|
248 |
return; |
|
pred@2133
|
249 |
} |
|
pred@2133
|
250 |
|
|
pred@2133
|
251 |
BuildMapMenu() |
|
pred@2133
|
252 |
{ |
|
pred@2133
|
253 |
if (g_MapMenu != INVALID_HANDLE) |
|
pred@2133
|
254 |
{ |
|
pred@2133
|
255 |
CloseHandle(g_MapMenu); |
|
pred@2133
|
256 |
g_MapMenu = INVALID_HANDLE; |
|
pred@2133
|
257 |
} |
|
pred@2133
|
258 |
|
|
pred@2350
|
259 |
ClearTrie(g_mapTrie); |
|
pred@2350
|
260 |
|
|
pred@2350
|
261 |
g_MapMenu = CreateMenu(Handler_MapSelectMenu, MENU_ACTIONS_DEFAULT|MenuAction_DrawItem|MenuAction_DisplayItem); |
|
pred@2133
|
262 |
|
|
pred@2133
|
263 |
decl String:map[64]; |
|
pred@2133
|
264 |
|
|
fyrenmoo@2865
|
265 |
new Handle:excludeMaps = INVALID_HANDLE; |
|
pred@2133
|
266 |
decl String:currentMap[32]; |
|
pred@2133
|
267 |
|
|
pred@2133
|
268 |
if (GetConVarBool(g_Cvar_ExcludeOld)) |
|
pred@2133
|
269 |
{ |
|
pred@2133
|
270 |
excludeMaps = CreateArray(ByteCountToCells(33)); |
|
pred@2133
|
271 |
GetExcludeMapList(excludeMaps); |
|
pred@2133
|
272 |
} |
|
pred@2133
|
273 |
|
|
pred@2133
|
274 |
if (GetConVarBool(g_Cvar_ExcludeCurrent)) |
|
pred@2133
|
275 |
{ |
|
pred@2133
|
276 |
GetCurrentMap(currentMap, sizeof(currentMap)); |
|
pred@2133
|
277 |
} |
|
pred@2133
|
278 |
|
|
pred@2350
|
279 |
|
|
pred@2133
|
280 |
for (new i = 0; i < GetArraySize(g_MapList); i++) |
|
pred@2133
|
281 |
{ |
|
pred@2350
|
282 |
new status = MAPSTATUS_ENABLED; |
|
pred@2133
|
283 |
|
|
pred@2350
|
284 |
GetArrayString(g_MapList, i, map, sizeof(map)); |
|
pred@2133
|
285 |
|
|
pred@2133
|
286 |
if (GetConVarBool(g_Cvar_ExcludeCurrent)) |
|
pred@2133
|
287 |
{ |
|
pred@2133
|
288 |
if (StrEqual(map, currentMap)) |
|
pred@2133
|
289 |
{ |
|
pred@2350
|
290 |
status = MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_CURRENT; |
|
pred@2350
|
291 |
} |
|
pred@2350
|
292 |
} |
|
pred@2350
|
293 |
|
|
pred@2350
|
294 |
/* Dont bother with this check if the current map check passed */ |
|
pred@2350
|
295 |
if (GetConVarBool(g_Cvar_ExcludeOld) && status == MAPSTATUS_ENABLED) |
|
pred@2350
|
296 |
{ |
|
pred@2350
|
297 |
if (FindStringInArray(excludeMaps, map) != -1) |
|
pred@2350
|
298 |
{ |
|
pred@2350
|
299 |
status = MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_PREVIOUS; |
|
pred@2133
|
300 |
} |
|
pred@2133
|
301 |
} |
|
pred@2133
|
302 |
|
|
pred@2133
|
303 |
AddMenuItem(g_MapMenu, map, map); |
|
pred@2350
|
304 |
SetTrieValue(g_mapTrie, map, status); |
|
pred@2133
|
305 |
} |
|
pred@2133
|
306 |
|
|
pred@2133
|
307 |
SetMenuExitButton(g_MapMenu, true); |
|
fyrenmoo@2865
|
308 |
|
|
fyrenmoo@2865
|
309 |
if (excludeMaps != INVALID_HANDLE) |
|
fyrenmoo@2865
|
310 |
{ |
|
fyrenmoo@2865
|
311 |
CloseHandle(excludeMaps); |
|
fyrenmoo@2865
|
312 |
} |
|
pred@2133
|
313 |
} |
|
pred@2133
|
314 |
|
|
pred@2133
|
315 |
public Handler_MapSelectMenu(Handle:menu, MenuAction:action, param1, param2) |
|
pred@2133
|
316 |
{ |
|
pred@2133
|
317 |
switch (action) |
|
pred@2133
|
318 |
{ |
|
pred@2133
|
319 |
case MenuAction_Select: |
|
pred@2133
|
320 |
{ |
|
pred@2133
|
321 |
decl String:map[64], String:name[64]; |
|
pred@2350
|
322 |
GetMenuItem(menu, param2, map, sizeof(map)); |
|
pred@2133
|
323 |
|
|
pred@2133
|
324 |
GetClientName(param1, name, 64); |
|
pred@2133
|
325 |
|
|
pred@2133
|
326 |
new NominateResult:result = NominateMap(map, false, param1); |
|
pred@2133
|
327 |
|
|
pred@2133
|
328 |
/* Don't need to check for InvalidMap because the menu did that already */ |
|
pred@2133
|
329 |
if (result == Nominate_AlreadyInVote) |
|
pred@2133
|
330 |
{ |
|
pred@2133
|
331 |
PrintToChat(param1, "[SM] %t", "Map Already Nominated"); |
|
pred@2350
|
332 |
return 0; |
|
pred@2133
|
333 |
} |
|
pred@2133
|
334 |
else if (result == Nominate_VoteFull) |
|
pred@2133
|
335 |
{ |
|
pred@2133
|
336 |
PrintToChat(param1, "[SM] %t", "Max Nominations"); |
|
pred@2350
|
337 |
return 0; |
|
pred@2133
|
338 |
} |
|
pred@2350
|
339 |
|
|
pred@2350
|
340 |
SetTrieValue(g_mapTrie, map, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED); |
|
pred@2347
|
341 |
|
|
pred@2133
|
342 |
if (result == Nominate_Replaced) |
|
pred@2133
|
343 |
{ |
|
pred@2133
|
344 |
PrintToChatAll("[SM] %t", "Map Nomination Changed", name, map); |
|
pred@2350
|
345 |
return 0; |
|
pred@2133
|
346 |
} |
|
pred@2133
|
347 |
|
|
pred@2133
|
348 |
PrintToChatAll("[SM] %t", "Map Nominated", name, map); |
|
pred@2133
|
349 |
} |
|
pred@2350
|
350 |
|
|
pred@2350
|
351 |
case MenuAction_DrawItem: |
|
pred@2350
|
352 |
{ |
|
pred@2350
|
353 |
decl String:map[64]; |
|
pred@2350
|
354 |
GetMenuItem(menu, param2, map, sizeof(map)); |
|
pred@2350
|
355 |
|
|
pred@2350
|
356 |
new status; |
|
pred@2350
|
357 |
|
|
pred@2350
|
358 |
if (!GetTrieValue(g_mapTrie, map, status)) |
|
pred@2350
|
359 |
{ |
|
pred@2350
|
360 |
LogError("Menu selection of item not in trie. Major logic problem somewhere."); |
|
pred@2350
|
361 |
return ITEMDRAW_DEFAULT; |
|
pred@2350
|
362 |
} |
|
pred@2350
|
363 |
|
|
pred@2350
|
364 |
if ((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED) |
|
pred@2350
|
365 |
{ |
|
pred@2350
|
366 |
return ITEMDRAW_DISABLED; |
|
pred@2350
|
367 |
} |
|
pred@2350
|
368 |
|
|
pred@2350
|
369 |
return ITEMDRAW_DEFAULT; |
|
pred@2350
|
370 |
|
|
pred@2350
|
371 |
} |
|
pred@2350
|
372 |
|
|
pred@2350
|
373 |
case MenuAction_DisplayItem: |
|
pred@2350
|
374 |
{ |
|
pred@2350
|
375 |
decl String:map[64]; |
|
pred@2350
|
376 |
GetMenuItem(menu, param2, map, sizeof(map)); |
|
pred@2350
|
377 |
|
|
pred@2350
|
378 |
new status; |
|
pred@2350
|
379 |
|
|
pred@2350
|
380 |
if (!GetTrieValue(g_mapTrie, map, status)) |
|
pred@2350
|
381 |
{ |
|
pred@2350
|
382 |
LogError("Menu selection of item not in trie. Major logic problem somewhere."); |
|
pred@2350
|
383 |
return 0; |
|
pred@2350
|
384 |
} |
|
pred@2350
|
385 |
|
|
pred@2350
|
386 |
decl String:display[100]; |
|
pred@2350
|
387 |
|
|
pred@2350
|
388 |
if ((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED) |
|
pred@2350
|
389 |
{ |
|
pred@2350
|
390 |
if ((status & MAPSTATUS_EXCLUDE_CURRENT) == MAPSTATUS_EXCLUDE_CURRENT) |
|
pred@2350
|
391 |
{ |
|
pred@2350
|
392 |
Format(display, sizeof(display), "%s (%T)", map, "Current Map", param1); |
|
pred@2350
|
393 |
return RedrawMenuItem(display); |
|
pred@2350
|
394 |
} |
|
pred@2350
|
395 |
|
|
pred@2350
|
396 |
if ((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS) |
|
pred@2350
|
397 |
{ |
|
pred@2350
|
398 |
Format(display, sizeof(display), "%s (%T)", map, "Recently Played", param1); |
|
pred@2350
|
399 |
return RedrawMenuItem(display); |
|
pred@2350
|
400 |
} |
|
pred@2350
|
401 |
|
|
pred@2350
|
402 |
if ((status & MAPSTATUS_EXCLUDE_NOMINATED) == MAPSTATUS_EXCLUDE_NOMINATED) |
|
pred@2350
|
403 |
{ |
|
pred@2350
|
404 |
Format(display, sizeof(display), "%s (%T)", map, "Nominated", param1); |
|
pred@2350
|
405 |
return RedrawMenuItem(display); |
|
pred@2350
|
406 |
} |
|
pred@2350
|
407 |
} |
|
pred@2350
|
408 |
|
|
pred@2350
|
409 |
return 0; |
|
pred@2350
|
410 |
} |
|
pred@2133
|
411 |
} |
|
pred@2350
|
412 |
|
|
pred@2350
|
413 |
return 0; |
|
fyrenmoo@2865
|
414 |
} |