mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: use ranged for loop to determine widest title
This commit is contained in:
parent
d183d8e587
commit
87dbd4a833
|
@ -141,11 +141,11 @@ public:
|
|||
this->ordinal_width += WidgetDimensions::scaled.hsep_wide; // Keep some extra spacing
|
||||
|
||||
uint widest_width = 0;
|
||||
uint widest_title = 0;
|
||||
for (uint i = 0; i < lengthof(_performance_titles); i++) {
|
||||
uint width = GetStringBoundingBox(_performance_titles[i]).width;
|
||||
StringID widest_title = STR_NULL;
|
||||
for (auto title : _performance_titles) {
|
||||
uint width = GetStringBoundingBox(title).width;
|
||||
if (width > widest_width) {
|
||||
widest_title = i;
|
||||
widest_title = title;
|
||||
widest_width = width;
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ public:
|
|||
for (const Company *c : Company::Iterate()) {
|
||||
SetDParam(0, c->index);
|
||||
SetDParam(1, c->index);
|
||||
SetDParam(2, _performance_titles[widest_title]);
|
||||
SetDParam(2, widest_title);
|
||||
widest_width = std::max(widest_width, GetStringBoundingBox(STR_COMPANY_LEAGUE_COMPANY_NAME).width);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue