sourcemod/public
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
..
amtl@9472470b1a Update SourcePawn and AMTL 2021-07-01 22:40:03 +01:00
asm Fix warning/error on newer Clang versions from abort not being defined. 2018-05-06 10:28:24 -04:00
CDetour Handle detour patches across page boundaries (#1535) 2021-07-17 20:53:25 +01:00
doxygen Spring Cleaning, Part Ichi (1) 2008-03-30 07:00:22 +00:00
extensions Remove OnEntitySpawned C++ listener (#1342) 2020-08-26 12:53:31 +01:00
jit 64-bit support for CSGO on Linux and macOS (#705) 2017-12-20 01:56:23 -06:00
libudis86 64-bit support for CSGO on Linux and macOS (#705) 2017-12-20 01:56:23 -06:00
mms_sample_ext Fixed build error in mms_sample_ext from cset d17aed3d46bf (r=psychonic). 2013-03-16 23:02:36 -04:00
sample_ext Add sdk'less sample_ext and update -std to 14 (#1456) 2021-03-29 22:12:45 +01:00
sample_ext_nosdk Add sdk'less sample_ext and update -std to 14 (#1456) 2021-03-29 22:12:45 +01:00
AutoHandleRooter.h Move scared guts of core into logic (bug 5680, r=fyren). 2013-03-29 11:37:29 -07:00
compat_wrappers.h Remove support for Source 1 Dota 2. (#496) 2016-04-26 23:18:47 -04:00
IAdminSystem.h Move adminsys and more natives from core to logic. 2014-05-29 13:31:12 -04:00
IADTFactory.h Switch ADTFactory/IBasicTrie off KTrie (bug 5884 part 17, r=ds). 2013-08-25 12:21:15 -07:00
ICellArray.h Add ICellArray and create/free in ISourceMod 2016-08-21 21:32:23 +02:00
IDBDriver.h Add atomic reference counting and port DBI (bug 5876 part 3, r=ds). 2013-08-23 00:18:13 -07:00
IExtensionSys.h Fix Miscellaneous Regressions and UBs (#1022) 2019-05-28 18:04:08 -07:00
IForwardSys.h Don't break backwards compatibility with unmanaged forwards 2017-08-25 23:23:50 +02:00
IGameConfigs.h Make IGameConfig::GetMemSig return value clearer (bug 6081, r=asherkin). 2014-03-29 14:22:53 -04:00
IGameHelpers.h Add support for retrieving game server Steam Id (bug 6404). (#495) 2016-04-26 23:17:08 -04:00
IHandleSys.h Move scared guts of core into logic (bug 5680, r=fyren). 2013-03-29 11:37:29 -07:00
ILibrarySys.h Move scared guts of core into logic (bug 5680, r=fyren). 2013-03-29 11:37:29 -07:00
IMemoryUtils.h Add support for Mac OS X to ResolveSymbol() and FindPattern() in IMemUtils (bug 4392, r=dvander). 2010-05-13 04:20:41 -05:00
IMenuManager.h menusys: add MenuShufflePerClient native (#1073) 2020-08-06 20:31:00 -07:00
IPlayerHelpers.h Unify Player::GetSteamXId returns, clarify doc, and fix checks 2014-09-09 17:57:54 -07:00
IPluginSys.h Add an OnPluginWillUnload callback that precedes OnPluginEnd(). 2015-11-01 00:30:37 -07:00
IRootConsoleMenu.h Replace the AddRootConsoleCommand API to not expose internal structures. 2015-08-30 21:01:03 -07:00
IShareSys.h Remove native override API (bug 5852 part 1, r=ds). 2013-08-30 10:10:57 -07:00
ISourceMod.h Burninate IDataPack (#864) 2018-08-13 23:03:48 +01:00
ITextParsers.h Added an SMC stream reader to ITextParser (bug 3530, r=pred). 2009-02-01 20:31:27 -05:00
IThreader.h Pare down ThreadSupport and remove ancient thread code. 2020-05-13 00:35:29 -07:00
ITimerSystem.h Move timer natives into logic binary (bug 4402, r=ds). 2010-05-13 01:47:12 -07:00
ITranslator.h Add Translation Natives (#669) 2017-11-20 21:24:01 -08:00
IUserMessages.h Added initial support for protobuf usermessages on CS:GO (bug 5579, r=asherkin). 2013-01-22 21:43:12 -05:00
metamod_wrappers.h Spring Cleaning, Part Ichi (1) 2008-03-30 07:00:22 +00:00
ReentrantList.h Replace ke::LinkedList with std::list. 2020-05-31 23:19:41 -07:00
sm_argbuffer.h Fix ArgBuffer String Serialization (#999) 2019-05-04 01:46:55 -07:00
sm_invalidparamhandler.h handlesys: Output allocation timestamp during panic (#1110) 2020-07-09 18:21:45 -07:00
sm_memtable.h Deduplicate a number of files used by extensions by moving them to the public directory (bug 5341, r=psychonic). 2014-04-23 21:19:28 -05:00
sm_namehashset.h Make all command lookups case-insensitive (#1542) 2021-07-18 19:05:06 +01:00
sm_platform.h handlesys: Output allocation timestamp during panic (#1110) 2020-07-09 18:21:45 -07:00
sm_queue.h Move DBManager and DB natives from core to logic (bug 5953, r=fyren). 2013-10-09 08:43:08 -04:00
sm_stringhashmap.h Replace AString with std::string. 2020-05-20 17:57:18 -07:00
sm_trie_tpl.h trie: implement clone() method (#852) 2020-07-14 20:11:23 -07:00
smsdk_ext.cpp Migrate extensions to common AMTL string funcs (#785) 2018-03-25 13:00:53 -07:00
smsdk_ext.h Migrate extensions to common AMTL string funcs (#785) 2018-03-25 13:00:53 -07:00
sourcemod_version.h Bump version for non-VCS builds (#1243) 2020-04-27 15:50:03 +01:00
vtable_hook_helper.h Change SDKHooks to VTable Hooks (bug 6070, r=psychonic). 2014-03-23 22:11:06 -06:00