diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/gui/popups/statuspopup.h | 2 | ||||
-rw-r--r-- | src/gui/setupactiondata.h | 2 | ||||
-rw-r--r-- | src/input/inputactiondata.h (renamed from src/input/keydata.h) | 2 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 4 | ||||
-rw-r--r-- | src/input/inputmanager.cpp | 38 | ||||
-rw-r--r-- | src/input/inputmanager.h | 6 | ||||
-rw-r--r-- | src/input/keysortfunctor.h | 4 |
9 files changed, 31 insertions, 31 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0360cca8e..8d98c9405 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -805,6 +805,7 @@ SET(SRCS textcommand.cpp textcommand.h input/inputaction.h + input/inputactiondata.h input/inputactionmap.h input/inputcondition.h input/inputmanager.cpp @@ -815,7 +816,6 @@ SET(SRCS input/joystick.h input/keyboardconfig.cpp input/keyboardconfig.h - input/keydata.h input/keyfunction.h input/keyinput.h input/keyitem.h diff --git a/src/Makefile.am b/src/Makefile.am index 1c5e0d660..01b9438c5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -927,6 +927,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ textcommand.h \ events/inputevent.h \ input/inputaction.h \ + input/inputactiondata.h \ input/inputactionmap.h \ input/inputcondition.h \ input/inputmanager.cpp \ @@ -936,7 +937,6 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ input/joystick.h \ input/keyboardconfig.cpp \ input/keyboardconfig.h \ - input/keydata.h \ input/keyfunction.h \ input/keyinput.h \ input/keyitem.h \ diff --git a/src/gui/popups/statuspopup.h b/src/gui/popups/statuspopup.h index e0fe09d14..6dcdd636f 100644 --- a/src/gui/popups/statuspopup.h +++ b/src/gui/popups/statuspopup.h @@ -25,7 +25,7 @@ #define GUI_POPUPS_STATUSPOPUP_H #include "input/inputaction.h" -#include "input/keydata.h" +#include "input/inputactiondata.h" #include "gui/widgets/popup.h" diff --git a/src/gui/setupactiondata.h b/src/gui/setupactiondata.h index 41fa6e3d9..718dc2dc2 100644 --- a/src/gui/setupactiondata.h +++ b/src/gui/setupactiondata.h @@ -25,7 +25,7 @@ #define GUI_SETUPACTIONDATA_H #include "input/inputaction.h" -#include "input/keydata.h" +#include "input/inputactiondata.h" #include "utils/gettext.h" #include "utils/stringutils.h" diff --git a/src/input/keydata.h b/src/input/inputactiondata.h index 8e4411bca..7681154df 100644 --- a/src/input/keydata.h +++ b/src/input/inputactiondata.h @@ -29,7 +29,7 @@ typedef bool (*ActionFuncPtr) (const InputEvent &event); -struct KeyData final +struct InputActionData final { const char *configField; int defaultType1; diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index fb810a683..3ab04c98a 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -27,17 +27,17 @@ #include "localconsts.h" #include "input/inputaction.h" +#include "input/inputactiondata.h" #include "input/inputcondition.h" #include "input/inputmanager.h" #include "input/inputtype.h" -#include "input/keydata.h" #include "utils/gettext.h" #include <string> // keyData must be in same order as enum keyAction. -static const KeyData keyData[InputAction::TOTAL] = { +static const InputActionData inputActionData[InputAction::TOTAL] = { {"keyMoveUp", InputType::KEYBOARD, SDLK_UP, InputType::UNKNOWN, InputAction::NO_VALUE, diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index 8b3539042..e61372c21 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -64,7 +64,7 @@ extern QuitDialog *quitDialog; namespace { - KeySortFunctor keyDataSorter; + KeySortFunctor inputActionDataSorter; } // namespace InputManager::InputManager() : @@ -107,9 +107,9 @@ void InputManager::retrieve() for (int i = 0; i < InputAction::TOTAL; i++) { #ifdef USE_SDL2 - const std::string cf = std::string("sdl2") + keyData[i].configField; + const std::string cf = std::string("sdl2") + inputActionData[i].configField; #else - const std::string cf = keyData[i].configField; + const std::string cf = inputActionData[i].configField; #endif if (!cf.empty()) { @@ -162,9 +162,9 @@ void InputManager::store() const for (int i = 0; i < InputAction::TOTAL; i++) { #ifdef USE_SDL2 - const std::string cf = std::string("sdl2") + keyData[i].configField; + const std::string cf = std::string("sdl2") + inputActionData[i].configField; #else - const std::string cf = keyData[i].configField; + const std::string cf = inputActionData[i].configField; #endif if (!cf.empty()) { @@ -219,7 +219,7 @@ void InputManager::resetKey(const int i) ki2.type = InputType::UNKNOWN; ki2.value = -1; } - const KeyData &kd = keyData[i]; + const InputActionData &kd = inputActionData[i]; KeyItem &val0 = key.values[0]; val0.type = kd.defaultType1; KeyItem &val1 = key.values[1]; @@ -262,7 +262,7 @@ bool InputManager::hasConflicts(int &restrict key1, int &restrict key2) const */ for (int i = 0; i < InputAction::TOTAL; i++) { - const KeyData &kdi = keyData[i]; + const InputActionData &kdi = inputActionData[i]; if (!*kdi.configField) continue; @@ -276,7 +276,7 @@ bool InputManager::hasConflicts(int &restrict key1, int &restrict key2) const size_t j; for (j = i, j++; j < InputAction::TOTAL; j++) { - if ((kdi.grp & keyData[j].grp) == 0 || !*kdi.configField) + if ((kdi.grp & inputActionData[j].grp) == 0 || !*kdi.configField) continue; for (size_t j2 = 0; j2 < KeyFunctionSize; j2 ++) @@ -309,7 +309,7 @@ bool InputManager::isActionActive(const int index) const if (!isActionActive0(index)) return false; - const KeyData &key = keyData[index]; + const InputActionData &key = inputActionData[index]; // logger->log("isActionActive mask=%d, condition=%d, index=%d", // mMask, key.condition, index); if ((key.condition & mMask) != key.condition) @@ -684,7 +684,7 @@ void InputManager::updateConditionMask() mMask |= InputCondition::NOFOLLOW; } -bool InputManager::checkKey(const KeyData *const key) const +bool InputManager::checkKey(const InputActionData *const key) const { // logger->log("checkKey mask=%d, condition=%d", mMask, key->condition); if (!key || (key->condition & mMask) != key->condition) @@ -694,14 +694,14 @@ bool InputManager::checkKey(const KeyData *const key) const || isActionActive0(key->modKeyIndex)); } -bool InputManager::invokeKey(const KeyData *const key, const int keyNum) +bool InputManager::invokeKey(const InputActionData *const key, const int keyNum) { // no validation to keyNum because it validated in caller if (checkKey(key)) { InputEvent evt(keyNum, mMask); - ActionFuncPtr func = *(keyData[keyNum].action); + ActionFuncPtr func = *(inputActionData[keyNum].action); if (func && func(evt)) return true; } @@ -714,7 +714,7 @@ void InputManager::executeAction(const int keyNum) return; InputEvent evt(keyNum, mMask); - ActionFuncPtr func = *(keyData[keyNum].action); + ActionFuncPtr func = *(inputActionData[keyNum].action); if (func) func(evt); } @@ -730,7 +730,7 @@ void InputManager::updateKeyActionMap(KeyToActionMap &actionMap, for (size_t i = 0; i < InputAction::TOTAL; i ++) { const KeyFunction &key = mKey[i]; - const KeyData &kd = keyData[i]; + const InputActionData &kd = inputActionData[i]; if (kd.action) { for (size_t i2 = 0; i2 < KeyFunctionSize; i2 ++) @@ -760,12 +760,12 @@ void InputManager::updateKeyActionMap(KeyToActionMap &actionMap, } } - keyDataSorter.keys = &keyData[0]; + inputActionDataSorter.keys = &inputActionData[0]; FOR_EACH (KeyToActionMapIter, it, actionMap) { KeysVector *const keys = &it->second; if (keys && keys->size() > 1) - std::sort(keys->begin(), keys->end(), keyDataSorter); + std::sort(keys->begin(), keys->end(), inputActionDataSorter); } } @@ -782,7 +782,7 @@ bool InputManager::triggerAction(const KeysVector *const ptrs) if (keyNum < 0 || keyNum >= InputAction::TOTAL) continue; - if (invokeKey(&keyData[keyNum], keyNum)) + if (invokeKey(&inputActionData[keyNum], keyNum)) return true; } return false; @@ -794,7 +794,7 @@ int InputManager::getKeyIndex(const int value, const int grp, for (size_t i = 0; i < InputAction::TOTAL; i++) { const KeyFunction &key = mKey[i]; - const KeyData &kd = keyData[i]; + const InputActionData &kd = inputActionData[i]; for (size_t i2 = 0; i2 < KeyFunctionSize; i2 ++) { const KeyItem &vali2 = key.values[i2]; @@ -814,7 +814,7 @@ int InputManager::getActionByKey(const SDL_Event &event) const if (event.type == SDL_KEYDOWN || event.type == SDL_KEYUP) { const int idx = keyboard.getActionId(event); - if (idx >= 0 && checkKey(&keyData[idx])) + if (idx >= 0 && checkKey(&inputActionData[idx])) return idx; } return InputAction::NO_VALUE; diff --git a/src/input/inputmanager.h b/src/input/inputmanager.h index ee5f101a8..11db43402 100644 --- a/src/input/inputmanager.h +++ b/src/input/inputmanager.h @@ -33,7 +33,7 @@ class Setup_Input; -struct KeyData; +struct InputActionData; class InputManager final { @@ -46,7 +46,7 @@ class InputManager final bool handleEvent(const SDL_Event &event); - bool checkKey(const KeyData *const key) const A_WARN_UNUSED; + bool checkKey(const InputActionData *const key) const A_WARN_UNUSED; void retrieve(); @@ -99,7 +99,7 @@ class InputManager final KeyToIdMap &idMap, KeyTimeMap &keyTimeMap, const int type) const; - bool invokeKey(const KeyData *const key, const int keyNum); + bool invokeKey(const InputActionData *const key, const int keyNum); bool handleAssignKey(const SDL_Event &event, const int type); diff --git a/src/input/keysortfunctor.h b/src/input/keysortfunctor.h index fae1bedda..fedb4c395 100644 --- a/src/input/keysortfunctor.h +++ b/src/input/keysortfunctor.h @@ -21,7 +21,7 @@ #ifndef INPUT_KEYSORTFUNCTOR_H #define INPUT_KEYSORTFUNCTOR_H -#include "input/keydata.h" +#include "input/inputactiondata.h" #include "localconsts.h" @@ -33,7 +33,7 @@ class KeySortFunctor final return keys[key1].priority >= keys[key2].priority; } - const KeyData *keys; + const InputActionData *keys; }; #endif // INPUT_KEYSORTFUNCTOR_H |