summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-08-01 10:42:18 +0000
committeryexo <yexo@openttd.org>2010-08-01 10:42:18 +0000
commitdc3271b705a44a851d94f5fc5088249e8291fa57 (patch)
tree1fe8f72584e4b5bbfdbe34497f49dfc00991f321
parentb0b0a216174da39a3318f88a97be58561bac91db (diff)
downloadopenttd-dc3271b705a44a851d94f5fc5088249e8291fa57.tar.xz
(svn r20274) -Fix: special keycodes were matched if a code matched the start of the string (ie 'C' matched 'CTRL')
-rw-r--r--src/hotkeys.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hotkeys.cpp b/src/hotkeys.cpp
index e9c14544f..2dbad3ce9 100644
--- a/src/hotkeys.cpp
+++ b/src/hotkeys.cpp
@@ -70,7 +70,7 @@ static uint16 ParseCode(const char *start, const char *end)
while (start < end && *start == ' ') start++;
while (end > start && *end == ' ') end--;
for (uint i = 0; i < lengthof(_keycode_to_name); i++) {
- if (strncasecmp(start, _keycode_to_name[i].name, end - start) == 0) {
+ if (strlen(_keycode_to_name[i].name) == end - start && strncasecmp(start, _keycode_to_name[i].name, end - start) == 0) {
return _keycode_to_name[i].keycode;
}
}