Changeset - r8061:fac8ff995ca5
[Not reviewed]
master
0 1 0
rubidium - 17 years ago 2007-12-11 21:25:48
rubidium@openttd.org
(svn r11622) -Codechange: support the unicode version of the 'control' characters.
1 file changed with 7 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/newgrf_text.cpp
Show inline comments
 
@@ -207,9 +207,13 @@ char *TranslateTTDPatchCodes(const char 
 
	}
 

	
 
	for (;;) {
 
		const char *tmp = str; // Used for UTF-8 decoding
 

	
 
		c = (byte)*str++;
 
		if (unicode && Utf8EncodedCharLen(*str) != 0) {
 
			c = Utf8Consume(&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;
 

	
 
		switch (c) {
 
@@ -290,12 +294,6 @@ char *TranslateTTDPatchCodes(const char 
 
			case 0xB7: d += Utf8Encode(d, SCC_PLANE); break;
 
			case 0xB8: d += Utf8Encode(d, SCC_SHIP); break;
 
			default:
 
				if (unicode) {
 
					d += Utf8Encode(d, Utf8Consume(&tmp));
 
					str = tmp;
 
					break;
 
				}
 

	
 
				/* Validate any unhandled character */
 
				if (!IsValidChar(c, CS_ALPHANUMERAL)) c = '?';
 
				d += Utf8Encode(d, c);
0 comments (0 inline, 0 general)