diff options
author | Darkvater <Darkvater@openttd.org> | 2006-12-27 16:14:21 +0000 |
---|---|---|
committer | Darkvater <Darkvater@openttd.org> | 2006-12-27 16:14:21 +0000 |
commit | 65d00be13dbfbf762aba770a3f2972a1ef0f3d82 (patch) | |
tree | 024b83a05f470730251b2bb77b5c2e2adf0749e2 | |
parent | 77d9646765bde5ab28800982f7aa29d54587071b (diff) | |
download | openttd-65d00be13dbfbf762aba770a3f2972a1ef0f3d82.tar.xz |
(svn r7580) -Fix (r7182): UTF8-merge changed the string handling a bit, now the str pointer for
control characters is at the next character, so take value and THEN increase
pointer, not the other way around. This bug could result in incorrect bb's computed
for strings.
-rw-r--r-- | gfx.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -449,6 +449,11 @@ end_of_inner_loop: } } +/** Draw a given string with the centre around the given x coordinates + * @param x Centre the string around this pixel width + * @param y Draw the string at this pixel height (first line's bottom) + * @param str String to draw + * @param max Maximum width the string can have before it is wrapped */ void DrawStringMultiCenter(int x, int y, StringID str, int maxw) { char buffer[512]; @@ -555,10 +560,10 @@ BoundingRect GetStringBoundingBox(const char *str) br.width += GetCharacterWidth(size, c); } else { switch (c) { - case SCC_SETX: br.width += (byte)*++str; break; + case SCC_SETX: br.width += (byte)*str++; break; case SCC_SETXY: - br.width += (byte)*++str; - br.height += (byte)*++str; + br.width += (byte)*str++; + br.height += (byte)*str++; break; case SCC_TINYFONT: size = FS_SMALL; break; case SCC_BIGFONT: size = FS_LARGE; break; @@ -653,7 +658,7 @@ skip_cont:; } else if (c == SCC_BIGFONT) { // {BIGFONT} size = FS_LARGE; } else { - printf("Unknown string command character %d\n", c); + DEBUG(misc, 0, "[utf8] unknown string command character %d", c); } } } |