diff options
author | Ilya Zhuravlev <zhuravlevilya@ya.ru> | 2012-12-20 21:19:49 +0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2013-03-11 19:08:39 -0400 |
commit | 6a1670dbc31cc0e44178bbd9ad34ff0d5981a060 (patch) | |
tree | ce32cd4be20e9be30367f2ad25d9dae6a0482898 /src/keycode.cpp | |
parent | e204bedf1d781e43b8caa334a99319efc5b7ce46 (diff) | |
download | minetest-6a1670dbc31cc0e44178bbd9ad34ff0d5981a060.tar.gz minetest-6a1670dbc31cc0e44178bbd9ad34ff0d5981a060.tar.bz2 minetest-6a1670dbc31cc0e44178bbd9ad34ff0d5981a060.zip |
Migrate to STL containers/algorithms.
Diffstat (limited to 'src/keycode.cpp')
-rw-r--r-- | src/keycode.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/keycode.cpp b/src/keycode.cpp index 8aadab2f1..96631b4ea 100644 --- a/src/keycode.cpp +++ b/src/keycode.cpp @@ -345,17 +345,16 @@ const KeyPress NumberKey[] = { */ // A simple cache for quicker lookup -core::map<std::string, KeyPress> g_key_setting_cache; +std::map<std::string, KeyPress> g_key_setting_cache; KeyPress getKeySetting(const char *settingname) { - core::map<std::string, KeyPress>::Node *n; + std::map<std::string, KeyPress>::iterator n; n = g_key_setting_cache.find(settingname); - if(n) - return n->getValue(); - g_key_setting_cache.insert(settingname, - g_settings->get(settingname).c_str()); - return g_key_setting_cache.find(settingname)->getValue(); + if(n != g_key_setting_cache.end()) + return n->second; + g_key_setting_cache[settingname] = g_settings->get(settingname).c_str(); + return g_key_setting_cache.find(settingname)->second; } void clearKeyCache() |