summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-08-29 17:00:32 +0000
committeralberth <alberth@openttd.org>2009-08-29 17:00:32 +0000
commit79a8da1c046dcb21ad86a03d7713ceb9fada5480 (patch)
treea497f35d01e47b39ba183f54cd1e7009c12cbb05
parent9eb06f125fa913d73c9202651d1715816afa1360 (diff)
downloadopenttd-79a8da1c046dcb21ad86a03d7713ceb9fada5480.tar.xz
(svn r17306) -Fix: DrawStringMultiLine() computed available width and height wrongly.
-rw-r--r--src/gfx.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index 0e442b472..0662c18c5 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -748,8 +748,8 @@ int GetStringHeight(StringID str, int maxw)
*/
int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str, TextColour colour, StringAlignment align, bool underline)
{
- int maxw = right - left;
- int maxh = bottom - top;
+ int maxw = right - left + 1;
+ int maxh = bottom - top + 1;
char buffer[DRAW_STRING_BUFFER];
GetString(buffer, str, lastof(buffer));
@@ -760,7 +760,7 @@ int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str,
int mt = GetCharacterHeight((FontSize)GB(tmp, 16, 16));
int total_height = (num + 1) * mt;
- if (maxh != -1 && (int)total_height > maxh) {
+ if (maxh != 0 && total_height > maxh) {
/* Check there's room enough for at least one line. */
if (maxh < mt) return top;