Commit Graph

37 Commits

Author SHA1 Message Date
Corey D
3b4a343274
Add natives to get chat triggers (#1816) 2022-12-02 13:55:32 +01:00
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
David Anderson
5d94f0bea8 Replace ke::Vector with std::vector. 2020-05-31 11:35:51 -07:00
David Anderson
b725196a26 Replace AString with std::string. 2020-05-20 17:57:18 -07:00
David Anderson
7d7253c9cc Update AMTL; replace AutoPtr/UniquePtr with STL. 2020-05-18 18:19:16 -07:00
Asher Baker
ec7f1727e5 Allow setting multiple chat trigger characters (PR #449, bug 4341, bug 5668)
Special characters only, minus a couple of potentially-problematic characters.

Technically this is a breaking change - but anyone using multi-char triggers is probably crazy anyway and has been driven off by now.
2016-10-04 16:34:42 +01:00
Nicholas Hastings
40f2512317 Remove support for Source 1 Dota 2. (#496) 2016-04-26 23:18:47 -04:00
David Anderson
fe16e8e47c Move the SetCommandClient hook into GameHooks. 2015-09-09 20:03:23 -07:00
David Anderson
c54b54ded0 Use GameHooks for ChatTriggers. 2015-09-09 18:51:21 -07:00
David Anderson
86f0a77e73 Reduce dependence on sm_strdup. 2015-09-09 15:18:24 -07:00
David Anderson
13a783d441 Remove UTIL_Format() and UTIL_FormatArgs(). 2015-09-09 15:18:17 -07:00
David Anderson
e08697ad54 Remove strncopy(). 2015-09-09 14:57:47 -07:00
SystematicMania
10f878d8c7 Fix regressions in b2f7d97b1ea7 and update plugins for OnClientSayCommand changes (bug 5986, r=psychonic). 2014-02-28 10:38:36 -05:00
SystematicMania
ba99d0154b Strip quotes from chat forwards (bug 5986, r=psychonic). 2014-02-27 23:06:02 -05:00
SystematicMania
c679b97e5f Allow non-silent chat triggers to go through OnClientSayCommand (bug 5926, r=psychonic). 2014-02-27 20:22:01 -05:00
Nicholas Hastings
ff54fb431f Fix ep1 build. 2013-10-09 09:12:46 -04:00
Nicholas Hastings
1ba6b2653a Move ForwardSys from core to logic (bug 5953, r=fyren).
--HG--
rename : core/ForwardSys.cpp => core/logic/ForwardSys.cpp
rename : core/ForwardSys.h => core/logic/ForwardSys.h
2013-10-09 08:43:08 -04:00
Nicholas Hastings
ba55ef0b2e Don't call SayCommand forwards for chat triggers (bug 5863, r=asherkin). 2013-08-24 21:59:52 -04:00
Nicholas Hastings
0c00f7393c Fixed regression causing public triggers to no longer display (bug 5863, r=drifter). 2013-08-24 21:59:52 -04:00
Nicholas Hastings
1824826474 Removed unused var m_bTriggerWasSilent from core ChatTriggers (bug 5863, r=asherkin). 2013-08-24 21:59:52 -04:00
Nicholas Hastings
bc789d7c1a Add missing GetFunctionCount check in ChatTriggers::OnSayCommand_Pre (bug 5864, r=kyles).
--HG--
extra : rebase_source : afa6969f8319c80b027c4ae81e6b8db6b8d5c14f
2013-08-23 18:48:06 -04:00
Peace-Maker
e5428a3c27 Fixed crash in OnSayCommand_Post with console chat, pass console chat (bug 5864, r=kyles). 2013-08-23 07:31:04 -04:00
Nicholas Hastings
cf39bc97a5 Backed out changeset: 4af1c2ab3816 (bug 5864).
--HG--
extra : rebase_source : 7a3f03aaa4bb80d4b01c59cdb4dc12b0f5e020da
2013-08-23 07:28:07 -04:00
Nicholas Hastings
5954f15989 Fixed crash in OnSayCommand_Post with console chat, pass console chat (bug 5864, r=voided);
--HG--
extra : rebase_source : 4a1a1945efc119f40e7d55d4fdfcc250bdc0febc
2013-08-22 21:45:42 -04:00
Nicholas Hastings
5fc854ab4f Fixed chat trigger crash regression on ep1 (bug 5394, r=asherkin).
--HG--
extra : rebase_source : 39f0eff210b785b266422157c48b538921e16cc8
2013-08-15 10:18:27 -04:00
Nicholas Hastings
36b8b81914 Ep1 compile fixes. 2013-08-05 12:06:04 -04:00
Kyle Sanderson
5d76ffef88 Added global pre and post forwards for client chat (bug 5394, r=psychonic). 2013-08-05 11:46:29 -04:00
Nicholas Hastings
c230cf5aab Updated for latest hl2sdk-dota changes. 2013-07-12 02:31:41 -04:00
Nicholas Hastings
614967ccc1 Updated for latest hl2sdk-dota changes. 2013-05-13 15:18:12 -04:00
Nicholas Hastings
369e141ea8 Build fixes for recent hl2sdk-dota updates. 2013-04-23 07:11:49 -04:00
Nicholas Hastings
877ef76540 Tweaked Dota 2 support to account for lack of IPluginHelpers (bug 5656, r=asherkin). 2013-03-19 11:19:19 -04:00
Kyle Sanderson
ef6c454137 Replace usages of deprecated Sourcehook Add/Remove macros (bug 5631, r=dvander). 2013-03-16 22:15:25 -04:00
David Anderson
9137e92c09 Move translator from logic to core (bug 4406 part 6, r=ds).
--HG--
rename : core/PhraseCollection.cpp => core/logic/PhraseCollection.cpp
rename : core/PhraseCollection.h => core/logic/PhraseCollection.h
rename : core/Translator.cpp => core/logic/Translator.cpp
rename : core/Translator.h => core/logic/Translator.h
rename : core/sm_memtable.h => core/logic/sm_memtable.h
rename : core/smn_lang.cpp => core/logic/smn_lang.cpp
2010-05-14 19:43:53 -07:00
Scott Ehlert
ff7a2c6b73 Added preliminary support for Left 4 Dead; some things may not yet work. 2008-11-14 09:18:30 -06:00
David Anderson
0691bca512 Added "antiflood.txt" to Core's IPhraseCollection to prevent error spew (bug amb1922).
--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402527
2008-09-08 06:20:54 +00:00
David Anderson
c7418e70ba added amb1666 - rehaul over the ml api so extensions can easily use translations
--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402132
2008-05-10 09:23:55 +00:00
Scott Ehlert
251cced1f8 Spring Cleaning, Part Ichi (1)
Various minor things done to project files
Updated sample extension project file and updated makefile to the new unified version (more changes likely on the way)
Updated regex project file and makefile

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401971
2008-03-30 07:00:22 +00:00