diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-23 20:51:41 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-23 21:44:26 +0300 |
commit | 2efe6bad2044f12d842466e149f512aba9b7fc86 (patch) | |
tree | 6a9cfc1ad031369b3f9f45b362fff0f01f6e8bef /src | |
parent | e6d02447113b137ce37f2331ae674371c3968e28 (diff) | |
download | manaplus-2efe6bad2044f12d842466e149f512aba9b7fc86.tar.gz manaplus-2efe6bad2044f12d842466e149f512aba9b7fc86.tar.bz2 manaplus-2efe6bad2044f12d842466e149f512aba9b7fc86.tar.xz manaplus-2efe6bad2044f12d842466e149f512aba9b7fc86.zip |
Add support for miltiple chat command names per one action.
Diffstat (limited to 'src')
-rw-r--r-- | src/input/inputmanager.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index 140600a0a..099e2b7fb 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -110,7 +110,12 @@ void InputManager::retrieve() { const std::string &cmd = inputActionData[i].chatCommand; if (!cmd.empty()) - mChatMap[cmd] = i; + { + StringVect tokens; + splitToStringVector(tokens, cmd, '|'); + FOR_EACH (StringVectCIter, it, tokens) + mChatMap[*it] = i; + } #ifdef USE_SDL2 const std::string cf = std::string("sdl2") + inputActionData[i].configField; @@ -856,10 +861,15 @@ void InputManager::addChatCommands(std::list<std::string> &arr) std::string cmd = ad.chatCommand; if (!cmd.empty()) { - cmd = std::string("/").append(cmd); - if (ad.useArgs) - cmd.append(" "); - arr.push_back(cmd); + StringVect tokens; + splitToStringVector(tokens, cmd, '|'); + FOR_EACH (StringVectCIter, it, tokens) + { + cmd = std::string("/").append(*it); + if (ad.useArgs) + cmd.append(" "); + arr.push_back(cmd); + } } } } |