(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.
This commit is contained in:
@@ -415,9 +415,9 @@ struct BuildRailToolbarWindow : Window {
|
||||
RailType railtype; ///< Rail type to build.
|
||||
int last_user_action; ///< Last started user action.
|
||||
|
||||
BuildRailToolbarWindow(const WindowDesc *desc, RailType railtype) : Window()
|
||||
BuildRailToolbarWindow(WindowDesc *desc, RailType railtype) : Window(desc)
|
||||
{
|
||||
this->InitNested(desc, TRANSPORT_RAIL);
|
||||
this->InitNested(TRANSPORT_RAIL);
|
||||
this->SetupRailToolbar(railtype);
|
||||
this->DisableWidget(WID_RAT_REMOVE);
|
||||
this->last_user_action = WIDGET_LIST_END;
|
||||
@@ -819,7 +819,7 @@ static const NWidgetPart _nested_build_rail_widgets[] = {
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
static const WindowDesc _build_rail_desc(
|
||||
static WindowDesc _build_rail_desc(
|
||||
WDP_ALIGN_TOOLBAR, 0, 0,
|
||||
WC_BUILD_TOOLBAR, WC_NONE,
|
||||
WDF_CONSTRUCTION,
|
||||
@@ -912,20 +912,20 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
BuildRailStationWindow(const WindowDesc *desc, Window *parent, bool newstation) : PickerWindowBase(parent)
|
||||
BuildRailStationWindow(WindowDesc *desc, Window *parent, bool newstation) : PickerWindowBase(desc, parent)
|
||||
{
|
||||
this->coverage_height = 2 * FONT_HEIGHT_NORMAL + 3 * WD_PAR_VSEP_NORMAL;
|
||||
this->vscroll = NULL;
|
||||
_railstation.newstations = newstation;
|
||||
|
||||
this->CreateNestedTree(desc);
|
||||
this->CreateNestedTree();
|
||||
NWidgetStacked *newst_additions = this->GetWidget<NWidgetStacked>(WID_BRAS_SHOW_NEWST_ADDITIONS);
|
||||
newst_additions->SetDisplayedPlane(newstation ? 0 : SZSP_NONE);
|
||||
newst_additions = this->GetWidget<NWidgetStacked>(WID_BRAS_SHOW_NEWST_MATRIX);
|
||||
newst_additions->SetDisplayedPlane(newstation ? 0 : SZSP_NONE);
|
||||
newst_additions = this->GetWidget<NWidgetStacked>(WID_BRAS_SHOW_NEWST_RESIZE);
|
||||
newst_additions->SetDisplayedPlane(newstation ? 0 : SZSP_NONE);
|
||||
this->FinishInitNested(desc, TRANSPORT_RAIL);
|
||||
this->FinishInitNested(TRANSPORT_RAIL);
|
||||
|
||||
this->LowerWidget(_railstation.orientation + WID_BRAS_PLATFORM_DIR_X);
|
||||
if (_settings_client.gui.station_dragdrop) {
|
||||
@@ -1427,7 +1427,7 @@ static const NWidgetPart _nested_station_builder_widgets[] = {
|
||||
};
|
||||
|
||||
/** High level window description of the station-build window (default & newGRF) */
|
||||
static const WindowDesc _station_builder_desc(
|
||||
static WindowDesc _station_builder_desc(
|
||||
WDP_AUTO, 350, 0,
|
||||
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
|
||||
WDF_CONSTRUCTION,
|
||||
@@ -1475,9 +1475,9 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
BuildSignalWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent)
|
||||
BuildSignalWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
{
|
||||
this->InitNested(desc, TRANSPORT_RAIL);
|
||||
this->InitNested(TRANSPORT_RAIL);
|
||||
this->OnInvalidateData();
|
||||
}
|
||||
|
||||
@@ -1614,7 +1614,7 @@ static const NWidgetPart _nested_signal_builder_widgets[] = {
|
||||
};
|
||||
|
||||
/** Signal selection window description */
|
||||
static const WindowDesc _signal_builder_desc(
|
||||
static WindowDesc _signal_builder_desc(
|
||||
WDP_AUTO, 0, 0,
|
||||
WC_BUILD_SIGNAL, WC_BUILD_TOOLBAR,
|
||||
WDF_CONSTRUCTION,
|
||||
@@ -1630,9 +1630,9 @@ static void ShowSignalBuilder(Window *parent)
|
||||
}
|
||||
|
||||
struct BuildRailDepotWindow : public PickerWindowBase {
|
||||
BuildRailDepotWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent)
|
||||
BuildRailDepotWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
{
|
||||
this->InitNested(desc, TRANSPORT_RAIL);
|
||||
this->InitNested(TRANSPORT_RAIL);
|
||||
this->LowerWidget(_build_depot_direction + WID_BRAD_DEPOT_NE);
|
||||
}
|
||||
|
||||
@@ -1691,7 +1691,7 @@ static const NWidgetPart _nested_build_depot_widgets[] = {
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
static const WindowDesc _build_depot_desc(
|
||||
static WindowDesc _build_depot_desc(
|
||||
WDP_AUTO, 0, 0,
|
||||
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
|
||||
WDF_CONSTRUCTION,
|
||||
@@ -1704,14 +1704,14 @@ static void ShowBuildTrainDepotPicker(Window *parent)
|
||||
}
|
||||
|
||||
struct BuildRailWaypointWindow : PickerWindowBase {
|
||||
BuildRailWaypointWindow(const WindowDesc *desc, Window *parent) : PickerWindowBase(parent)
|
||||
BuildRailWaypointWindow(WindowDesc *desc, Window *parent) : PickerWindowBase(desc, parent)
|
||||
{
|
||||
this->CreateNestedTree(desc);
|
||||
this->CreateNestedTree();
|
||||
|
||||
NWidgetMatrix *matrix = this->GetWidget<NWidgetMatrix>(WID_BRW_WAYPOINT_MATRIX);
|
||||
matrix->SetScrollbar(this->GetScrollbar(WID_BRW_SCROLL));
|
||||
|
||||
this->FinishInitNested(desc, TRANSPORT_RAIL);
|
||||
this->FinishInitNested(TRANSPORT_RAIL);
|
||||
|
||||
matrix->SetCount(_waypoint_count);
|
||||
matrix->SetClicked(_cur_waypoint_type);
|
||||
@@ -1784,7 +1784,7 @@ static const NWidgetPart _nested_build_waypoint_widgets[] = {
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
static const WindowDesc _build_waypoint_desc(
|
||||
static WindowDesc _build_waypoint_desc(
|
||||
WDP_AUTO, 0, 0,
|
||||
WC_BUILD_WAYPOINT, WC_BUILD_TOOLBAR,
|
||||
WDF_CONSTRUCTION,
|
||||
|
Reference in New Issue
Block a user