summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/windows/chatwindow.cpp1
-rw-r--r--src/input/inputmanager.cpp16
-rw-r--r--src/input/inputmanager.h3
3 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 2be4f7be5..eb14628ea 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -240,6 +240,7 @@ void ChatWindow::fillCommands()
{
loadCommandsFile("chatcommands.txt");
CommandHandler::addChatCommands(mCommands);
+ inputManager.addChatCommands(mCommands);
}
void ChatWindow::loadGMCommands()
diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp
index c74544432..235d50da9 100644
--- a/src/input/inputmanager.cpp
+++ b/src/input/inputmanager.cpp
@@ -847,3 +847,19 @@ int InputManager::getActionByKey(const SDL_Event &event) const
}
return InputAction::NO_VALUE;
}
+
+void InputManager::addChatCommands(std::list<std::string> &arr)
+{
+ for (int i = 0; i < InputAction::TOTAL; i++)
+ {
+ const InputActionData &ad = inputActionData[i];
+ std::string cmd = ad.chatCommand;
+ if (!cmd.empty())
+ {
+ cmd = std::string("/").append(cmd);
+ if (ad.useArgs)
+ cmd.append(" ");
+ arr.push_back(cmd);
+ }
+ }
+}
diff --git a/src/input/inputmanager.h b/src/input/inputmanager.h
index ab8f3d2f0..6bb4e65a2 100644
--- a/src/input/inputmanager.h
+++ b/src/input/inputmanager.h
@@ -26,6 +26,7 @@
#include "events/inputevent.h"
+#include <list>
#include <string>
#include <map>
@@ -122,6 +123,8 @@ class InputManager final
const std::string &args,
ChatTab *const tab);
+ void addChatCommands(std::list<std::string> &arr);
+
protected:
void resetKey(const int i);