From 56e4a8c4d63b19cb037ac1ba64c5a4d7fde4350b Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 26 May 2013 19:23:42 +0000 Subject: (svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction. --- src/industry_gui.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/industry_gui.cpp') diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 1b79ebbd0..356c6b77b 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -187,7 +187,7 @@ static const NWidgetPart _nested_build_industry_widgets[] = { }; /** Window definition of the dynamic place industries gui */ -static const WindowDesc _build_industry_desc( +static WindowDesc _build_industry_desc( WDP_AUTO, 170, 212, WC_BUILD_INDUSTRY, WC_NONE, WDF_CONSTRUCTION, @@ -265,7 +265,7 @@ class BuildIndustryWindow : public Window { } public: - BuildIndustryWindow() : Window() + BuildIndustryWindow() : Window(&_build_industry_desc) { this->timer_enabled = _loaded_newgrf_features.has_newindustries; @@ -274,9 +274,9 @@ public: this->callback_timer = DAY_TICKS; - this->CreateNestedTree(&_build_industry_desc); + this->CreateNestedTree(); this->vscroll = this->GetScrollbar(WID_DPI_SCROLLBAR); - this->FinishInitNested(&_build_industry_desc, 0); + this->FinishInitNested(0); this->SetButtons(); } @@ -654,7 +654,7 @@ class IndustryViewWindow : public Window int info_height; ///< Height needed for the #WID_IV_INFO panel public: - IndustryViewWindow(const WindowDesc *desc, WindowNumber window_number) : Window() + IndustryViewWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc) { this->flags |= WF_DISABLE_VP_SCROLL; this->editbox_line = IL_NONE; @@ -662,7 +662,7 @@ public: this->clicked_button = 0; this->info_height = WD_FRAMERECT_TOP + 2 * FONT_HEIGHT_NORMAL + WD_FRAMERECT_BOTTOM + 1; // Info panel has at least two lines text. - this->InitNested(desc, window_number); + this->InitNested(window_number); NWidgetViewport *nvp = this->GetWidget(WID_IV_VIEWPORT); nvp->InitializeViewport(this, Industry::Get(window_number)->location.GetCenterTile(), ZOOM_LVL_INDUSTRY); @@ -1017,7 +1017,7 @@ static const NWidgetPart _nested_industry_view_widgets[] = { }; /** Window definition of the view industry gui */ -static const WindowDesc _industry_view_desc( +static WindowDesc _industry_view_desc( WDP_AUTO, 260, 120, WC_INDUSTRY_VIEW, WC_NONE, 0, @@ -1213,9 +1213,9 @@ protected: } public: - IndustryDirectoryWindow(const WindowDesc *desc, WindowNumber number) : Window() + IndustryDirectoryWindow(WindowDesc *desc, WindowNumber number) : Window(desc) { - this->CreateNestedTree(desc); + this->CreateNestedTree(); this->vscroll = this->GetScrollbar(WID_ID_SCROLLBAR); this->industries.SetListing(this->last_sorting); @@ -1223,7 +1223,7 @@ public: this->industries.ForceRebuild(); this->BuildSortIndustriesList(); - this->FinishInitNested(desc, 0); + this->FinishInitNested(0); } ~IndustryDirectoryWindow() @@ -1388,7 +1388,7 @@ const StringID IndustryDirectoryWindow::sorter_names[] = { /** Window definition of the industry directory gui */ -static const WindowDesc _industry_directory_desc( +static WindowDesc _industry_directory_desc( WDP_AUTO, 428, 190, WC_INDUSTRY_DIRECTORY, WC_NONE, 0, @@ -1429,7 +1429,7 @@ static const NWidgetPart _nested_industry_cargoes_widgets[] = { }; /** Window description for the industry cargoes window. */ -static const WindowDesc _industry_cargoes_desc( +static WindowDesc _industry_cargoes_desc( WDP_AUTO, 300, 210, WC_INDUSTRY_CARGOES, WC_NONE, 0, @@ -2036,12 +2036,12 @@ struct IndustryCargoesWindow : public Window { Dimension ind_textsize; ///< Size to hold any industry type text, as well as STR_INDUSTRY_CARGOES_SELECT_INDUSTRY. Scrollbar *vscroll; - IndustryCargoesWindow(int id) : Window() + IndustryCargoesWindow(int id) : Window(&_industry_cargoes_desc) { this->OnInit(); - this->CreateNestedTree(&_industry_cargoes_desc); + this->CreateNestedTree(); this->vscroll = this->GetScrollbar(WID_IC_SCROLLBAR); - this->FinishInitNested(&_industry_cargoes_desc, 0); + this->FinishInitNested(0); this->OnInvalidateData(id); } -- cgit v1.2.3-70-g09d2