From: terencehill Date: Mon, 22 Apr 2019 07:58:52 +0000 (+0200) Subject: Replace "F1", "F2", etc... with "F%d" X-Git-Tag: xonotic-v0.8.5~1533^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=be0f8ab2e3234a9a33e80d8d1fdea18704de09d3;p=xonotic%2Fxonotic-data.pk3dir.git Replace "F1", "F2", etc... with "F%d" --- diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 676ae4c4b..af7bc76ca 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -1459,19 +1459,6 @@ string translate_key(string key) case "CTRL": return _("CTRL"); case "SHIFT": return _("SHIFT"); - case "F1": return _("F1"); - case "F2": return _("F2"); - case "F3": return _("F3"); - case "F4": return _("F4"); - case "F5": return _("F5"); - case "F6": return _("F6"); - case "F7": return _("F7"); - case "F8": return _("F8"); - case "F9": return _("F9"); - case "F10": return _("F10"); - case "F11": return _("F11"); - case "F12": return _("F12"); - case "INS": return _("INS"); case "DEL": return _("DEL"); case "PGDN": return _("PGDN"); @@ -1493,6 +1480,16 @@ string translate_key(string key) case "BACKSLASH": return _("BACKSLASH"); } + if (substring(key, 0, 1) == "F") + { + string subkey = substring(key, 1, -1); + if (IS_DIGIT(substring(key, 3, 1))) // check only first digit + { + return sprintf(_("F%d"), stof(subkey)); + } + // continue in case there is another key name starting with F + } + if (substring(key, 0, 3) == "KP_") { string subkey = substring(key, 3, -1);