mirror of https://github.com/OpenTTD/OpenTTD
(svn r20273) -Fix [FS#3930]: '-' and '=' were not correctly read from hotkeys.cfg
parent
33ccd9ada8
commit
b0b0a21617
|
@ -69,15 +69,15 @@ static uint16 ParseCode(const char *start, const char *end)
|
||||||
assert(start <= end);
|
assert(start <= end);
|
||||||
while (start < end && *start == ' ') start++;
|
while (start < end && *start == ' ') start++;
|
||||||
while (end > start && *end == ' ') end--;
|
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++) {
|
for (uint i = 0; i < lengthof(_keycode_to_name); i++) {
|
||||||
if (strncasecmp(start, _keycode_to_name[i].name, end - start) == 0) {
|
if (strncasecmp(start, _keycode_to_name[i].name, end - start) == 0) {
|
||||||
return _keycode_to_name[i].keycode;
|
return _keycode_to_name[i].keycode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (end - start == 1) {
|
||||||
|
if (*start >= 'a' && *start <= 'z') return *start - ('a' - 'A');
|
||||||
|
return *start;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue