Backed out changeset: 44b02986c01b

Damn you tortoisehg
This commit is contained in:
Matt Woodrow 2008-10-09 13:33:47 +13:00
parent bba2cfc6f7
commit 7009e755fe
6 changed files with 69 additions and 180 deletions

View File

@ -33,7 +33,7 @@
#define _INCLUDE_SOURCEMOD_STRUCT_HANDLE_H_ #define _INCLUDE_SOURCEMOD_STRUCT_HANDLE_H_
#include "Struct.h" #include "Struct.h"
#include "vector.h" #include "mathlib/vector.h"
#include "basehandle.h" #include "basehandle.h"
class StructHandle class StructHandle

View File

@ -361,7 +361,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;&quot;$(HL2SDKOB)\public&quot;;&quot;$(HL2SDKOB)\public\mathlib&quot;;&quot;$(HL2SDKOB)\public\engine&quot;;&quot;$(HL2SDKOB)\public\game\server&quot;;&quot;$(HL2SDKOB)\public\tier0&quot;;&quot;$(HL2SDKOB)\public\tier1&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;;&quot;$(HL2SDKOB)\game\shared&quot;" AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;&quot;$(HL2SDKOB)\public&quot;;&quot;$(HL2SDKOB)\public\engine&quot;;&quot;$(HL2SDKOB)\public\game\server&quot;;&quot;$(HL2SDKOB)\public\tier0&quot;;&quot;$(HL2SDKOB)\public\tier1&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;;&quot;$(HL2SDKOB)\game\shared&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@ -442,7 +442,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;&quot;$(HL2SDKOB)\public&quot;;&quot;$(HL2SDKOB)\public\engine&quot;;&quot;$(HL2SDKOB)\public\mathlib&quot;;&quot;$(HL2SDKOB)\public\game\server&quot;;&quot;$(HL2SDKOB)\public\tier0&quot;;&quot;$(HL2SDKOB)\public\tier1&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;;&quot;$(HL2SDKOB)\game\shared&quot;" AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;&quot;$(HL2SDKOB)\public&quot;;&quot;$(HL2SDKOB)\public\engine&quot;;&quot;$(HL2SDKOB)\public\game\server&quot;;&quot;$(HL2SDKOB)\public\tier0&quot;;&quot;$(HL2SDKOB)\public\tier1&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;;&quot;$(HL2SDKOB)\game\shared&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD"
RuntimeLibrary="0" RuntimeLibrary="0"
EnableEnhancedInstructionSet="1" EnableEnhancedInstructionSet="1"

View File

@ -31,6 +31,7 @@
#include "extension.h" #include "extension.h"
#include "utldict.h" #include "utldict.h"
#include "weapon_parse.h"
class FileWeaponInfo_t; class FileWeaponInfo_t;
typedef unsigned short WEAPON_FILE_INFO_HANDLE; typedef unsigned short WEAPON_FILE_INFO_HANDLE;

View File

@ -73,7 +73,7 @@ native bool:EndOfMapVoteEnabled();
* Called when mapchooser removes a nomination from its list. * Called when mapchooser removes a nomination from its list.
* Nominations cleared on map start will not trigger this forward * Nominations cleared on map start will not trigger this forward
*/ */
forward OnNominationRemoved(const String:map[], owner); forward OnNominationRemoved(String:map[], owner);
public SharedPlugin:__pl_mapchooser = public SharedPlugin:__pl_mapchooser =

View File

@ -52,14 +52,6 @@ new Handle:g_MapList = INVALID_HANDLE;
new Handle:g_MapMenu = INVALID_HANDLE; new Handle:g_MapMenu = INVALID_HANDLE;
new g_mapFileSerial = -1; new g_mapFileSerial = -1;
#define MAPSTATUS_ENABLED (1<<0)
#define MAPSTATUS_DISABLED (1<<1)
#define MAPSTATUS_EXCLUDE_CURRENT (1<<2)
#define MAPSTATUS_EXCLUDE_PREVIOUS (1<<3)
#define MAPSTATUS_EXCLUDE_NOMINATED (1<<4)
new Handle:g_mapTrie;
public OnPluginStart() public OnPluginStart()
{ {
LoadTranslations("common.phrases"); LoadTranslations("common.phrases");
@ -77,8 +69,6 @@ public OnPluginStart()
RegConsoleCmd("sm_nominate", Command_Nominate); RegConsoleCmd("sm_nominate", Command_Nominate);
RegAdminCmd("sm_nominate_addmap", Command_Addmap, ADMFLAG_CHANGEMAP, "sm_nominate_addmap <mapname> - Forces a map to be on the next mapvote."); RegAdminCmd("sm_nominate_addmap", Command_Addmap, ADMFLAG_CHANGEMAP, "sm_nominate_addmap <mapname> - Forces a map to be on the next mapvote.");
g_mapTrie = CreateTrie();
} }
public OnConfigsExecuted() public OnConfigsExecuted()
@ -98,23 +88,9 @@ public OnConfigsExecuted()
BuildMapMenu(); BuildMapMenu();
} }
public OnNominationRemoved(/* const */String:map[], owner) public OnNominationRemoved(String:map[], owner)
{ {
new status; AddMenuItem(g_MapMenu, map, map);
/* Is the map in our list? */
if (!GetTrieValue(g_mapTrie, map, status))
{
return;
}
/* Was the map disabled due to being nominated */
if ((status & MAPSTATUS_EXCLUDE_NOMINATED) != MAPSTATUS_EXCLUDE_NOMINATED)
{
return;
}
SetTrieValue(g_mapTrie, map, MAPSTATUS_ENABLED);
} }
public Action:Command_Addmap(client, args) public Action:Command_Addmap(client, args)
@ -128,12 +104,10 @@ public Action:Command_Addmap(client, args)
decl String:mapname[64]; decl String:mapname[64];
GetCmdArg(1, mapname, sizeof(mapname)); GetCmdArg(1, mapname, sizeof(mapname));
if (FindStringInArray(g_MapList, mapname) == -1)
new status;
if (!GetTrieValue(g_mapTrie, mapname, status))
{ {
ReplyToCommand(client, "%t", "Map was not found", mapname); ReplyToCommand(client, "%t", "Map was not found", mapname);
return Plugin_Handled; return Plugin_Handled;
} }
new NominateResult:result = NominateMap(mapname, true, 0); new NominateResult:result = NominateMap(mapname, true, 0);
@ -146,9 +120,16 @@ public Action:Command_Addmap(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
decl String:item[64];
SetTrieValue(g_mapTrie, mapname, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED); for (new i = 0; i < GetMenuItemCount(g_MapMenu); i++)
{
GetMenuItem(g_MapMenu, i, item, sizeof(item));
if (strcmp(item, mapname) == 0)
{
RemoveMenuItem(g_MapMenu, i);
break;
}
}
ReplyToCommand(client, "%t", "Map Inserted", mapname); ReplyToCommand(client, "%t", "Map Inserted", mapname);
LogAction(client, -1, "\"%L\" inserted map \"%s\".", client, mapname); LogAction(client, -1, "\"%L\" inserted map \"%s\".", client, mapname);
@ -204,58 +185,41 @@ public Action:Command_Nominate(client, args)
decl String:mapname[64]; decl String:mapname[64];
GetCmdArg(1, mapname, sizeof(mapname)); GetCmdArg(1, mapname, sizeof(mapname));
new status; decl String:item[64];
if (!GetTrieValue(g_mapTrie, mapname, status)) for (new i = 0; i < GetMenuItemCount(g_MapMenu); i++)
{ {
ReplyToCommand(client, "%t", "Map was not found", mapname); GetMenuItem(g_MapMenu, i, item, sizeof(item));
return Plugin_Handled; if (strcmp(item, mapname) == 0)
{
new NominateResult:result = NominateMap(mapname, false, client);
if (result > Nominate_Replaced)
{
if (result == Nominate_AlreadyInVote)
{
ReplyToCommand(client, "%t", "Map Already In Vote", mapname);
}
else
{
ReplyToCommand(client, "[SM] %t", "Map Already Nominated");
}
return Plugin_Handled;
}
RemoveMenuItem(g_MapMenu, i);
decl String:name[64];
GetClientName(client, name, sizeof(name));
PrintToChatAll("[SM] %t", "Map Nominated", name, mapname);
return Plugin_Continue;
}
} }
if ((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED) ReplyToCommand(client, "%t", "Map was not found", mapname);
{ return Plugin_Handled;
if ((status & MAPSTATUS_EXCLUDE_CURRENT) == MAPSTATUS_EXCLUDE_CURRENT)
{
ReplyToCommand(client, "[SM] %t", "Can't Nominate Current Map");
}
if ((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS)
{
ReplyToCommand(client, "[SM] %t", "Map in Exclude List");
}
if ((status & MAPSTATUS_EXCLUDE_NOMINATED) == MAPSTATUS_EXCLUDE_NOMINATED)
{
ReplyToCommand(client, "[SM] %t", "Map Already Nominated");
}
return Plugin_Handled;
}
new NominateResult:result = NominateMap(mapname, false, client);
if (result > Nominate_Replaced)
{
if (result == Nominate_AlreadyInVote)
{
ReplyToCommand(client, "%t", "Map Already In Vote", mapname);
}
else
{
ReplyToCommand(client, "[SM] %t", "Map Already Nominated");
}
return Plugin_Handled;
}
/* Map was nominated! - Disable the menu item and update the trie */
SetTrieValue(g_mapTrie, mapname, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED);
decl String:name[64];
GetClientName(client, name, sizeof(name));
PrintToChatAll("[SM] %t", "Map Nominated", name, mapname);
return Plugin_Continue;
} }
AttemptNominate(client) AttemptNominate(client)
@ -274,9 +238,7 @@ BuildMapMenu()
g_MapMenu = INVALID_HANDLE; g_MapMenu = INVALID_HANDLE;
} }
ClearTrie(g_mapTrie); g_MapMenu = CreateMenu(Handler_MapSelectMenu);
g_MapMenu = CreateMenu(Handler_MapSelectMenu, MENU_ACTIONS_DEFAULT|MenuAction_DrawItem|MenuAction_DisplayItem);
decl String:map[64]; decl String:map[64];
@ -294,32 +256,27 @@ BuildMapMenu()
GetCurrentMap(currentMap, sizeof(currentMap)); GetCurrentMap(currentMap, sizeof(currentMap));
} }
for (new i = 0; i < GetArraySize(g_MapList); i++) for (new i = 0; i < GetArraySize(g_MapList); i++)
{ {
new status = MAPSTATUS_ENABLED;
GetArrayString(g_MapList, i, map, sizeof(map)); GetArrayString(g_MapList, i, map, sizeof(map));
if (GetConVarBool(g_Cvar_ExcludeOld))
{
if (FindStringInArray(excludeMaps, map) != -1)
{
continue;
}
}
if (GetConVarBool(g_Cvar_ExcludeCurrent)) if (GetConVarBool(g_Cvar_ExcludeCurrent))
{ {
if (StrEqual(map, currentMap)) if (StrEqual(map, currentMap))
{ {
status = MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_CURRENT; continue;
}
}
/* Dont bother with this check if the current map check passed */
if (GetConVarBool(g_Cvar_ExcludeOld) && status == MAPSTATUS_ENABLED)
{
if (FindStringInArray(excludeMaps, map) != -1)
{
status = MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_PREVIOUS;
} }
} }
AddMenuItem(g_MapMenu, map, map); AddMenuItem(g_MapMenu, map, map);
SetTrieValue(g_mapTrie, map, status);
} }
SetMenuExitButton(g_MapMenu, true); SetMenuExitButton(g_MapMenu, true);
@ -332,96 +289,35 @@ public Handler_MapSelectMenu(Handle:menu, MenuAction:action, param1, param2)
case MenuAction_Select: case MenuAction_Select:
{ {
decl String:map[64], String:name[64]; decl String:map[64], String:name[64];
GetMenuItem(menu, param2, map, sizeof(map)); GetMenuItem(menu, param2, map, sizeof(map));
GetClientName(param1, name, 64); GetClientName(param1, name, 64);
new NominateResult:result = NominateMap(map, false, param1); new NominateResult:result = NominateMap(map, false, param1);
/* Don't need to check for InvalidMap because the menu did that already */ /* Don't need to check for InvalidMap because the menu did that already */
if (result == Nominate_AlreadyInVote) if (result == Nominate_AlreadyInVote)
{ {
PrintToChat(param1, "[SM] %t", "Map Already Nominated"); PrintToChat(param1, "[SM] %t", "Map Already Nominated");
return 0; return;
} }
else if (result == Nominate_VoteFull) else if (result == Nominate_VoteFull)
{ {
PrintToChat(param1, "[SM] %t", "Max Nominations"); PrintToChat(param1, "[SM] %t", "Max Nominations");
return 0; return;
} }
SetTrieValue(g_mapTrie, map, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED);
RemoveMenuItem(menu, param2);
if (result == Nominate_Replaced) if (result == Nominate_Replaced)
{ {
PrintToChatAll("[SM] %t", "Map Nomination Changed", name, map); PrintToChatAll("[SM] %t", "Map Nomination Changed", name, map);
return 0; return;
} }
PrintToChatAll("[SM] %t", "Map Nominated", name, map); PrintToChatAll("[SM] %t", "Map Nominated", name, map);
} }
case MenuAction_DrawItem:
{
decl String:map[64];
GetMenuItem(menu, param2, map, sizeof(map));
new status;
if (!GetTrieValue(g_mapTrie, map, status))
{
LogError("Menu selection of item not in trie. Major logic problem somewhere.");
return ITEMDRAW_DEFAULT;
}
if ((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED)
{
return ITEMDRAW_DISABLED;
}
return ITEMDRAW_DEFAULT;
}
case MenuAction_DisplayItem:
{
decl String:map[64];
GetMenuItem(menu, param2, map, sizeof(map));
new status;
if (!GetTrieValue(g_mapTrie, map, status))
{
LogError("Menu selection of item not in trie. Major logic problem somewhere.");
return 0;
}
decl String:display[100];
if ((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED)
{
if ((status & MAPSTATUS_EXCLUDE_CURRENT) == MAPSTATUS_EXCLUDE_CURRENT)
{
Format(display, sizeof(display), "%s (%T)", map, "Current Map", param1);
return RedrawMenuItem(display);
}
if ((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS)
{
Format(display, sizeof(display), "%s (%T)", map, "Recently Played", param1);
return RedrawMenuItem(display);
}
if ((status & MAPSTATUS_EXCLUDE_NOMINATED) == MAPSTATUS_EXCLUDE_NOMINATED)
{
Format(display, sizeof(display), "%s (%T)", map, "Nominated", param1);
return RedrawMenuItem(display);
}
}
return 0;
}
} }
return 0;
} }

View File

@ -290,14 +290,6 @@ namespace builder
lib.build_mode = BuildMode.BuildMode_Episode2; lib.build_mode = BuildMode.BuildMode_Episode2;
libraries.Add(lib); libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/extensions/auto.1.ep1";
lib.source_path = "extensions/structs";
lib.binary_name = "structs.ext";
lib.vcproj_name = "structs";
lib.build_mode = BuildMode.BuildMode_OldMetamod;
libraries.Add(lib);
return (Library [])libraries.ToArray(typeof(Library)); return (Library [])libraries.ToArray(typeof(Library));
} }