1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-19 12:39:11 +00:00

Codechange: Remove deferred nested_array initialization path. (#11640)

Having two ways (`FillNestedArray` and `SetupSmallestSize`) to initialize
`Window::nested_array` introduces confusion.

Instead, make `FillNestedArray` the canonical way, always call it, and remove
init_array from `SetupSmallestSize`.
This commit is contained in:
2023-12-29 14:27:04 +00:00
committed by GitHub
parent 11ba951250
commit feb94d233d
9 changed files with 48 additions and 83 deletions

View File

@@ -106,7 +106,7 @@ public:
this->Add(leaf);
}
void SetupSmallestSize(Window *w, bool init_array) override
void SetupSmallestSize(Window *w) override
{
this->smallest_y = 0; // Biggest child.
this->fill_x = 1;
@@ -116,7 +116,7 @@ public:
/* First initialise some variables... */
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) {
child_wid->SetupSmallestSize(w, init_array);
child_wid->SetupSmallestSize(w);
this->smallest_y = std::max(this->smallest_y, child_wid->smallest_y + child_wid->padding.Vertical());
}