diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-11-17 00:19:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-11-17 00:19:10 +0300 |
commit | 4825afb0187527d7eaa0ea3d903ad716a3eb9562 (patch) | |
tree | e516623a908eb6a8a4d053bbc39a36ff81aa4141 /src/input/inputmanager.cpp | |
parent | b3d17866a3c5700b52c2b0b954fce132a52c1dbf (diff) | |
download | plus-4825afb0187527d7eaa0ea3d903ad716a3eb9562.tar.gz plus-4825afb0187527d7eaa0ea3d903ad716a3eb9562.tar.bz2 plus-4825afb0187527d7eaa0ea3d903ad716a3eb9562.tar.xz plus-4825afb0187527d7eaa0ea3d903ad716a3eb9562.zip |
Convert enum InputType into strong typed.
Diffstat (limited to 'src/input/inputmanager.cpp')
-rw-r--r-- | src/input/inputmanager.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index 59fd1ff2d..8fe1e80de 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -146,7 +146,7 @@ void InputManager::retrieve() std::string keyStr2 = *it; if (keyStrSize < 2) continue; - int type = InputType::KEYBOARD; + InputTypeT type = InputType::KEYBOARD; if ((keyStr2[0] < '0' || keyStr2[0] > '9') && keyStr2[0] != '-') { @@ -463,7 +463,7 @@ std::string InputManager::getKeyValueByNameLong(const std::string &keyName) } void InputManager::addActionKey(const InputActionT action, - const int type, + const InputTypeT type, const int val) { if (static_cast<int>(action) < 0 || action >= InputAction::TOTAL) @@ -496,7 +496,8 @@ void InputManager::addActionKey(const InputActionT action, key.values[idx] = InputItem(type, val); } -void InputManager::setNewKey(const SDL_Event &event, const int type) +void InputManager::setNewKey(const SDL_Event &event, + const InputTypeT type) { int val = -1; if (type == InputType::KEYBOARD) @@ -525,7 +526,7 @@ void InputManager::unassignKey() #ifndef DYECMD bool InputManager::handleAssignKey(const SDL_Event &event, - const int type) + const InputTypeT type) { if (setupWindow && setupWindow->isWindowVisible() && getNewKeyIndex() > InputAction::NO_VALUE) @@ -539,7 +540,7 @@ bool InputManager::handleAssignKey(const SDL_Event &event, } #else bool InputManager::handleAssignKey(const SDL_Event &event A_UNUSED, - const int type A_UNUSED) + const InputTypeT type A_UNUSED) { return false; } @@ -863,7 +864,7 @@ bool InputManager::executeChatCommand(const InputActionT keyNum, void InputManager::updateKeyActionMap(KeyToActionMap &actionMap, KeyToIdMap &idMap, KeyTimeMap &keyTimeMap, - const int type) const + const InputType type) const { actionMap.clear(); keyTimeMap.clear(); @@ -934,7 +935,7 @@ bool InputManager::triggerAction(const KeysVector *const ptrs) InputActionT InputManager::getKeyIndex(const int value, const int grp, - const int type) const + const InputTypeT type) const { for (size_t i = 0; i < static_cast<size_t>(InputAction::TOTAL); i++) { |