Changeset - r5208:e1025a2d1568
[Not reviewed]
master
0 1 0
peter1138 - 18 years ago 2006-12-02 09:34:18
peter1138@openttd.org
(svn r7323) -Fix (r7182): When translating NewGRF strings, look at the first
character and move ahead if needed, instead of taking the first
character and moving back.
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
newgrf_text.c
Show inline comments
 
@@ -150,31 +150,31 @@ typedef struct GRFTextEntry {
 

	
 

	
 
static uint _num_grf_texts = 0;
 
static GRFTextEntry _grf_text[(1 << TABSIZE) * 3];
 
static byte _currentLangID = GRFLX_ENGLISH;  //by default, english is used.
 

	
 

	
 
static char *TranslateTTDPatchCodes(const char *str)
 
{
 
	char *tmp = malloc(strlen(str) * 10 + 1); /* Allocate space to allow for expansion */
 
	char *d = tmp;
 
	bool unicode = false;
 
	WChar c = Utf8Consume(&str);
 
	WChar c;
 
	size_t len = Utf8Decode(&c, str);
 

	
 
	if (c == 0x00DE) {
 
		/* The thorn ('รพ') indicates a unicode string to TTDPatch */
 
		unicode = true;
 
	} else {
 
		str--;
 
		str += len;
 
	}
 

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

	
 
		c = (byte)*str++;
 
		if (c == 0) break;
 

	
 
		switch (c) {
 
			case 0x01:
 
				d += Utf8Encode(d, SCC_SETX);
 
				*d++ = *str++;
0 comments (0 inline, 0 general)