mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 23:50:25 +00:00
(svn r9472) -Fix (r9449): num is the number of newlines in the string, not the number of lines. Also allow for maxh being negative.
This commit is contained in:
parent
fea5d98518
commit
c2312c37d6
@ -548,10 +548,11 @@ uint DrawStringMultiLine(int x, int y, StringID str, int maxw, int maxh)
|
|||||||
mt = GetCharacterHeight((FontSize)GB(tmp, 16, 16));
|
mt = GetCharacterHeight((FontSize)GB(tmp, 16, 16));
|
||||||
total_height = (num + 1) * mt;
|
total_height = (num + 1) * mt;
|
||||||
|
|
||||||
if (maxh != -1 && total_height > (uint)maxh) {
|
if (maxh != -1 && (int)total_height > maxh) {
|
||||||
num = maxh / mt - 1;
|
/* Check there's room enough for at least one line. */
|
||||||
if (num < 1) return 0;
|
if (maxh < mt) return 0;
|
||||||
|
|
||||||
|
num = maxh / mt - 1;
|
||||||
total_height = (num + 1) * mt;
|
total_height = (num + 1) * mt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user