summaryrefslogtreecommitdiff
path: root/src/hotkeys.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-02-25 13:59:02 +0000
committeryexo <yexo@openttd.org>2011-02-25 13:59:02 +0000
commitf7f3db7174e9a375ff6a9e88c091d55a9e89c142 (patch)
tree0afd260d2869c61117a054bdedcb20a34394fd82 /src/hotkeys.cpp
parentb0b7e1172c189d88b0fb784cbbcebdf7175eaba9 (diff)
downloadopenttd-f7f3db7174e9a375ff6a9e88c091d55a9e89c142.tar.xz
(svn r22142) -Fix (r22094): some valid keycodes were ignored along with the invalid ones
Diffstat (limited to 'src/hotkeys.cpp')
-rw-r--r--src/hotkeys.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/hotkeys.cpp b/src/hotkeys.cpp
index 686877bf3..5ad8f2bf9 100644
--- a/src/hotkeys.cpp
+++ b/src/hotkeys.cpp
@@ -74,7 +74,8 @@ static uint16 ParseCode(const char *start, const char *end)
}
if (end - start == 1) {
if (*start >= 'a' && *start <= 'z') return *start - ('a'-'A');
- return *start;
+ /* Ignore invalid keycodes */
+ if (*(uint8*)start < 128) return *start;
}
return 0;
}
@@ -99,10 +100,6 @@ static uint16 ParseKeycode(const char *start, const char *end)
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;