From 571d6151f0983e488feafb3cd6c9c74bbd038082 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 18 Feb 2016 15:50:43 +0300 Subject: Add some extra checks and logging while sorting keys. --- src/input/inputmanager.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/input/inputmanager.cpp') diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp index 4f9c1ce6b..eb6627d2a 100644 --- a/src/input/inputmanager.cpp +++ b/src/input/inputmanager.cpp @@ -921,8 +921,27 @@ void InputManager::updateKeyActionMap(KeyToActionMap &restrict actionMap, FOR_EACH (KeyToActionMapIter, it, actionMap) { KeysVector *const keys = &it->second; - if (keys && keys->size() > 1) + if (!keys) + continue; + const size_t sz = keys->size(); + if (sz > 1) + { + logger->log("keys size: %d", CAST_S32(sz)); + int sum = 0; + FOR_EACHP (KeysVectorIter, itk, keys) + { + const size_t val = CAST_SIZE(*itk); + if (val >= CAST_SIZE(InputAction::TOTAL)) + { + logger->log("wrong action index: %ld", + static_cast(val)); + break; + } + sum += inputActionData[val].priority; + } + logger->log("sum: %d", sum); std::sort(keys->begin(), keys->end(), inputActionDataSorter); + } } } -- cgit v1.2.3-70-g09d2