mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r17830) -Fix [FS#3276]: Some windows already need their window_number when setting up smallest size (e.g. for DParams). So assign it earlier in Window::InitializeData instead of dealing with each window separately.
This commit is contained in:
parent
b06da82c62
commit
21fdc65ce4
@ -206,7 +206,6 @@ public:
|
|||||||
this->sel_engine[0] = INVALID_ENGINE;
|
this->sel_engine[0] = INVALID_ENGINE;
|
||||||
this->sel_engine[1] = INVALID_ENGINE;
|
this->sel_engine[1] = INVALID_ENGINE;
|
||||||
|
|
||||||
this->window_number = vehicletype;
|
|
||||||
this->InitNested(desc, vehicletype);
|
this->InitNested(desc, vehicletype);
|
||||||
|
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(RVW_WIDGET_LEFT_MATRIX)->current_y / this->resize.step_height);
|
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(RVW_WIDGET_LEFT_MATRIX)->current_y / this->resize.step_height);
|
||||||
|
@ -230,11 +230,9 @@ struct DepotWindow : Window {
|
|||||||
this->type = type;
|
this->type = type;
|
||||||
|
|
||||||
this->CreateNestedTree(desc);
|
this->CreateNestedTree(desc);
|
||||||
|
|
||||||
this->window_number = tile;
|
|
||||||
this->SetupWidgetData(type);
|
this->SetupWidgetData(type);
|
||||||
|
|
||||||
this->FinishInitNested(desc, tile);
|
this->FinishInitNested(desc, tile);
|
||||||
|
|
||||||
this->owner = GetTileOwner(tile);
|
this->owner = GetTileOwner(tile);
|
||||||
this->CreateDepotListWindow(type);
|
this->CreateDepotListWindow(type);
|
||||||
}
|
}
|
||||||
|
@ -917,6 +917,14 @@ static void AssignWidgetToWindow(Window *w, const Widget *widget)
|
|||||||
*/
|
*/
|
||||||
void Window::InitializeData(WindowClass cls, const Widget *widget, int window_number)
|
void Window::InitializeData(WindowClass cls, const Widget *widget, int window_number)
|
||||||
{
|
{
|
||||||
|
/* Set up window properties; some of them are needed to set up smallest size below */
|
||||||
|
this->window_class = cls;
|
||||||
|
this->flags4 = WF_WHITE_BORDER_MASK; // just opened windows have a white border
|
||||||
|
this->owner = INVALID_OWNER;
|
||||||
|
this->focused_widget = NULL;
|
||||||
|
this->nested_focus = NULL;
|
||||||
|
this->window_number = window_number;
|
||||||
|
|
||||||
/* If available, initialize nested widget tree. */
|
/* If available, initialize nested widget tree. */
|
||||||
if (widget == NULL) {
|
if (widget == NULL) {
|
||||||
if (this->nested_array == NULL) {
|
if (this->nested_array == NULL) {
|
||||||
@ -930,17 +938,11 @@ void Window::InitializeData(WindowClass cls, const Widget *widget, int window_nu
|
|||||||
}
|
}
|
||||||
/* Else, all data members of nested widgets have been set to 0 by the #ZeroedMemoryAllocator base class. */
|
/* Else, all data members of nested widgets have been set to 0 by the #ZeroedMemoryAllocator base class. */
|
||||||
|
|
||||||
/* Set up window properties,
|
/* Further set up window properties,
|
||||||
* this->left, this->top, this->width, this->height, this->resize.width, and this->resize.height are initialized later. */
|
* this->left, this->top, this->width, this->height, this->resize.width, and this->resize.height are initialized later. */
|
||||||
this->window_class = cls;
|
|
||||||
this->flags4 = WF_WHITE_BORDER_MASK; // just opened windows have a white border
|
|
||||||
this->owner = INVALID_OWNER;
|
|
||||||
AssignWidgetToWindow(this, widget);
|
AssignWidgetToWindow(this, widget);
|
||||||
this->focused_widget = NULL;
|
|
||||||
this->nested_focus = NULL;
|
|
||||||
this->resize.step_width = (this->nested_root != NULL) ? this->nested_root->resize_x : 1;
|
this->resize.step_width = (this->nested_root != NULL) ? this->nested_root->resize_x : 1;
|
||||||
this->resize.step_height = (this->nested_root != NULL) ? this->nested_root->resize_y : 1;
|
this->resize.step_height = (this->nested_root != NULL) ? this->nested_root->resize_y : 1;
|
||||||
this->window_number = window_number;
|
|
||||||
|
|
||||||
/* Give focus to the opened window unless it is the OSK window or a text box
|
/* Give focus to the opened window unless it is the OSK window or a text box
|
||||||
* of focused window has focus (so we don't interrupt typing). But if the new
|
* of focused window has focus (so we don't interrupt typing). But if the new
|
||||||
|
Loading…
Reference in New Issue
Block a user