diff options
author | maedhros <maedhros@openttd.org> | 2007-03-25 16:09:36 +0000 |
---|---|---|
committer | maedhros <maedhros@openttd.org> | 2007-03-25 16:09:36 +0000 |
commit | 1a70cf53ff1890eaef5652975d0c16857ed9ecbb (patch) | |
tree | ad997b5cfb54a6cc8631757210a2d71acde0bfe7 /src/gfx.cpp | |
parent | f56fbbfed96629e5fb2f32ffd4ea97e4eb0c646e (diff) | |
download | openttd-1a70cf53ff1890eaef5652975d0c16857ed9ecbb.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.cpp | 9 |
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 (;;) { |