summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-08-16 16:06:06 +0000
committeralberth <alberth@openttd.org>2009-08-16 16:06:06 +0000
commit4f1758b51a9b0c74a63f9dafaabba51860189ba8 (patch)
tree1a7f570cd9e83e99d01d398c1d43645152482f0f
parentc89621540cff7a9a61e1769c8c465858324cc039 (diff)
downloadopenttd-4f1758b51a9b0c74a63f9dafaabba51860189ba8.tar.xz
(svn r17204) -Codechange: Move viewport initialization into the constructor of the news item window.
-rw-r--r--src/news_gui.cpp24
1 files 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();