(svn r9449) -Fix: Truncate the newgrf information text in the newgrf gui if it's too long.

This commit is contained in:
maedhros
2007-03-25 16:09:36 +00:00
parent 4a1f9286dd
commit 68248cad4f
3 changed files with 22 additions and 15 deletions

View File

@@ -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 (;;) {