diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-07-12 20:11:09 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-07-12 20:20:59 +0300 |
commit | aeec9ca9881bbd4fdc332b342b09a795ee3961b4 (patch) | |
tree | 3e32a1dd828464a7e6e8c439f658421772a62f40 /src/inputmanager.cpp | |
parent | 36027fc87b99b8f048265f6ac470227a1c32d481 (diff) | |
download | manaverse-aeec9ca9881bbd4fdc332b342b09a795ee3961b4.tar.gz manaverse-aeec9ca9881bbd4fdc332b342b09a795ee3961b4.tar.bz2 manaverse-aeec9ca9881bbd4fdc332b342b09a795ee3961b4.tar.xz manaverse-aeec9ca9881bbd4fdc332b342b09a795ee3961b4.zip |
add ability to show assigned keys in browserbox.
Example: This is chat modifier key: ###ChatMod;.
If chat mod key is left shift, it will show:
"This is chat modifier key: left shift."
Diffstat (limited to 'src/inputmanager.cpp')
-rw-r--r-- | src/inputmanager.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/inputmanager.cpp b/src/inputmanager.cpp index 4b5988a57..3b99c3498 100644 --- a/src/inputmanager.cpp +++ b/src/inputmanager.cpp @@ -66,7 +66,8 @@ static class KeyFunctor final InputManager::InputManager() : mSetupInput(nullptr), mNewKeyIndex(Input::KEY_NO_VALUE), - mMask(1) + mMask(1), + mNameMap() { } @@ -104,6 +105,7 @@ void InputManager::retrieve() const char *const cf = keyData[i].configField; if (*cf) { + mNameMap[cf] = i; KeyFunction &kf = mKey[i]; const std::string keyStr = config.getValue(cf, ""); if (keyStr.empty()) @@ -392,6 +394,16 @@ std::string InputManager::getKeyValueString(const int index) const return keyStr; } +std::string InputManager::getKeyValueByName(const std::string &keyName) +{ + const std::map<std::string, int>::const_iterator + it = mNameMap.find(keyName); + + if (it == mNameMap.end()) + return std::string(); + return getKeyValueString((*it).second); +} + void InputManager::addActionKey(const int action, const int type, const int val) { |