mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 07:29:44 +00:00
(svn r11622) -Codechange: support the unicode version of the 'control' characters.
This commit is contained in:
parent
a5bcce4fc8
commit
78ae599790
@ -207,9 +207,13 @@ char *TranslateTTDPatchCodes(const char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const char *tmp = str; // Used for UTF-8 decoding
|
if (unicode && Utf8EncodedCharLen(*str) != 0) {
|
||||||
|
c = Utf8Consume(&str);
|
||||||
c = (byte)*str++;
|
/* 'Magic' range of control codes. */
|
||||||
|
if (GB(c, 8, 8) == 0xE0) c = GB(c, 0, 8);
|
||||||
|
} else {
|
||||||
|
c = (byte)*str++;
|
||||||
|
}
|
||||||
if (c == 0) break;
|
if (c == 0) break;
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@ -290,12 +294,6 @@ char *TranslateTTDPatchCodes(const char *str)
|
|||||||
case 0xB7: d += Utf8Encode(d, SCC_PLANE); break;
|
case 0xB7: d += Utf8Encode(d, SCC_PLANE); break;
|
||||||
case 0xB8: d += Utf8Encode(d, SCC_SHIP); break;
|
case 0xB8: d += Utf8Encode(d, SCC_SHIP); break;
|
||||||
default:
|
default:
|
||||||
if (unicode) {
|
|
||||||
d += Utf8Encode(d, Utf8Consume(&tmp));
|
|
||||||
str = tmp;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Validate any unhandled character */
|
/* Validate any unhandled character */
|
||||||
if (!IsValidChar(c, CS_ALPHANUMERAL)) c = '?';
|
if (!IsValidChar(c, CS_ALPHANUMERAL)) c = '?';
|
||||||
d += Utf8Encode(d, c);
|
d += Utf8Encode(d, c);
|
||||||
|
Loading…
Reference in New Issue
Block a user