sourcemod/core
Asher Baker 2d241316c7
Make all command lookups case-insensitive (#1542)
SM internally maintained both a case-sensitive and a case-insensitive
lookup method for commands, where the case-sensitive hashmap was used as
a fast path, and case-insensitive iteration over a list used as the slow
path if a command was not found in the hashmap. But only command
dispatch handling used this dual path approach, chat triggers for
example only did a loopup in the hashmap.

Over the years Valve has made more and more of the command dispatch
logic case-insensitive to the point where all console commands are now
case-insensitive, so maintaining case sensitivity when using chat
triggers does not make a lot of sense. There are somewhat popular
plugins that attempt to "correct" this behaviour - but at least one is
having issues after the previous case-sensitivity fixes for commands -
see #1480.

We still have to keep the list around for the sorted help use case and
command iteration, but this PR changes the hashmap to use a
case-insensitive hashing policy (as previously done for convars, and
more recently for game command lookup) and changes all by-name lookup to
exclusively use the hashmap (as there is no need to fall back to the
list any more).

Tested a bunch in TF2, I don't know of any games that still have a
case-sensitive command dispatch pipeline to test. I think the worst case
would be that we'd accept a chat command in the "wrong" case then fail
to execute the underlying command. If that turns out to be an issue in
practice, we should be able to fix it easily enough by replacing the
command name in the buffer with the correct casing of the command we
looked up.

Also fixed a couple of very minor Lookup vs. Key issues in NameHashSet
(noted in #1529) that were being masked due to CharsAndLength's
converting constructor. I tried to make the constructor explicit to
avoid this happening in the future but HashTable's add function relies
on being able to do an implicit conversion so that wasn't possible. We
might want to just rely on the implicit conversion up here as well, but
it doesn't really matter either way.

Fixes #1480, #1529
2021-07-18 19:05:06 +01:00
..
logic Fix crash in FrameIterator. 2021-07-16 18:33:10 -07:00
AMBuilder Remove use of the Dep API. 2020-08-24 20:48:57 -07:00
CellRecipientFilter.h Remove support for Source 1 Dota 2. (#496) 2016-04-26 23:18:47 -04:00
ChatTriggers.cpp Make all command lookups case-insensitive (#1542) 2021-07-18 19:05:06 +01:00
ChatTriggers.h Replace ke::Vector with std::vector. 2020-05-31 11:35:51 -07:00
command_args.h Move CCommandArgs into its own header. 2015-08-31 00:07:37 -07:00
concmd_cleaner.cpp Fix unnecessary ConCommand cache misses (#1256) 2020-05-08 15:28:45 -07:00
concmd_cleaner.h Remove bad-console-read protection logic for Metamod:Source 1.7 and earlier. 2015-09-09 18:59:31 -07:00
ConCmdManager.cpp Make all command lookups case-insensitive (#1542) 2021-07-18 19:05:06 +01:00
ConCmdManager.h Make all command lookups case-insensitive (#1542) 2021-07-18 19:05:06 +01:00
ConCommandBaseIterator.h Added support for Alien Swarm (bug 4530, r=dvander). 2010-07-27 17:32:32 -05:00
ConsoleDetours.cpp Update AMTL; replace AutoPtr/UniquePtr with STL. 2020-05-18 18:19:16 -07:00
ConsoleDetours.h Move ConCommand hooks into GameHooks and switch callbacks to ICommandArgs. 2015-09-09 18:40:04 -07:00
ConVarManager.cpp Track the creating plugin for convars (#1537) 2021-07-18 17:19:27 +01:00
ConVarManager.h Track the creating plugin for convars (#1537) 2021-07-18 17:19:27 +01:00
CoreConfig.cpp Replace AString with std::string. 2020-05-20 17:57:18 -07:00
CoreConfig.h Replace AString with std::string. 2020-05-20 17:57:18 -07:00
EventManager.cpp Replace AString with std::string. 2020-05-20 17:57:18 -07:00
EventManager.h Replace AString with std::string. 2020-05-20 17:57:18 -07:00
frame_hooks.cpp Move DBManager and DB natives from core to logic (bug 5953, r=fyren). 2013-10-09 08:43:08 -04:00
frame_hooks.h Initial import of updater extension, currently incomplete - just getting it in the tree (bug 3530). 2009-02-02 15:41:25 -05:00
GameHooks.cpp Replace ke::Vector with std::vector. 2020-05-31 11:35:51 -07:00
GameHooks.h Replace ke::Vector with std::vector. 2020-05-31 11:35:51 -07:00
HalfLife2.cpp core: Add support for networked CUtlVector (#1330) 2020-08-06 19:15:20 -07:00
HalfLife2.h Add string_t SetEntPropString support for ep1 (fixes #1287) 2020-06-25 21:20:56 -04:00
Logger.cpp Split intercom.h into separate headers and reduce shared header inclusion. 2015-08-31 10:00:49 -07:00
Logger.h Move Logger and Core natives to Logic 2014-08-13 14:24:35 -07:00
logic_bridge.cpp Fix matchmaking_ds for gamedata (#1504) 2021-06-24 14:00:59 +00:00
logic_bridge.h Split intercom.h into separate headers and reduce shared header inclusion. 2015-08-31 10:00:49 -07:00
MenuManager.cpp menusys: add MenuShufflePerClient native (#1073) 2020-08-06 20:31:00 -07:00
MenuManager.h Remove MenuManager use of memtables (bug 5899 part 2, r=fyren). 2013-08-31 11:50:28 -07:00
MenuStyle_Base.cpp Fix not working MENU_DEBUG (#1506) 2021-06-21 12:11:35 +01:00
MenuStyle_Base.h menusys: add MenuShufflePerClient native (#1073) 2020-08-06 20:31:00 -07:00
MenuStyle_Radio.cpp Fix not working MENU_DEBUG (#1506) 2021-06-21 12:11:35 +01:00
MenuStyle_Radio.h Root Menu Handles during Display. 2015-02-21 17:10:26 -08:00
MenuStyle_Valve.cpp Remove support for Source 1 Dota 2. (#496) 2016-04-26 23:18:47 -04:00
MenuStyle_Valve.h Root Menu Handles during Display. 2015-02-21 17:10:26 -08:00
MenuVoting.cpp menusys: add MenuShufflePerClient native (#1073) 2020-08-06 20:31:00 -07:00
MenuVoting.h Added voting output (bug 1997, r=dvander) 2009-09-17 18:54:40 +12:00
NextMap.cpp Cleanly remove all hooks on extension unload 2020-12-16 15:52:48 +01:00
NextMap.h Remove support for Source 1 Dota 2. (#496) 2016-04-26 23:18:47 -04:00
pb_handle.cpp Introduce a pbproxy library to solve macOS linker issues. 2020-05-30 22:13:07 -07:00
pb_handle.h Fix use-after-free when creating custom user messages 2020-06-23 10:32:55 -07:00
pb_proxy.cpp Introduce a pbproxy library to solve macOS linker issues. 2020-05-30 22:13:07 -07:00
pb_proxy.h Introduce a pbproxy library to solve macOS linker issues. 2020-05-30 22:13:07 -07:00
PlayerManager.cpp Update credits (#1367) 2020-10-16 21:41:21 +01:00
PlayerManager.h Update AMTL, replace ke::Deque with std::deque. 2020-05-30 12:44:02 -07:00
provider.h Replace ke::Vector with std::vector. 2020-05-31 11:35:51 -07:00
sm_autonatives.cpp Move scared guts of core into logic (bug 5680, r=fyren). 2013-03-29 11:37:29 -07:00
sm_autonatives.h Move scared guts of core into logic (bug 5680, r=fyren). 2013-03-29 11:37:29 -07:00
sm_convar.h Out with the old ConVar accessibility hacks, in with the new. 2018-05-06 12:59:33 -04:00
sm_fastlink.h Added detection for clang compiler and fixed various warnings triggered by it (bug 4878, r=dvander). 2011-04-23 21:53:53 -05:00
sm_globals.h Add support for retrieving game server Steam Id (bug 6404). (#495) 2016-04-26 23:17:08 -04:00
sm_memtable.h Refactor Trie natives to use HashMap instead of KTrie; add iteration API (bug 5892, r=ds). 2013-08-29 10:09:02 -07:00
sm_stringutil.cpp Remove blanket includes from sm_stringutil. 2015-09-09 15:18:24 -07:00
sm_stringutil.h Remove blanket includes from sm_stringutil. 2015-09-09 15:18:24 -07:00
smn_bitbuffer.cpp Implement a new stack and error handling model for the SourcePawn VM. 2015-03-04 23:45:30 -08:00
smn_commandline.cpp Fix default value always being when calling ParmValue(string,string). 2017-04-22 21:28:44 -04:00
smn_console.cpp Track the creating plugin for convars (#1537) 2021-07-18 17:19:27 +01:00
smn_entities.cpp Fix reading/writing string_t array netprops (#1538) 2021-07-18 02:01:46 +01:00
smn_events.cpp Add getter for Event.BroadcastDisabled (#946) 2019-01-03 19:42:42 +00:00
smn_halflife.cpp Revert "csgo: enable SayText + raise msg limits (#1118)" (#1209) 2020-03-08 13:27:13 +00:00
smn_hudtext.cpp Update for latest Blade Symphony SDK 2020-03-11 22:36:25 +00:00
smn_keyvalues.cpp Add Cookie methodmap (#1012) 2019-05-30 18:27:14 -07:00
smn_keyvalues.h Add KeyValues.ExportToString (#706) 2017-10-28 12:47:00 +01:00
smn_nextmap.cpp - Added ForceChangeLevel and Map History to nextmap api 2008-07-13 05:13:37 +00:00
smn_player.cpp Move adminsys and more natives from core to logic. 2014-05-29 13:31:12 -04:00
smn_protobuf.cpp pb: Add natives to work with 64 bit values (#943) 2019-03-04 09:06:43 -08:00
smn_usermsgs.cpp Remove support for Source 1 Dota 2. (#496) 2016-04-26 23:18:47 -04:00
smn_usermsgs.h Added initial support for protobuf usermessages on CS:GO (bug 5579, r=asherkin). 2013-01-22 21:43:12 -05:00
smn_vector.cpp Added preliminary support for Left 4 Dead; some things may not yet work. 2008-11-14 09:18:30 -06:00
sourcemm_api.cpp Migrate extensions to common AMTL string funcs (#785) 2018-03-25 13:00:53 -07:00
sourcemm_api.h Out with the old ConVar accessibility hacks, in with the new. 2018-05-06 12:59:33 -04:00
sourcemod.cpp Add OnMapInit forward and deprecate OnLevelInit 2021-07-17 20:52:51 +01:00
sourcemod.h Burninate IDataPack (#864) 2018-08-13 23:03:48 +01:00
TimerSys.cpp Fix timelimit not correct for Black Mesa (#1262) 2020-05-06 22:59:43 +00:00
TimerSys.h Move scared guts of core into logic (bug 5680, r=fyren). 2013-03-29 11:37:29 -07:00
UserMessagePBHelpers.h Update for latest Blade Symphony SDK 2020-03-11 22:36:25 +00:00
UserMessages.cpp Fix use-after-free when creating custom user messages 2020-06-23 10:32:55 -07:00
UserMessages.h Introduce a pbproxy library to solve macOS linker issues. 2020-05-30 22:13:07 -07:00
version.rc Overhauled versioning information (bug 5453, r=dvander). 2012-08-26 01:33:54 +01:00
vprof_tool.cpp Add a command to dump profiling output. 2014-08-09 13:32:05 -05:00
vprof_tool.h Update to the latest AMTL version. 2015-08-27 01:01:18 -04:00