diff options
author | alberth <alberth@openttd.org> | 2010-07-02 13:54:05 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2010-07-02 13:54:05 +0000 |
commit | e3bb01a7c4bc89099156f421cde4904065434faf (patch) | |
tree | bd3f54614e6b0e84e05c1185ff85121a36094e82 /src | |
parent | 22b9bc515730e40ad834a5295d9421afeaf8802e (diff) | |
download | openttd-e3bb01a7c4bc89099156f421cde4904065434faf.tar.xz |
(svn r20044) -Codechange: Using number of lines rather than number of added lines simplifies code.
Diffstat (limited to 'src')
-rw-r--r-- | src/gfx.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gfx.cpp b/src/gfx.cpp index fa9611bf1..221437ff9 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -842,17 +842,17 @@ int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str, GetString(buffer, str, lastof(buffer)); uint32 tmp = FormatStringLinebreaks(buffer, lastof(buffer), maxw); - int num = GB(tmp, 0, 16); + int num = GB(tmp, 0, 16) + 1; int mt = GetCharacterHeight((FontSize)GB(tmp, 16, 16)); - int total_height = (num + 1) * mt; + int total_height = num * mt; if (total_height > maxh) { /* Check there's room enough for at least one line. */ if (maxh < mt) return top; - num = maxh / mt - 1; - total_height = (num + 1) * mt; + num = maxh / mt; + total_height = num * mt; } int y = ((align & SA_VERT_MASK) == SA_VERT_CENTER) ? RoundDivSU(bottom + top - total_height, 2) : top; @@ -869,7 +869,7 @@ int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str, WChar c = Utf8Consume(&src); if (c == 0) { y += mt; - if (--num < 0) { + if (--num <= 0) { return y; } break; |