summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-07-31 23:33:09 +0000
committeryexo <yexo@openttd.org>2010-07-31 23:33:09 +0000
commitb0b0a216174da39a3318f88a97be58561bac91db (patch)
treed8608223d7b1a36ed585cb2f65f6b9e4aaeec0c6
parent33ccd9ada8dbc2984a189e4d2f1b8602f4575fa3 (diff)
downloadopenttd-b0b0a216174da39a3318f88a97be58561bac91db.tar.xz
(svn r20273) -Fix [FS#3930]: '-' and '=' were not correctly read from hotkeys.cfg
-rw-r--r--src/hotkeys.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/hotkeys.cpp b/src/hotkeys.cpp
index 7042f91b6..e9c14544f 100644
--- a/src/hotkeys.cpp
+++ b/src/hotkeys.cpp
@@ -69,15 +69,15 @@ static uint16 ParseCode(const char *start, const char *end)
assert(start <= end);
while (start < end && *start == ' ') start++;
while (end > start && *end == ' ') end--;
- if (end - start == 1) {
- if (*start >= 'a' && *start <= 'z') return *start - ('a' - 'A');
- return *start;
- }
for (uint i = 0; i < lengthof(_keycode_to_name); i++) {
if (strncasecmp(start, _keycode_to_name[i].name, end - start) == 0) {
return _keycode_to_name[i].keycode;
}
}
+ if (end - start == 1) {
+ if (*start >= 'a' && *start <= 'z') return *start - ('a' - 'A');
+ return *start;
+ }
return 0;
}