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:
Peter Nelson
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

@@ -1623,16 +1623,16 @@ public:
this->editable = true; // Temporary setting, 'real' value is set in SetupSmallestSize().
}
void SetupSmallestSize(Window *w, bool init_array) override
void SetupSmallestSize(Window *w) override
{
/* Copy state flag from the window. */
assert(dynamic_cast<NewGRFWindow *>(w) != nullptr);
NewGRFWindow *ngw = (NewGRFWindow *)w;
this->editable = ngw->editable;
this->avs->SetupSmallestSize(w, init_array);
this->acs->SetupSmallestSize(w, init_array);
this->inf->SetupSmallestSize(w, init_array);
this->avs->SetupSmallestSize(w);
this->acs->SetupSmallestSize(w);
this->inf->SetupSmallestSize(w);
uint min_avs_width = this->avs->smallest_x + this->avs->padding.Horizontal();
uint min_acs_width = this->acs->smallest_x + this->acs->padding.Horizontal();