diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2017-09-21 18:47:42 +0200 |
---|---|---|
committer | Loic Blot <loic.blot@unix-experience.fr> | 2017-09-21 18:47:42 +0200 |
commit | 080899b0f1f3c48e9038bff806815016d2b45508 (patch) | |
tree | 7ceb6a0cea7e463e951c1629421688e26277cc62 /src | |
parent | 69f3c424c192561fb2c0c661b1ae6207492e93ec (diff) | |
download | minetest-080899b0f1f3c48e9038bff806815016d2b45508.tar.gz minetest-080899b0f1f3c48e9038bff806815016d2b45508.tar.bz2 minetest-080899b0f1f3c48e9038bff806815016d2b45508.zip |
keycode.cpp: use std::unordered_map for keypress cache
Diffstat (limited to 'src')
-rw-r--r-- | src/keycode.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/keycode.cpp b/src/keycode.cpp index cedd0803b..6822875b1 100644 --- a/src/keycode.cpp +++ b/src/keycode.cpp @@ -359,13 +359,13 @@ const KeyPress CancelKey("KEY_CANCEL"); */ // A simple cache for quicker lookup -std::map<std::string, KeyPress> g_key_setting_cache; +std::unordered_map<std::string, KeyPress> g_key_setting_cache; KeyPress getKeySetting(const char *settingname) { - std::map<std::string, KeyPress>::iterator n; + std::unordered_map<std::string, KeyPress>::iterator n; n = g_key_setting_cache.find(settingname); - if(n != g_key_setting_cache.end()) + if (n != g_key_setting_cache.end()) return n->second; KeyPress k(g_settings->get(settingname).c_str()); |