1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-26 05:34:12 +01:00

Codechange: Simplify some calls to DrawStringMultiLine(). (#13643)

Sometimes the bottom is passed as UINT16_MAX for no reason. In this case just pass the rect.

Other times it's to extend the window height; in that case just extend the rect itself.
This commit is contained in:
Peter Nelson
2025-02-22 20:41:40 +00:00
committed by GitHub
parent b264a4864b
commit 4ac81656ee
4 changed files with 11 additions and 13 deletions

View File

@@ -234,6 +234,7 @@ public:
Rect tr = r;
const int bottom = tr.bottom;
/* Use all the available space past the rect, so that we can enlarge the window if needed. */
tr.bottom = INT16_MAX;
tr.top = DrawBadgeNameList(tr, spec->badges, GSF_OBJECTS);
@@ -247,9 +248,6 @@ public:
StringID message = GetGRFStringID(spec->grf_prop.grfid, GRFSTR_MISC_GRF_TEXT + callback_res);
if (message != STR_NULL && message != STR_UNDEFINED) {
StartTextRefStackUsage(spec->grf_prop.grffile, 6);
/* Use all the available space left from where we stand up to the
* end of the window. We ALSO enlarge the window if needed, so we
* can 'go' wild with the bottom of the window. */
tr.top = DrawStringMultiLine(tr, message, TC_ORANGE);
StopTextRefStackUsage();
}