changeset 17396:df378a32f9df draft

(svn r22142) -Fix (r22094): some valid keycodes were ignored along with the invalid ones
author yexo <yexo@openttd.org>
date Fri, 25 Feb 2011 13:59:02 +0000
parents 701446cd16e0
children 51622f17c7d4
files src/hotkeys.cpp
diffstat 1 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotkeys.cpp
+++ b/src/hotkeys.cpp
@@ -74,7 +74,8 @@
 	}
 	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 @@
 			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;