diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2021-03-27 13:28:36 +0100 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2021-03-27 13:28:36 +0100 |
commit | 399194ce3b1d01c1492d0d9763525950c61b6054 (patch) | |
tree | 91108d773b0a51326e803d04f81f5d6e1c2ca8f7 /src/client | |
parent | 98021002253fd1646230c889bc0c8ff4dd1a48e8 (diff) | |
parent | 7e8e3153e5227eb9b35ed2379efb54d17ba9aeae (diff) | |
download | minetest-399194ce3b1d01c1492d0d9763525950c61b6054.tar.gz minetest-399194ce3b1d01c1492d0d9763525950c61b6054.tar.bz2 minetest-399194ce3b1d01c1492d0d9763525950c61b6054.zip |
Merge remote-tracking branch 'pexin/clickablechatweblinks' into gpcfgpcf
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/keycode.cpp | 9 | ||||
-rw-r--r-- | src/client/keycode.h | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/client/keycode.cpp b/src/client/keycode.cpp index ce5214f54..08aff43ce 100644 --- a/src/client/keycode.cpp +++ b/src/client/keycode.cpp @@ -386,3 +386,12 @@ irr::EKEY_CODE keyname_to_keycode(const char *name) { return lookup_keyname(name).Key; } + +irr::EKEY_CODE keyname_to_keycode_safemode(const char *name) +{ + try { + return lookup_keyname(name).Key; + } catch (UnknownKeycode &e) { + return irr::KEY_KEY_CODES_COUNT; + } +} diff --git a/src/client/keycode.h b/src/client/keycode.h index 7036705d1..cb3114099 100644 --- a/src/client/keycode.h +++ b/src/client/keycode.h @@ -65,3 +65,6 @@ KeyPress getKeySetting(const char *settingname); void clearKeyCache(); irr::EKEY_CODE keyname_to_keycode(const char *name); + +// Now with internal exception handling. return irr::KEY_KEY_CODES_COUNT on fail +irr::EKEY_CODE keyname_to_keycode_safemode(const char *name); |