(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.

This commit is contained in:
frosch
2013-05-26 19:23:42 +00:00
parent 5e7603154d
commit 25adefca23
61 changed files with 488 additions and 482 deletions

View File

@@ -569,13 +569,13 @@ struct RefitWindow : public Window {
return &l[this->sel[1]];
}
RefitWindow(const WindowDesc *desc, const Vehicle *v, VehicleOrderID order, bool auto_refit) : Window()
RefitWindow(WindowDesc *desc, const Vehicle *v, VehicleOrderID order, bool auto_refit) : Window(desc)
{
this->sel[0] = -1;
this->sel[1] = 0;
this->auto_refit = auto_refit;
this->order = order;
this->CreateNestedTree(desc);
this->CreateNestedTree();
this->vscroll = this->GetScrollbar(WID_VR_SCROLLBAR);
this->hscroll = (v->IsGroundVehicle() ? this->GetScrollbar(WID_VR_HSCROLLBAR) : NULL);
@@ -587,7 +587,7 @@ struct RefitWindow : public Window {
this->GetWidget<NWidgetStacked>(WID_VR_SHOW_HSCROLLBAR)->SetDisplayedPlane(v->IsGroundVehicle() ? 0 : SZSP_HORIZONTAL);
this->GetWidget<NWidgetCore>(WID_VR_VEHICLE_PANEL_DISPLAY)->tool_tip = (v->type == VEH_TRAIN) ? STR_REFIT_SELECT_VEHICLES_TOOLTIP : STR_NULL;
this->FinishInitNested(desc, v->index);
this->FinishInitNested(v->index);
this->owner = v->owner;
this->SetWidgetDisabledState(WID_VR_REFIT, this->sel[0] < 0);
@@ -999,7 +999,7 @@ static const NWidgetPart _nested_vehicle_refit_widgets[] = {
EndContainer(),
};
static const WindowDesc _vehicle_refit_desc(
static WindowDesc _vehicle_refit_desc(
WDP_AUTO, 240, 174,
WC_VEHICLE_REFIT, WC_VEHICLE_VIEW,
WDF_CONSTRUCTION,
@@ -1421,7 +1421,7 @@ private:
};
public:
VehicleListWindow(const WindowDesc *desc, WindowNumber window_number) : BaseVehicleListWindow(window_number)
VehicleListWindow(WindowDesc *desc, WindowNumber window_number) : BaseVehicleListWindow(desc, window_number)
{
/* Set up sorting. Make the window-specific _sorting variable
* point to the correct global _sorting struct so we are freed
@@ -1434,7 +1434,7 @@ public:
default: NOT_REACHED();
}
this->CreateNestedTree(desc);
this->CreateNestedTree();
this->vscroll = this->GetScrollbar(WID_VL_SCROLLBAR);
@@ -1453,7 +1453,7 @@ public:
this->GetWidget<NWidgetCore>(WID_VL_CAPTION)->widget_data = STR_VEHICLE_LIST_TRAIN_CAPTION + this->vli.vtype;
}
this->FinishInitNested(desc, window_number);
this->FinishInitNested(window_number);
if (this->vli.company != OWNER_NONE) this->owner = this->vli.company;
if (this->vli.vtype == VEH_TRAIN) ResizeWindow(this, 65, 0);
@@ -1835,13 +1835,13 @@ struct VehicleDetailsWindow : Window {
Scrollbar *vscroll;
/** Initialize a newly created vehicle details window */
VehicleDetailsWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
VehicleDetailsWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
{
const Vehicle *v = Vehicle::Get(window_number);
this->CreateNestedTree(desc);
this->CreateNestedTree();
this->vscroll = (v->type == VEH_TRAIN ? this->GetScrollbar(WID_VD_SCROLLBAR) : NULL);
this->FinishInitNested(desc, window_number);
this->FinishInitNested(window_number);
this->GetWidget<NWidgetCore>(WID_VD_RENAME_VEHICLE)->tool_tip = STR_VEHICLE_DETAILS_TRAIN_RENAME + v->type;
@@ -2201,7 +2201,7 @@ struct VehicleDetailsWindow : Window {
};
/** Vehicle details window descriptor. */
static const WindowDesc _train_vehicle_details_desc(
static WindowDesc _train_vehicle_details_desc(
WDP_AUTO, 405, 178,
WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW,
0,
@@ -2209,7 +2209,7 @@ static const WindowDesc _train_vehicle_details_desc(
);
/** Vehicle details window descriptor for other vehicles than a train. */
static const WindowDesc _nontrain_vehicle_details_desc(
static WindowDesc _nontrain_vehicle_details_desc(
WDP_AUTO, 405, 113,
WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW,
0,
@@ -2268,7 +2268,7 @@ static const NWidgetPart _nested_vehicle_view_widgets[] = {
};
/** Vehicle view window descriptor for all vehicles but trains. */
static const WindowDesc _vehicle_view_desc(
static WindowDesc _vehicle_view_desc(
WDP_AUTO, 250, 116,
WC_VEHICLE_VIEW, WC_NONE,
0,
@@ -2279,7 +2279,7 @@ static const WindowDesc _vehicle_view_desc(
* Vehicle view window descriptor for trains. Only minimum_height and
* default_height are different for train view.
*/
static const WindowDesc _train_view_desc(
static WindowDesc _train_view_desc(
WDP_AUTO, 250, 134,
WC_VEHICLE_VIEW, WC_NONE,
0,
@@ -2416,9 +2416,9 @@ private:
}
public:
VehicleViewWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
VehicleViewWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
{
this->CreateNestedTree(desc);
this->CreateNestedTree();
/* Sprites for the 'send to depot' button indexed by vehicle type. */
static const SpriteID vehicle_view_goto_depot_sprites[] = {
@@ -2454,7 +2454,7 @@ public:
default: NOT_REACHED();
}
this->FinishInitNested(desc, window_number);
this->FinishInitNested(window_number);
this->owner = v->owner;
this->GetWidget<NWidgetViewport>(WID_VV_VIEWPORT)->InitializeViewport(this, this->window_number | (1 << 31), _vehicle_view_zoom_levels[v->type]);