From 4f1758b51a9b0c74a63f9dafaabba51860189ba8 Mon Sep 17 00:00:00 2001 From: alberth Date: Sun, 16 Aug 2009 16:06:06 +0000 Subject: (svn r17204) -Codechange: Move viewport initialization into the constructor of the news item window. --- src/news_gui.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 4b4f03189..25dc6af8f 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -193,6 +193,24 @@ struct NewsWindow : Window { this->flags4 |= WF_DISABLE_VP_SCROLL; this->FindWindowPlacementAndResize(desc); + + const NewsMode display_mode = _news_subtype_data[this->ni->subtype].display_mode; + switch (display_mode) { + case NM_NORMAL: + break; + + case NM_THIN: + InitializeWindowViewport(this, 2, 58, 426, 70, + ni->reftype1 == NR_VEHICLE ? 0x80000000 | ni->ref1 : GetReferenceTile(ni->reftype1, ni->ref1), ZOOM_LVL_NEWS); + break; + + case NM_SMALL: + InitializeWindowViewport(this, 3, 17, 274, 47, + ni->reftype1 == NR_VEHICLE ? 0x80000000 | ni->ref1 : GetReferenceTile(ni->reftype1, ni->ref1), ZOOM_LVL_NEWS); + break; + + default: NOT_REACHED(); + } } void DrawNewsBorder() @@ -430,17 +448,11 @@ static void ShowNewspaper(NewsItem *ni) case NM_THIN: _thin_news_desc.top = top; w = new NewsWindow(&_thin_news_desc, ni); - - InitializeWindowViewport(w, 2, 58, 426, 70, - ni->reftype1 == NR_VEHICLE ? 0x80000000 | ni->ref1 : GetReferenceTile(ni->reftype1, ni->ref1), ZOOM_LVL_NEWS); break; case NM_SMALL: _smalll_news_desc.top = top; w = new NewsWindow(&_smalll_news_desc, ni); - - InitializeWindowViewport(w, 3, 17, 274, 47, - ni->reftype1 == NR_VEHICLE ? 0x80000000 | ni->ref1 : GetReferenceTile(ni->reftype1, ni->ref1), ZOOM_LVL_NEWS); break; default: NOT_REACHED(); -- cgit v1.2.3-54-g00ecf