summaryrefslogtreecommitdiff
path: root/src/gfx.cpp
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-03-25 16:09:36 +0000
committermaedhros <maedhros@openttd.org>2007-03-25 16:09:36 +0000
commit68248cad4ffaa1d755c8e9f16f8d7fc1180c3ae1 (patch)
treead997b5cfb54a6cc8631757210a2d71acde0bfe7 /src/gfx.cpp
parent4a1f9286dd2c5c8b3366c7430b3690fbdb21685b (diff)
downloadopenttd-68248cad4ffaa1d755c8e9f16f8d7fc1180c3ae1.tar.xz
(svn r9449) -Fix: Truncate the newgrf information text in the newgrf gui if it's too long.
Diffstat (limited to 'src/gfx.cpp')
-rw-r--r--src/gfx.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp
index d6d1f8f25..ae2bd18f9 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -531,7 +531,7 @@ void DrawStringMultiCenter(int x, int y, StringID str, int maxw)
}
-uint DrawStringMultiLine(int x, int y, StringID str, int maxw)
+uint DrawStringMultiLine(int x, int y, StringID str, int maxw, int maxh)
{
char buffer[512];
uint32 tmp;
@@ -548,6 +548,13 @@ uint DrawStringMultiLine(int x, int y, StringID str, int maxw)
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;
+
+ total_height = (num + 1) * mt;
+ }
+
src = buffer;
for (;;) {