summaryrefslogtreecommitdiff
path: root/src/gfx.cpp
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-03-26 08:04:29 +0000
committermaedhros <maedhros@openttd.org>2007-03-26 08:04:29 +0000
commite496aaac1ff0360e650846cfd258eb0126c99f11 (patch)
treed5366723f248b481d999e2e80183bb6cffd437c5 /src/gfx.cpp
parent5cc99a51d99f055dd9dabb95a1d019de8c7c874a (diff)
downloadopenttd-e496aaac1ff0360e650846cfd258eb0126c99f11.tar.xz
(svn r9472) -Fix (r9449): num is the number of newlines in the string, not the number of lines. Also allow for maxh being negative.
Diffstat (limited to 'src/gfx.cpp')
-rw-r--r--src/gfx.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index ae2bd18f9..8797c7739 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -548,10 +548,11 @@ uint DrawStringMultiLine(int x, int y, StringID str, int maxw, int maxh)
mt = GetCharacterHeight((FontSize)GB(tmp, 16, 16));
total_height = (num + 1) * mt;
- if (maxh != -1 && total_height > (uint)maxh) {
- num = maxh / mt - 1;
- if (num < 1) return 0;
+ if (maxh != -1 && (int)total_height > maxh) {
+ /* Check there's room enough for at least one line. */
+ if (maxh < mt) return 0;
+ num = maxh / mt - 1;
total_height = (num + 1) * mt;
}