X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fkeycode.cpp;h=890c97cc27a875e123a60b6c6bb9b9e1c0722406;hb=a020d1b653f94fbcaac06c15f9dbab4521fda355;hp=9aa9d300d688e601c2e24286c41fa5da68a52f50;hpb=145e30126968f26fded87b28747784007a257111;p=oweals%2Fminetest.git diff --git a/src/keycode.cpp b/src/keycode.cpp index 9aa9d300d..890c97cc2 100644 --- a/src/keycode.cpp +++ b/src/keycode.cpp @@ -1,6 +1,6 @@ /* -Minetest-c55 -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Minetest +Copyright (C) 2010-2013 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -334,6 +334,7 @@ const char *KeyPress::name() const } const KeyPress EscapeKey("KEY_ESCAPE"); +const KeyPress CancelKey("KEY_CANCEL"); const KeyPress NumberKey[] = { KeyPress("KEY_KEY_0"), KeyPress("KEY_KEY_1"), KeyPress("KEY_KEY_2"), KeyPress("KEY_KEY_3"), KeyPress("KEY_KEY_4"), KeyPress("KEY_KEY_5"), @@ -345,17 +346,16 @@ const KeyPress NumberKey[] = { */ // A simple cache for quicker lookup -core::map g_key_setting_cache; +std::map g_key_setting_cache; KeyPress getKeySetting(const char *settingname) { - core::map::Node *n; + std::map::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()