diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-27 15:14:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-27 15:14:59 +0300 |
commit | fbf45af162f9a2eecd3c27c8729bd9c811dbe793 (patch) | |
tree | 9c67b9bbed3f9f34c84d900f3bc7115c2ed1e05b /src/input | |
parent | 45949cf0fbade4f211520926c5e839c68cd01fbb (diff) | |
download | plus-fbf45af162f9a2eecd3c27c8729bd9c811dbe793.tar.gz plus-fbf45af162f9a2eecd3c27c8729bd9c811dbe793.tar.bz2 plus-fbf45af162f9a2eecd3c27c8729bd9c811dbe793.tar.xz plus-fbf45af162f9a2eecd3c27c8729bd9c811dbe793.zip |
Move chat command /enablehightlight into actions.
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/inputaction.h | 1 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 11 | ||||
-rw-r--r-- | src/input/inputmanager.cpp | 16 | ||||
-rw-r--r-- | src/input/inputmanager.h | 4 |
4 files changed, 31 insertions, 1 deletions
diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 48508b0fb..09f753117 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -408,6 +408,7 @@ namespace InputAction OPEN_URL, EXECUTE, TEST_SDL_FONT, + ENABLE_HIGHLIGHT, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index e2d123b73..4a7f76c6b 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -3449,7 +3449,16 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { #else "", #endif - false} + false}, + {"keyEnableHightlight", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::enableHighlight, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "enablehighlight", + true} }; #endif // INPUT_INPUTACTIONMAP_H diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index 099e2b7fb..3a7f1be9c 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -752,6 +752,22 @@ bool InputManager::executeChatCommand(const std::string &cmd, return false; } +bool InputManager::executeChatCommand(const int keyNum, + const std::string &args, + ChatTab *const tab) +{ + if (keyNum < 0 || keyNum >= InputAction::TOTAL) + return false; + ActionFuncPtr func = *(inputActionData[keyNum].action); + if (func) + { + InputEvent evt(args, tab, mMask); + func(evt); + return true; + } + return false; +} + void InputManager::updateKeyActionMap(KeyToActionMap &actionMap, KeyToIdMap &idMap, KeyTimeMap &keyTimeMap, diff --git a/src/input/inputmanager.h b/src/input/inputmanager.h index 6bb4e65a2..b91af8882 100644 --- a/src/input/inputmanager.h +++ b/src/input/inputmanager.h @@ -123,6 +123,10 @@ class InputManager final const std::string &args, ChatTab *const tab); + bool executeChatCommand(const int keyNum, + const std::string &args, + ChatTab *const tab); + void addChatCommands(std::list<std::string> &arr); protected: |