1.1 --- a/extensions/structs/StructHandle.h Wed Oct 08 21:02:01 2008 +1300
1.2 +++ b/extensions/structs/StructHandle.h Thu Oct 09 13:24:44 2008 +1300
1.3 @@ -33,7 +33,7 @@
1.4 #define _INCLUDE_SOURCEMOD_STRUCT_HANDLE_H_
1.5
1.6 #include "Struct.h"
1.7 -#include "mathlib/vector.h"
1.8 +#include "vector.h"
1.9 #include "basehandle.h"
1.10
1.11 class StructHandle
2.1 --- a/extensions/structs/msvc9/structs.vcproj Wed Oct 08 21:02:01 2008 +1300
2.2 +++ b/extensions/structs/msvc9/structs.vcproj Thu Oct 09 13:24:44 2008 +1300
2.3 @@ -361,7 +361,7 @@
2.4 <Tool
2.5 Name="VCCLCompilerTool"
2.6 Optimization="0"
2.7 - AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(SOURCEMM16)";"$(SOURCEMM16)\sourcemm";"$(SOURCEMM16)\sourcehook";"$(HL2SDKOB)\game\shared""
2.8 + AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\mathlib";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(SOURCEMM16)";"$(SOURCEMM16)\sourcemm";"$(SOURCEMM16)\sourcehook";"$(HL2SDKOB)\game\shared""
2.9 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD"
2.10 MinimalRebuild="true"
2.11 BasicRuntimeChecks="3"
2.12 @@ -442,7 +442,7 @@
2.13 <Tool
2.14 Name="VCCLCompilerTool"
2.15 FavorSizeOrSpeed="1"
2.16 - AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(SOURCEMM16)";"$(SOURCEMM16)\sourcemm";"$(SOURCEMM16)\sourcehook";"$(HL2SDKOB)\game\shared""
2.17 + AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;"$(HL2SDKOB)\public";"$(HL2SDKOB)\public\engine";"$(HL2SDKOB)\public\mathlib";"$(HL2SDKOB)\public\game\server";"$(HL2SDKOB)\public\tier0";"$(HL2SDKOB)\public\tier1";"$(SOURCEMM16)";"$(SOURCEMM16)\sourcemm";"$(SOURCEMM16)\sourcehook";"$(HL2SDKOB)\game\shared""
2.18 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD"
2.19 RuntimeLibrary="0"
2.20 EnableEnhancedInstructionSet="1"
3.1 --- a/extensions/structs/natives.cpp Wed Oct 08 21:02:01 2008 +1300
3.2 +++ b/extensions/structs/natives.cpp Thu Oct 09 13:24:44 2008 +1300
3.3 @@ -31,7 +31,6 @@
3.4
3.5 #include "extension.h"
3.6 #include "utldict.h"
3.7 -#include "weapon_parse.h"
3.8
3.9 class FileWeaponInfo_t;
3.10 typedef unsigned short WEAPON_FILE_INFO_HANDLE;
4.1 --- a/plugins/include/mapchooser.inc Wed Oct 08 21:02:01 2008 +1300
4.2 +++ b/plugins/include/mapchooser.inc Thu Oct 09 13:24:44 2008 +1300
4.3 @@ -73,7 +73,7 @@
4.4 * Called when mapchooser removes a nomination from its list.
4.5 * Nominations cleared on map start will not trigger this forward
4.6 */
4.7 -forward OnNominationRemoved(String:map[], owner);
4.8 +forward OnNominationRemoved(const String:map[], owner);
4.9
4.10
4.11 public SharedPlugin:__pl_mapchooser =
5.1 --- a/plugins/nominations.sp Wed Oct 08 21:02:01 2008 +1300
5.2 +++ b/plugins/nominations.sp Thu Oct 09 13:24:44 2008 +1300
5.3 @@ -52,6 +52,14 @@
5.4 new Handle:g_MapMenu = INVALID_HANDLE;
5.5 new g_mapFileSerial = -1;
5.6
5.7 +#define MAPSTATUS_ENABLED (1<<0)
5.8 +#define MAPSTATUS_DISABLED (1<<1)
5.9 +#define MAPSTATUS_EXCLUDE_CURRENT (1<<2)
5.10 +#define MAPSTATUS_EXCLUDE_PREVIOUS (1<<3)
5.11 +#define MAPSTATUS_EXCLUDE_NOMINATED (1<<4)
5.12 +
5.13 +new Handle:g_mapTrie;
5.14 +
5.15 public OnPluginStart()
5.16 {
5.17 LoadTranslations("common.phrases");
5.18 @@ -69,6 +77,8 @@
5.19 RegConsoleCmd("sm_nominate", Command_Nominate);
5.20
5.21 RegAdminCmd("sm_nominate_addmap", Command_Addmap, ADMFLAG_CHANGEMAP, "sm_nominate_addmap <mapname> - Forces a map to be on the next mapvote.");
5.22 +
5.23 + g_mapTrie = CreateTrie();
5.24 }
5.25
5.26 public OnConfigsExecuted()
5.27 @@ -88,9 +98,23 @@
5.28 BuildMapMenu();
5.29 }
5.30
5.31 -public OnNominationRemoved(String:map[], owner)
5.32 +public OnNominationRemoved(/* const */String:map[], owner)
5.33 {
5.34 - AddMenuItem(g_MapMenu, map, map);
5.35 + new status;
5.36 +
5.37 + /* Is the map in our list? */
5.38 + if (!GetTrieValue(g_mapTrie, map, status))
5.39 + {
5.40 + return;
5.41 + }
5.42 +
5.43 + /* Was the map disabled due to being nominated */
5.44 + if ((status & MAPSTATUS_EXCLUDE_NOMINATED) != MAPSTATUS_EXCLUDE_NOMINATED)
5.45 + {
5.46 + return;
5.47 + }
5.48 +
5.49 + SetTrieValue(g_mapTrie, map, MAPSTATUS_ENABLED);
5.50 }
5.51
5.52 public Action:Command_Addmap(client, args)
5.53 @@ -104,10 +128,12 @@
5.54 decl String:mapname[64];
5.55 GetCmdArg(1, mapname, sizeof(mapname));
5.56
5.57 - if (FindStringInArray(g_MapList, mapname) == -1)
5.58 +
5.59 + new status;
5.60 + if (!GetTrieValue(g_mapTrie, mapname, status))
5.61 {
5.62 ReplyToCommand(client, "%t", "Map was not found", mapname);
5.63 - return Plugin_Handled;
5.64 + return Plugin_Handled;
5.65 }
5.66
5.67 new NominateResult:result = NominateMap(mapname, true, 0);
5.68 @@ -120,16 +146,9 @@
5.69 return Plugin_Handled;
5.70 }
5.71
5.72 - decl String:item[64];
5.73 - for (new i = 0; i < GetMenuItemCount(g_MapMenu); i++)
5.74 - {
5.75 - GetMenuItem(g_MapMenu, i, item, sizeof(item));
5.76 - if (strcmp(item, mapname) == 0)
5.77 - {
5.78 - RemoveMenuItem(g_MapMenu, i);
5.79 - break;
5.80 - }
5.81 - }
5.82 +
5.83 + SetTrieValue(g_mapTrie, mapname, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED);
5.84 +
5.85
5.86 ReplyToCommand(client, "%t", "Map Inserted", mapname);
5.87 LogAction(client, -1, "\"%L\" inserted map \"%s\".", client, mapname);
5.88 @@ -185,41 +204,58 @@
5.89 decl String:mapname[64];
5.90 GetCmdArg(1, mapname, sizeof(mapname));
5.91
5.92 - decl String:item[64];
5.93 - for (new i = 0; i < GetMenuItemCount(g_MapMenu); i++)
5.94 + new status;
5.95 + if (!GetTrieValue(g_mapTrie, mapname, status))
5.96 {
5.97 - GetMenuItem(g_MapMenu, i, item, sizeof(item));
5.98 - if (strcmp(item, mapname) == 0)
5.99 - {
5.100 - new NominateResult:result = NominateMap(mapname, false, client);
5.101 -
5.102 - if (result > Nominate_Replaced)
5.103 - {
5.104 - if (result == Nominate_AlreadyInVote)
5.105 - {
5.106 - ReplyToCommand(client, "%t", "Map Already In Vote", mapname);
5.107 - }
5.108 - else
5.109 - {
5.110 - ReplyToCommand(client, "[SM] %t", "Map Already Nominated");
5.111 - }
5.112 -
5.113 - return Plugin_Handled;
5.114 - }
5.115 -
5.116 - RemoveMenuItem(g_MapMenu, i);
5.117 -
5.118 - decl String:name[64];
5.119 - GetClientName(client, name, sizeof(name));
5.120 -
5.121 - PrintToChatAll("[SM] %t", "Map Nominated", name, mapname);
5.122 -
5.123 - return Plugin_Continue;
5.124 - }
5.125 + ReplyToCommand(client, "%t", "Map was not found", mapname);
5.126 + return Plugin_Handled;
5.127 }
5.128
5.129 - ReplyToCommand(client, "%t", "Map was not found", mapname);
5.130 - return Plugin_Handled;
5.131 + if ((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED)
5.132 + {
5.133 + if ((status & MAPSTATUS_EXCLUDE_CURRENT) == MAPSTATUS_EXCLUDE_CURRENT)
5.134 + {
5.135 + ReplyToCommand(client, "[SM] %t", "Can't Nominate Current Map");
5.136 + }
5.137 +
5.138 + if ((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS)
5.139 + {
5.140 + ReplyToCommand(client, "[SM] %t", "Map in Exclude List");
5.141 + }
5.142 +
5.143 + if ((status & MAPSTATUS_EXCLUDE_NOMINATED) == MAPSTATUS_EXCLUDE_NOMINATED)
5.144 + {
5.145 + ReplyToCommand(client, "[SM] %t", "Map Already Nominated");
5.146 + }
5.147 +
5.148 + return Plugin_Handled;
5.149 + }
5.150 +
5.151 + new NominateResult:result = NominateMap(mapname, false, client);
5.152 +
5.153 + if (result > Nominate_Replaced)
5.154 + {
5.155 + if (result == Nominate_AlreadyInVote)
5.156 + {
5.157 + ReplyToCommand(client, "%t", "Map Already In Vote", mapname);
5.158 + }
5.159 + else
5.160 + {
5.161 + ReplyToCommand(client, "[SM] %t", "Map Already Nominated");
5.162 + }
5.163 +
5.164 + return Plugin_Handled;
5.165 + }
5.166 +
5.167 + /* Map was nominated! - Disable the menu item and update the trie */
5.168 +
5.169 + SetTrieValue(g_mapTrie, mapname, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED);
5.170 +
5.171 + decl String:name[64];
5.172 + GetClientName(client, name, sizeof(name));
5.173 + PrintToChatAll("[SM] %t", "Map Nominated", name, mapname);
5.174 +
5.175 + return Plugin_Continue;
5.176 }
5.177
5.178 AttemptNominate(client)
5.179 @@ -238,7 +274,9 @@
5.180 g_MapMenu = INVALID_HANDLE;
5.181 }
5.182
5.183 - g_MapMenu = CreateMenu(Handler_MapSelectMenu);
5.184 + ClearTrie(g_mapTrie);
5.185 +
5.186 + g_MapMenu = CreateMenu(Handler_MapSelectMenu, MENU_ACTIONS_DEFAULT|MenuAction_DrawItem|MenuAction_DisplayItem);
5.187
5.188 decl String:map[64];
5.189
5.190 @@ -256,27 +294,32 @@
5.191 GetCurrentMap(currentMap, sizeof(currentMap));
5.192 }
5.193
5.194 +
5.195 for (new i = 0; i < GetArraySize(g_MapList); i++)
5.196 {
5.197 - GetArrayString(g_MapList, i, map, sizeof(map));
5.198 + new status = MAPSTATUS_ENABLED;
5.199
5.200 - if (GetConVarBool(g_Cvar_ExcludeOld))
5.201 - {
5.202 - if (FindStringInArray(excludeMaps, map) != -1)
5.203 - {
5.204 - continue;
5.205 - }
5.206 - }
5.207 + GetArrayString(g_MapList, i, map, sizeof(map));
5.208
5.209 if (GetConVarBool(g_Cvar_ExcludeCurrent))
5.210 {
5.211 if (StrEqual(map, currentMap))
5.212 {
5.213 - continue;
5.214 + status = MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_CURRENT;
5.215 + }
5.216 + }
5.217 +
5.218 + /* Dont bother with this check if the current map check passed */
5.219 + if (GetConVarBool(g_Cvar_ExcludeOld) && status == MAPSTATUS_ENABLED)
5.220 + {
5.221 + if (FindStringInArray(excludeMaps, map) != -1)
5.222 + {
5.223 + status = MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_PREVIOUS;
5.224 }
5.225 }
5.226
5.227 AddMenuItem(g_MapMenu, map, map);
5.228 + SetTrieValue(g_mapTrie, map, status);
5.229 }
5.230
5.231 SetMenuExitButton(g_MapMenu, true);
5.232 @@ -289,35 +332,96 @@
5.233 case MenuAction_Select:
5.234 {
5.235 decl String:map[64], String:name[64];
5.236 - GetMenuItem(menu, param2, map, sizeof(map));
5.237 -
5.238 + GetMenuItem(menu, param2, map, sizeof(map));
5.239
5.240 GetClientName(param1, name, 64);
5.241
5.242 -
5.243 new NominateResult:result = NominateMap(map, false, param1);
5.244
5.245 /* Don't need to check for InvalidMap because the menu did that already */
5.246 if (result == Nominate_AlreadyInVote)
5.247 {
5.248 PrintToChat(param1, "[SM] %t", "Map Already Nominated");
5.249 - return;
5.250 + return 0;
5.251 }
5.252 else if (result == Nominate_VoteFull)
5.253 {
5.254 PrintToChat(param1, "[SM] %t", "Max Nominations");
5.255 - return;
5.256 + return 0;
5.257 }
5.258 +
5.259 + SetTrieValue(g_mapTrie, map, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED);
5.260
5.261 - RemoveMenuItem(menu, param2);
5.262 -
5.263 if (result == Nominate_Replaced)
5.264 {
5.265 PrintToChatAll("[SM] %t", "Map Nomination Changed", name, map);
5.266 - return;
5.267 + return 0;
5.268 }
5.269
5.270 PrintToChatAll("[SM] %t", "Map Nominated", name, map);
5.271 }
5.272 +
5.273 + case MenuAction_DrawItem:
5.274 + {
5.275 + decl String:map[64];
5.276 + GetMenuItem(menu, param2, map, sizeof(map));
5.277 +
5.278 + new status;
5.279 +
5.280 + if (!GetTrieValue(g_mapTrie, map, status))
5.281 + {
5.282 + LogError("Menu selection of item not in trie. Major logic problem somewhere.");
5.283 + return ITEMDRAW_DEFAULT;
5.284 + }
5.285 +
5.286 + if ((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED)
5.287 + {
5.288 + return ITEMDRAW_DISABLED;
5.289 + }
5.290 +
5.291 + return ITEMDRAW_DEFAULT;
5.292 +
5.293 + }
5.294 +
5.295 + case MenuAction_DisplayItem:
5.296 + {
5.297 + decl String:map[64];
5.298 + GetMenuItem(menu, param2, map, sizeof(map));
5.299 +
5.300 + new status;
5.301 +
5.302 + if (!GetTrieValue(g_mapTrie, map, status))
5.303 + {
5.304 + LogError("Menu selection of item not in trie. Major logic problem somewhere.");
5.305 + return 0;
5.306 + }
5.307 +
5.308 + decl String:display[100];
5.309 +
5.310 + if ((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED)
5.311 + {
5.312 + if ((status & MAPSTATUS_EXCLUDE_CURRENT) == MAPSTATUS_EXCLUDE_CURRENT)
5.313 + {
5.314 + Format(display, sizeof(display), "%s (%T)", map, "Current Map", param1);
5.315 + return RedrawMenuItem(display);
5.316 + }
5.317 +
5.318 + if ((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS)
5.319 + {
5.320 + Format(display, sizeof(display), "%s (%T)", map, "Recently Played", param1);
5.321 + return RedrawMenuItem(display);
5.322 + }
5.323 +
5.324 + if ((status & MAPSTATUS_EXCLUDE_NOMINATED) == MAPSTATUS_EXCLUDE_NOMINATED)
5.325 + {
5.326 + Format(display, sizeof(display), "%s (%T)", map, "Nominated", param1);
5.327 + return RedrawMenuItem(display);
5.328 + }
5.329 + }
5.330 +
5.331 + return 0;
5.332 + }
5.333 }
5.334 +
5.335 + return 0;
5.336 }
5.337 \ No newline at end of file
6.1 --- a/tools/builder/PkgCore.cs Wed Oct 08 21:02:01 2008 +1300
6.2 +++ b/tools/builder/PkgCore.cs Thu Oct 09 13:24:44 2008 +1300
6.3 @@ -290,6 +290,14 @@
6.4 lib.build_mode = BuildMode.BuildMode_Episode2;
6.5 libraries.Add(lib);
6.6
6.7 + lib = new Library();
6.8 + lib.package_path = "addons/sourcemod/extensions/auto.1.ep1";
6.9 + lib.source_path = "extensions/structs";
6.10 + lib.binary_name = "structs.ext";
6.11 + lib.vcproj_name = "structs";
6.12 + lib.build_mode = BuildMode.BuildMode_OldMetamod;
6.13 + libraries.Add(lib);
6.14 +
6.15 return (Library [])libraries.ToArray(typeof(Library));
6.16 }
6.17