1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-28 08:59:09 +00:00

(svn r22094) -Fix [FS#4510]: remove invalid keycodes when reading hotkeys.cfg

This commit is contained in:
yexo
2011-02-17 23:14:43 +00:00
parent 1a5087be69
commit 24753fbd35

View File

@@ -95,8 +95,14 @@ static uint16 ParseKeycode(const char *start, const char *end)
uint16 code = ParseCode(start, cur);
if (code == 0) return 0;
if (code & WKC_SPECIAL_KEYS) {
/* Some completely wrong keycode we don't support. */
if (code & ~WKC_SPECIAL_KEYS) return 0;
keycode |= code;
} else {
/* Ignore invalid keycodes */
if (code >= 128) {
return 0;
}
/* Ignore the code if it has more then 1 letter. */
if (keycode & ~WKC_SPECIAL_KEYS) return 0;
keycode |= code;