summaryrefslogtreecommitdiff
path: root/src/gfx.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-03-22 09:34:06 +0000
committerrubidium <rubidium@openttd.org>2009-03-22 09:34:06 +0000
commite74dc1e1d6dc57b2d6b79ef921888c0204855139 (patch)
tree1266c6a78a4ae2bcbfd356af1e87bfdbb85fbe80 /src/gfx.cpp
parent70d0f8857e5b984d5f74dda353413dc2cd8221ba (diff)
downloadopenttd-e74dc1e1d6dc57b2d6b79ef921888c0204855139.tar.xz
(svn r15803) -Codechange: use the new text drawing API for multicenter
-Fix (r15800): off-by-one w.r.t. offsets
Diffstat (limited to 'src/gfx.cpp')
-rw-r--r--src/gfx.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index 4fd448b95..be008c1c0 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -637,7 +637,7 @@ int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str,
total_height = (num + 1) * mt;
}
- int y = (align == SA_CENTER) ? (bottom + top - num * mt) / 2 : top;
+ int y = (align == SA_CENTER) ? (bottom + top - total_height + 1) / 2 : top;
const char *src = buffer;
for (;;) {
@@ -652,7 +652,7 @@ int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str,
y += mt;
if (--num < 0) {
_cur_fontsize = FS_NORMAL;
- return y + mt;
+ return y;
}
break;
} else if (c == SCC_SETX) {
@@ -664,16 +664,6 @@ int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str,
}
}
-/** Draw a given string with the centre around the given (x,y) coordinates
- * @param x Centre the string around this pixel width
- * @param y Centre the string around this pixel height
- * @param str String to draw
- * @param maxw Maximum width the string can have before it is wrapped */
-void DrawStringMultiCenter(int x, int y, StringID str, int maxw)
-{
- DrawStringMultiLine(x - maxw / 2, x + maxw / 2, y - 1024, y + 1024, str, SA_CENTER);
-}
-
/** Return the string dimension in pixels. The height and width are returned
* in a single Dimension value. TINYFONT, BIGFONT modifiers are only
* supported as the first character of the string. The returned dimensions