diff options
author | frosch <frosch@openttd.org> | 2013-05-26 19:23:42 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2013-05-26 19:23:42 +0000 |
commit | 56e4a8c4d63b19cb037ac1ba64c5a4d7fde4350b (patch) | |
tree | f3e5c225182fce7a451af4e09e943920e0f1cc3c /src/news_gui.cpp | |
parent | b10a4f151aa534860dcc61ecf8cba7b3589e6281 (diff) | |
download | openttd-56e4a8c4d63b19cb037ac1ba64c5a4d7fde4350b.tar.xz |
(svn r25287) -Codechange: Keep a reference to the WindowDesc in the Window after construction.
Diffstat (limited to 'src/news_gui.cpp')
-rw-r--r-- | src/news_gui.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/news_gui.cpp b/src/news_gui.cpp index a0c9bdbd2..67ef03678 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -89,7 +89,7 @@ static const NWidgetPart _nested_normal_news_widgets[] = { EndContainer(), }; -static const WindowDesc _normal_news_desc( +static WindowDesc _normal_news_desc( WDP_MANUAL, 0, 0, WC_NEWS_WINDOW, WC_NONE, 0, @@ -116,7 +116,7 @@ static const NWidgetPart _nested_vehicle_news_widgets[] = { EndContainer(), }; -static const WindowDesc _vehicle_news_desc( +static WindowDesc _vehicle_news_desc( WDP_MANUAL, 0, 0, WC_NEWS_WINDOW, WC_NONE, 0, @@ -147,7 +147,7 @@ static const NWidgetPart _nested_company_news_widgets[] = { EndContainer(), }; -static const WindowDesc _company_news_desc( +static WindowDesc _company_news_desc( WDP_MANUAL, 0, 0, WC_NEWS_WINDOW, WC_NONE, 0, @@ -170,7 +170,7 @@ static const NWidgetPart _nested_thin_news_widgets[] = { EndContainer(), }; -static const WindowDesc _thin_news_desc( +static WindowDesc _thin_news_desc( WDP_MANUAL, 0, 0, WC_NEWS_WINDOW, WC_NONE, 0, @@ -194,7 +194,7 @@ static const NWidgetPart _nested_small_news_widgets[] = { EndContainer(), }; -static const WindowDesc _small_news_desc( +static WindowDesc _small_news_desc( WDP_MANUAL, 0, 0, WC_NEWS_WINDOW, WC_NONE, 0, @@ -204,7 +204,7 @@ static const WindowDesc _small_news_desc( /** * Window layouts for news items. */ -static const WindowDesc* _news_window_layout[] = { +static WindowDesc* _news_window_layout[] = { &_thin_news_desc, ///< NF_THIN &_small_news_desc, ///< NF_SMALL &_normal_news_desc, ///< NF_NORMAL @@ -212,7 +212,7 @@ static const WindowDesc* _news_window_layout[] = { &_company_news_desc, ///< NF_COMPANY }; -const WindowDesc* GetNewsWindowLayout(NewsFlag flags) +WindowDesc* GetNewsWindowLayout(NewsFlag flags) { uint layout = GB(flags, NFB_WINDOW_LAYOUT, NFB_WINDOW_LAYOUT_COUNT); assert(layout < lengthof(_news_window_layout)); @@ -263,7 +263,7 @@ struct NewsWindow : Window { const NewsItem *ni; ///< News item to display. static uint duration; ///< Remaining time for showing current news message (may only be accessed while a news item is displayed). - NewsWindow(const WindowDesc *desc, const NewsItem *ni) : Window(), ni(ni) + NewsWindow(WindowDesc *desc, const NewsItem *ni) : Window(desc), ni(ni) { NewsWindow::duration = 555; const Window *w = FindWindowByClass(WC_SEND_NETWORK_MSG); @@ -272,12 +272,12 @@ struct NewsWindow : Window { this->flags |= WF_DISABLE_VP_SCROLL; - this->CreateNestedTree(desc); + this->CreateNestedTree(); /* For company news with a face we have a separate headline in param[0] */ if (desc == &_company_news_desc) this->GetWidget<NWidgetCore>(WID_N_TITLE)->widget_data = this->ni->params[0]; - this->FinishInitNested(desc, 0); + this->FinishInitNested(0); /* Initialize viewport if it exists. */ NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_N_VIEWPORT); @@ -304,7 +304,7 @@ struct NewsWindow : Window { GfxFillRect(r.left, r.bottom, r.right, r.bottom, PC_BLACK); } - virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number) + virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) { Point pt = { 0, _screen.height }; return pt; @@ -996,11 +996,11 @@ struct MessageHistoryWindow : Window { Scrollbar *vscroll; - MessageHistoryWindow(const WindowDesc *desc) : Window() + MessageHistoryWindow(WindowDesc *desc) : Window(desc) { - this->CreateNestedTree(desc); + this->CreateNestedTree(); this->vscroll = this->GetScrollbar(WID_MH_SCROLLBAR); - this->FinishInitNested(desc); // Initializes 'this->line_height' and 'this->date_width'. + this->FinishInitNested(); // Initializes 'this->line_height' and 'this->date_width'. this->OnInvalidateData(0); } @@ -1109,7 +1109,7 @@ static const NWidgetPart _nested_message_history[] = { EndContainer(), }; -static const WindowDesc _message_history_desc( +static WindowDesc _message_history_desc( WDP_AUTO, 400, 140, WC_MESSAGE_HISTORY, WC_NONE, 0, |