aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2021-03-27 13:28:36 +0100
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2021-03-27 13:28:36 +0100
commit399194ce3b1d01c1492d0d9763525950c61b6054 (patch)
tree91108d773b0a51326e803d04f81f5d6e1c2ca8f7 /src/client
parent98021002253fd1646230c889bc0c8ff4dd1a48e8 (diff)
parent7e8e3153e5227eb9b35ed2379efb54d17ba9aeae (diff)
downloadminetest-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.cpp9
-rw-r--r--src/client/keycode.h3
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);