diff options
author | Fedja Beader <fedja@protonmail.ch> | 2025-04-11 00:06:42 +0200 |
---|---|---|
committer | Fedja Beader <fedja@protonmail.ch> | 2025-04-11 00:14:40 +0200 |
commit | c15aa3c75e7f362d90d08ef4f96f43347420121f (patch) | |
tree | c4ccbbc18b5bfc93b16c90ed85c7a7cce9eeaadc | |
parent | 315588b76204ca3dfe15ac29b1e896b85f6c808d (diff) | |
download | manaplus-c15aa3c75e7f362d90d08ef4f96f43347420121f.tar.gz manaplus-c15aa3c75e7f362d90d08ef4f96f43347420121f.tar.bz2 manaplus-c15aa3c75e7f362d90d08ef4f96f43347420121f.tar.xz manaplus-c15aa3c75e7f362d90d08ef4f96f43347420121f.zip |
Report command not found into channel if there is an associated channel
There is an issue with this: since nickname is empty, it will be
filtered from General to Debug if "Show server messages in debug tab" is
on. This seems faulty, see the || where there should probably be && at
src/gui/widgets/tabs/chat/chattab.cpp:245.
Also, might require review of all calls of command execute function, so
that non-player initiated calls still get a stacktrace (so users can
find the source of the problem)
Fixes #22
-rw-r--r-- | src/input/inputmanager.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index 8cb10041e..02c541900 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -44,6 +44,7 @@ #include "gui/widgets/selldialog.h" #include "gui/widgets/textfield.h" +#include "gui/widgets/tabs/chat/chattab.h" #include "gui/widgets/tabs/setup_input.h" #include "gui/windows/buydialog.h" @@ -985,9 +986,14 @@ bool InputManager::executeChatCommand(const std::string &restrict cmd, } else { - reportAlways("Unknown chat command: /%s %s", - cmd.c_str(), - args.c_str()) + if (tab == nullptr) + reportAlways("Unknown chat command: /%s %s", + cmd.c_str(), args.c_str()) + else + tab->chatLog(strprintf("Unknown command: '%s'", cmd.c_str()), + ChatMsgType::BY_PLAYER, + IgnoreRecord_false, + TryRemoveColors_true); } return false; } |