(svn r12459) -Codechange: split news.h into news_type.h and news_func.h.
authorrubidium
Fri, 28 Mar 2008 08:53:36 +0000
changeset 8763 81fadd257f67
parent 8762 bbe195577e21
child 8764 771b642c60e0
(svn r12459) -Codechange: split news.h into news_type.h and news_func.h.
src/aircraft_cmd.cpp
src/autoreplace_cmd.cpp
src/currency.cpp
src/disaster_cmd.cpp
src/economy.cpp
src/engine.cpp
src/engine_gui.cpp
src/industry_cmd.cpp
src/main_gui.cpp
src/misc.cpp
src/news.h
src/news_func.h
src/news_gui.cpp
src/news_type.h
src/openttd.cpp
src/openttd.h
src/order_cmd.cpp
src/players.cpp
src/roadveh_cmd.cpp
src/settings.cpp
src/ship_cmd.cpp
src/station.cpp
src/station_cmd.cpp
src/strings.cpp
src/town_cmd.cpp
src/train_cmd.cpp
src/vehicle.cpp
src/water_cmd.cpp
src/window_gui.h
--- a/src/aircraft_cmd.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/aircraft_cmd.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -13,7 +13,7 @@
 #include "depot.h"
 #include "engine.h"
 #include "station.h"
-#include "news.h"
+#include "news_func.h"
 #include "aircraft.h"
 #include "airport.h"
 #include "vehicle_gui.h"
@@ -1465,7 +1465,7 @@
 
 	SetDParam(1, st->index);
 	AddNewsItem(newsitem,
-		NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
+		NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
 		v->index,
 		0);
 
@@ -1505,15 +1505,12 @@
 
 	/* Check if station was ever visited before */
 	if (!(st->had_vehicle_of_type & HVOT_AIRCRAFT)) {
-		uint32 flags;
-
 		st->had_vehicle_of_type |= HVOT_AIRCRAFT;
 		SetDParam(0, st->index);
 		/* show newsitem of celebrating citizens */
-		flags = (v->owner == _local_player) ? NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_PLAYER, 0) : NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_OTHER, 0);
 		AddNewsItem(
 			STR_A033_CITIZENS_CELEBRATE_FIRST,
-			flags,
+			NM_THIN, NF_VIEWPORT | NF_VEHICLE, (v->owner == _local_player) ? NT_ARRIVAL_PLAYER : NT_ARRIVAL_OTHER, DNC_NONE,
 			v->index,
 			0);
 	}
--- a/src/autoreplace_cmd.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/autoreplace_cmd.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -4,7 +4,7 @@
 #include "openttd.h"
 #include "roadveh.h"
 #include "ship.h"
-#include "news.h"
+#include "news_func.h"
 #include "player_func.h"
 #include "engine.h"
 #include "debug.h"
@@ -377,7 +377,7 @@
 					default: NOT_REACHED(); message = 0; break;
 				}
 
-				AddNewsItem(message, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0), v->index, 0);
+				AddNewsItem(message, NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, DNC_NONE, v->index, 0);
 			}
 			if (stopped) v->vehstatus &= ~VS_STOPPED;
 			if (display_costs) _current_player = OWNER_NONE;
@@ -408,7 +408,7 @@
 			if (w == NULL) {
 				// we failed to make the train short enough
 				SetDParam(0, v->unitnumber);
-				AddNewsItem(STR_TRAIN_TOO_LONG_AFTER_REPLACEMENT, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0), v->index, 0);
+				AddNewsItem(STR_TRAIN_TOO_LONG_AFTER_REPLACEMENT, NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE, v->index, 0);
 				break;
 			}
 			temp = w;
--- a/src/currency.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/currency.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -5,7 +5,7 @@
 #include "stdafx.h"
 #include "openttd.h"
 #include "currency.h"
-#include "news.h"
+#include "news_func.h"
 #include "settings_type.h"
 #include "date_func.h"
 
@@ -154,7 +154,7 @@
 			_currency_specs[_opt.currency].to_euro != CF_ISEURO &&
 			_cur_year >= _currency_specs[_opt.currency].to_euro) {
 		_opt.currency = 2; // this is the index of euro above.
-		AddNewsItem(STR_EURO_INTRODUCE, NEWS_FLAGS(NM_NORMAL, 0, NT_ECONOMY, 0), 0, 0);
+		AddNewsItem(STR_EURO_INTRODUCE, NM_NORMAL, NF_NONE, NT_ECONOMY, DNC_NONE, 0, 0);
 	}
 }
 
--- a/src/disaster_cmd.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/disaster_cmd.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -24,7 +24,7 @@
 #include "station_map.h"
 #include "command_func.h"
 #include "tile_cmd.h"
-#include "news.h"
+#include "news_func.h"
 #include "station.h"
 #include "waypoint.h"
 #include "town.h"
@@ -233,7 +233,7 @@
 
 				SetDParam(0, GetStationIndex(tile));
 				AddNewsItem(STR_B000_ZEPPELIN_DISASTER_AT,
-					NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
+					NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
 					v->index,
 					0);
 			}
@@ -366,7 +366,7 @@
 				u->vehstatus |= VS_CRASHED;
 
 				AddNewsItem(STR_B001_ROAD_VEHICLE_DESTROYED,
-					NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
+					NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
 					u->index,
 					0);
 			}
@@ -441,7 +441,7 @@
 			DestructIndustry(i);
 
 			SetDParam(0, i->town->index);
-			AddNewsItem(STR_B002_OIL_REFINERY_EXPLOSION, NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0), i->xy, 0);
+			AddNewsItem(STR_B002_OIL_REFINERY_EXPLOSION, NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, DNC_NONE, i->xy, 0);
 			SndPlayTileFx(SND_12_EXPLOSION, i->xy);
 		}
 	} else if (v->current_order.dest == 0) {
@@ -514,7 +514,7 @@
 			DestructIndustry(i);
 
 			SetDParam(0, i->town->index);
-			AddNewsItem(STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS, NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0), i->xy, 0);
+			AddNewsItem(STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS, NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, DNC_NONE, i->xy, 0);
 			SndPlayTileFx(SND_12_EXPLOSION, i->xy);
 		}
 	} else if (v->current_order.dest == 0) {
@@ -599,7 +599,7 @@
 		t = ClosestTownFromTile(v->dest_tile, (uint)-1);
 		SetDParam(0, t->index);
 		AddNewsItem(STR_B004_UFO_LANDS_NEAR,
-			NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0),
+			NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, DNC_NONE,
 			v->tile,
 			0);
 
@@ -977,7 +977,7 @@
 			if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_CAN_SUBSIDENCE) && --index < 0) {
 				SetDParam(0, i->town->index);
 				AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES,
-					NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0), i->xy + TileDiffXY(1, 1), 0);
+					NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, DNC_NONE, i->xy + TileDiffXY(1, 1), 0);
 
 				{
 					TileIndex tile = i->xy;
--- a/src/economy.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/economy.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -6,7 +6,6 @@
 #include "openttd.h"
 #include "currency.h"
 #include "landscape.h"
-#include "news.h"
 #include "player_base.h"
 #include "player_func.h"
 #include "station.h"
@@ -14,6 +13,7 @@
 #include "saveload.h"
 #include "industry.h"
 #include "town.h"
+#include "news_func.h"
 #include "network/network.h"
 #include "engine.h"
 #include "network/network_data.h"
@@ -513,15 +513,15 @@
 
 	switch (p->quarters_of_bankrupcy) {
 		case 2:
-			AddNewsItem( (StringID)(owner | NB_BTROUBLE),
-				NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
+			AddNewsItem((StringID)(owner | NB_BTROUBLE),
+				NM_CALLBACK, NF_NONE, NT_COMPANY_INFO, DNC_BANKRUPCY, 0, 0);
 			break;
 		case 3: {
 			/* XXX - In multiplayer, should we ask other players if it wants to take
 		          over when it is a human company? -- TrueLight */
 			if (IsHumanPlayer(owner)) {
-				AddNewsItem( (StringID)(owner | NB_BTROUBLE),
-					NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
+				AddNewsItem((StringID)(owner | NB_BTROUBLE),
+					NM_CALLBACK, NF_NONE, NT_COMPANY_INFO, DNC_BANKRUPCY, 0, 0);
 				break;
 			}
 
@@ -542,7 +542,7 @@
 
 			/* Show bankrupt news */
 			SetDParam(0, p->index);
-			AddNewsItem( (StringID)(owner | NB_BBANKRUPT), NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
+			AddNewsItem((StringID)(owner | NB_BBANKRUPT), NM_CALLBACK, NF_NONE, NT_COMPANY_INFO, DNC_BANKRUPCY, 0, 0);
 
 			if (IsHumanPlayer(owner)) {
 				/* XXX - If we are in offline mode, leave the player playing. Eg. there
@@ -568,11 +568,10 @@
 	}
 }
 
-void DrawNewsBankrupcy(Window *w)
+void DrawNewsBankrupcy(Window *w, const NewsItem *ni)
 {
 	DrawNewsBorder(w);
 
-	const NewsItem *ni = WP(w, news_d).ni;
 	Player *p = GetPlayer((PlayerID)GB(ni->string_id, 0, 4));
 	DrawPlayerFace(p->face, p->player_color, 2, 23);
 	GfxFillRect(3, 23, 3 + 91, 23 + 118, PALETTE_TO_STRUCT_GREY | (1 << USE_COLORTABLE));
@@ -786,10 +785,10 @@
 
 	if (--_economy.fluct == 0) {
 		_economy.fluct = -(int)GB(Random(), 0, 2);
-		AddNewsItem(STR_7073_WORLD_RECESSION_FINANCIAL, NEWS_FLAGS(NM_NORMAL,0,NT_ECONOMY,0), 0, 0);
+		AddNewsItem(STR_7073_WORLD_RECESSION_FINANCIAL, NM_NORMAL, NF_NONE, NT_ECONOMY, DNC_NONE, 0, 0);
 	} else if (_economy.fluct == -12) {
 		_economy.fluct = GB(Random(), 0, 8) + 312;
-		AddNewsItem(STR_7074_RECESSION_OVER_UPTURN_IN, NEWS_FLAGS(NM_NORMAL,0,NT_ECONOMY,0), 0, 0);
+		AddNewsItem(STR_7074_RECESSION_OVER_UPTURN_IN, NM_NORMAL, NF_NONE, NT_ECONOMY, DNC_NONE, 0, 0);
 	}
 }
 
@@ -1129,14 +1128,14 @@
 
 		if (s->age == 12-1) {
 			pair = SetupSubsidyDecodeParam(s, 1);
-			AddNewsItem(STR_202E_OFFER_OF_SUBSIDY_EXPIRED, NEWS_FLAGS(NM_NORMAL, NF_TILE, NT_SUBSIDIES, 0), pair.a, pair.b);
+			AddNewsItem(STR_202E_OFFER_OF_SUBSIDY_EXPIRED, NM_NORMAL, NF_TILE, NT_SUBSIDIES, DNC_NONE, pair.a, pair.b);
 			s->cargo_type = CT_INVALID;
 			modified = true;
 		} else if (s->age == 2*12-1) {
 			st = GetStation(s->to);
 			if (st->owner == _local_player) {
 				pair = SetupSubsidyDecodeParam(s, 1);
-				AddNewsItem(STR_202F_SUBSIDY_WITHDRAWN_SERVICE, NEWS_FLAGS(NM_NORMAL, NF_TILE, NT_SUBSIDIES, 0), pair.a, pair.b);
+				AddNewsItem(STR_202F_SUBSIDY_WITHDRAWN_SERVICE, NM_NORMAL, NF_TILE, NT_SUBSIDIES, DNC_NONE, pair.a, pair.b);
 			}
 			s->cargo_type = CT_INVALID;
 			modified = true;
@@ -1175,7 +1174,7 @@
 				if (!CheckSubsidyDuplicate(s)) {
 					s->age = 0;
 					pair = SetupSubsidyDecodeParam(s, 0);
-					AddNewsItem(STR_2030_SERVICE_SUBSIDY_OFFERED, NEWS_FLAGS(NM_NORMAL, NF_TILE, NT_SUBSIDIES, 0), pair.a, pair.b);
+					AddNewsItem(STR_2030_SERVICE_SUBSIDY_OFFERED, NM_NORMAL, NF_TILE, NT_SUBSIDIES, DNC_NONE, pair.a, pair.b);
 					modified = true;
 					break;
 				}
@@ -1392,7 +1391,7 @@
 			SetDParam(0, _current_player);
 			AddNewsItem(
 				STR_2031_SERVICE_SUBSIDY_AWARDED + _opt.diff.subsidy_multiplier,
-				NEWS_FLAGS(NM_NORMAL, NF_TILE, NT_SUBSIDIES, 0),
+				NM_NORMAL, NF_TILE, NT_SUBSIDIES, DNC_NONE,
 				pair.a, pair.b
 			);
 
@@ -1829,7 +1828,7 @@
 
 	SetDParam(0, p->index);
 	SetDParam(1, p->bankrupt_value);
-	AddNewsItem( (StringID)(_current_player | NB_BMERGER), NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
+	AddNewsItem((StringID)(_current_player | NB_BMERGER), NM_CALLBACK, NF_NONE, NT_COMPANY_INFO, DNC_BANKRUPCY, 0, 0);
 
 	/* original code does this a little bit differently */
 	PlayerID pi = p->index;
--- a/src/engine.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/engine.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -9,7 +9,7 @@
 #include "player_base.h"
 #include "player_func.h"
 #include "command_func.h"
-#include "news.h"
+#include "news_func.h"
 #include "saveload.h"
 #include "variables.h"
 #include "train.h"
@@ -338,7 +338,7 @@
 			if (p->is_active) SetBit(p->avail_roadtypes, HasBit(EngInfo(index)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
 		}
 	}
-	AddNewsItem(index, NEWS_FLAGS(NM_CALLBACK, 0, NT_NEW_VEHICLES, DNC_VEHICLEAVAIL), 0, 0);
+	AddNewsItem(index, NM_CALLBACK, NF_NONE, NT_NEW_VEHICLES, DNC_VEHICLEAVAIL, 0, 0);
 }
 
 void EnginesMonthlyLoop()
--- a/src/engine_gui.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/engine_gui.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -10,7 +10,7 @@
 #include "engine.h"
 #include "command_func.h"
 #include "economy_func.h"
-#include "news.h"
+#include "news_func.h"
 #include "variables.h"
 #include "newgrf_engine.h"
 #include "strings_func.h"
@@ -182,11 +182,11 @@
 	return STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE;
 }
 
-void DrawNewsNewVehicleAvail(Window *w)
+void DrawNewsNewVehicleAvail(Window *w, const NewsItem *ni)
 {
 	DrawNewsBorder(w);
 
-	EngineID engine = WP(w, news_d).ni->string_id;
+	EngineID engine = ni->string_id;
 	const DrawEngineInfo *dei = &_draw_engine_list[GetEngine(engine)->type];
 
 	SetDParam(0, GetEngineCategoryName(engine));
--- a/src/industry_cmd.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/industry_cmd.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -13,7 +13,7 @@
 #include "command_func.h"
 #include "industry.h"
 #include "town.h"
-#include "news.h"
+#include "news_func.h"
 #include "saveload.h"
 #include "variables.h"
 #include "genworld.h"
@@ -1641,7 +1641,7 @@
 							SetDParam(1, ind->town->index);
 						}
 						AddNewsItem(indspec->new_industry_text,
-								NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_OPENCLOSE, 0), ind->xy, 0);
+								NM_THIN, NF_VIEWPORT | NF_TILE, NT_OPENCLOSE, DNC_NONE, ind->xy, 0);
 						break;
 					}
 				}
@@ -1860,7 +1860,7 @@
 		SetDParam(1, ind->town->index);
 	}
 	AddNewsItem(ind_spc->new_industry_text,
-		NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_OPENCLOSE, 0), ind->xy, 0);
+		NM_THIN, NF_VIEWPORT | NF_TILE, NT_OPENCLOSE, DNC_NONE, ind->xy, 0);
 }
 
 /**
@@ -2003,7 +2003,7 @@
 	SetDParam(1, ind->index);
 	AddNewsItem(
 		percent >= 0 ? STR_INDUSTRY_PROD_GOUP : STR_INDUSTRY_PROD_GODOWN,
-		NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, nt, 0),
+		NM_THIN, NF_VIEWPORT | NF_TILE, nt, DNC_NONE,
 		ind->xy + TileDiffXY(1, 1), 0
 	);
 }
@@ -2196,7 +2196,7 @@
 		}
 		/* and report the news to the user */
 		AddNewsItem(str,
-			NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, nt, 0),
+			NM_THIN, NF_VIEWPORT | NF_TILE, nt, DNC_NONE,
 			i->xy + TileDiffXY(1, 1), 0);
 	}
 }
--- a/src/main_gui.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/main_gui.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -13,7 +13,7 @@
 #include "textbuf_gui.h"
 #include "viewport_func.h"
 #include "command_func.h"
-#include "news.h"
+#include "news_func.h"
 #include "town.h"
 #include "console.h"
 #include "signs.h"
--- a/src/misc.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/misc.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -6,7 +6,7 @@
 #include "openttd.h"
 #include "currency.h"
 #include "landscape.h"
-#include "news.h"
+#include "news_func.h"
 #include "saveload.h"
 #include "engine.h"
 #include "vehicle_gui.h"
--- a/src/news.h	Fri Mar 28 04:57:32 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-/* $Id$ */
-
-/** @file news.h */
-
-#ifndef NEWS_H
-#define NEWS_H
-
-#include "window_type.h"
-#include "vehicle_type.h"
-#include "tile_type.h"
-#include "date_type.h"
-#include "strings_type.h"
-
-struct NewsItem {
-	StringID string_id; ///< Message text (sometimes also used for storing other info)
-	uint16 duration;    ///< Remaining time for showing this news message
-	Date date;          ///< Date of the news
-	byte flags;         ///< NewsFlags bits @see NewsFlags
-	byte display_mode;  ///< Display mode value @see NewsMode
-	byte type;          ///< News category @see NewsType
-	byte callback;      ///< Call-back function
-
-	TileIndex data_a;   ///< Reference to tile or vehicle
-	TileIndex data_b;   ///< Reference to second tile or vehicle
-
-	uint64 params[10];
-};
-
-typedef bool ValidationProc ( uint data_a, uint data_b );
-typedef void DrawNewsCallbackProc(Window *w);
-typedef StringID GetNewsStringCallbackProc(const NewsItem *ni);
-
-/**
- * Macro for creating news flags.
- * @param mode (bits 0 - 7) Display_mode, one of the NewsMode enums (NM_)
- * @param flag (bits 8 - 15) OR-able news flags, any of the NewsFlags enums (NF_)
- * @param type (bits 16-23) News category, one of the NewsType enums (NT_)
- * @param cb (bits 24-31) Call-back function, one of the NewsCallback enums (DNC_) or 0 if no callback
- * @see NewsMode
- * @see NewsFlags
- * @see NewsType
- * @see NewsCallback
- * @see AddNewsItem
- */
-#define NEWS_FLAGS(mode, flag, type, cb) ((cb) << 24 | (type) << 16 | (flag) << 8 | (mode))
-
-void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b);
-void NewsLoop();
-void DrawNewsBorder(const Window *w);
-void InitNewsItemStructs();
-
-extern NewsItem _statusbar_news_item;
-extern uint32 _news_display_opt;
-extern bool _news_ticker_sound;
-
-/** Type of news. */
-enum NewsType {
-	NT_ARRIVAL_PLAYER,  ///< Cargo arrived for player
-	NT_ARRIVAL_OTHER,   ///< Cargo arrived for competitor
-	NT_ACCIDENT,        ///< An accident or disaster has occurred
-	NT_COMPANY_INFO,    ///< Company info (new companies, bankrupcy messages)
-	NT_OPENCLOSE,       ///< Opening and closing of industries
-	NT_ECONOMY,         ///< Economic changes (recession, industry up/dowm)
-	NT_INDUSTRY_PLAYER, ///< Production changes of industry serviced by local player
-	NT_INDUSTRY_OTHER,  ///< Production changes of industry serviced by competitor(s)
-	NT_INDUSTRY_NOBODY, ///< Other industry production changes
-	NT_ADVICE,          ///< Bits of news about vehicles of the player
-	NT_NEW_VEHICLES,    ///< New vehicle has become available
-	NT_ACCEPTANCE,      ///< A type of cargo is (no longer) accepted
-	NT_SUBSIDIES,       ///< News about subsidies (announcements, expirations, acceptance)
-	NT_GENERAL,         ///< General news (from towns)
-	NT_END,             ///< end-of-array marker
-};
-
-extern const char *_news_display_name[NT_END];
-
-/**
- * News mode.
- * @see NEWS_FLAGS
- */
-enum NewsMode {
-	NM_SMALL    = 0, ///< Show only a small popup informing us about vehicle age for example
-	NM_NORMAL   = 1, ///< Show a simple news message (height 170 pixels)
-	NM_THIN     = 2, ///< Show a simple news message (height 130 pixels)
-	NM_CALLBACK = 3, ///< Do some special processing before displaying news message. Which callback to call is in NewsCallback
-};
-
-/**
- * Various OR-able news-item flags.
- * note: NF_INCOLOR is set automatically if needed
- * @see NEWS_FLAGS
- */
-enum NewsFlags {
-	NF_VIEWPORT  = (1 << 1), ///< Does the news message have a viewport? (ingame picture of happening)
-	NF_TILE      = (1 << 2), ///< When clicked on the news message scroll to a given tile? Tile is in data_a/data_b
-	NF_VEHICLE   = (1 << 3), ///< When clicked on the message scroll to the vehicle? VehicleID is in data_a
-	NF_FORCE_BIG = (1 << 4), ///< Force the appearance of a news message if it has already been shown (internal)
-	NF_INCOLOR   = (1 << 5), ///< Show the newsmessage in colour, otherwise it defaults to black & white
-};
-
-/** Special news items */
-enum NewsCallback {
-	DNC_VEHICLEAVAIL  = 0, ///< Show new vehicle available message. StringID is EngineID
-	DNC_BANKRUPCY     = 1, ///< Show bankrupcy message. StringID is PlayerID (0-3) and NewsBankrupcy (4-7)
-};
-
-/** Kinds of bankrupcy */
-enum NewsBankrupcy {
-	NB_BTROUBLE    = (1 << 4), ///< Company is in trouble (warning)
-	NB_BMERGER     = (2 << 4), ///< Company has been bought by another company
-	NB_BBANKRUPT   = (3 << 4), ///< Company has gone bankrupt
-	NB_BNEWCOMPANY = (4 << 4), ///< A new company has been started
-};
-
-/**
- * Delete a news item type about a vehicle
- * if the news item type is INVALID_STRING_ID all news about the vehicle get
- * deleted
- */
-void DeleteVehicleNews(VehicleID, StringID news);
-
-#endif /* NEWS_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/news_func.h	Fri Mar 28 08:53:36 2008 +0000
@@ -0,0 +1,29 @@
+/* $Id$ */
+
+/** @file news_func.h Functions related to news. */
+
+#ifndef NEWS_FUNC_H
+#define NEWS_FUNC_H
+
+#include "news_type.h"
+#include "vehicle_type.h"
+
+void AddNewsItem(StringID string, NewsMode mode, NewsFlag flag, NewsType type, NewsCallback callback, uint data_a, uint data_b);
+void NewsLoop();
+void DrawNewsBorder(const Window *w);
+void InitNewsItemStructs();
+
+extern NewsItem _statusbar_news_item;
+extern uint32 _news_display_opt;
+extern bool _news_ticker_sound;
+
+extern const char *_news_display_name[NT_END];
+
+/**
+ * Delete a news item type about a vehicle
+ * if the news item type is INVALID_STRING_ID all news about the vehicle get
+ * deleted
+ */
+void DeleteVehicleNews(VehicleID, StringID news);
+
+#endif /* NEWS_FUNC_H */
--- a/src/news_gui.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/news_gui.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -6,7 +6,7 @@
 #include "gui.h"
 #include "window_gui.h"
 #include "viewport_func.h"
-#include "news.h"
+#include "news_func.h"
 #include "settings_type.h"
 #include "transparency.h"
 #include "strings_func.h"
@@ -60,6 +60,16 @@
 static NewsID _oldest_news = 0;             ///< points to first item in fifo queue
 static NewsID _latest_news = INVALID_NEWS;  ///< points to last item in fifo queue
 
+struct news_d {
+	uint16 follow_vehicle;
+	int32 scrollpos_x;
+	int32 scrollpos_y;
+	int32 dest_scrollpos_x;
+	int32 dest_scrollpos_y;
+	NewsItem *ni;
+};
+assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(news_d));
+
 /** Forced news item.
  * Users can force an item by accessing the history or "last message".
  * If the message being shown was forced by the user, its index is stored in
@@ -68,8 +78,8 @@
 
 static byte _total_news = 0; ///< Number of news items in FIFO queue @see _news_items
 
-void DrawNewsNewVehicleAvail(Window *w);
-void DrawNewsBankrupcy(Window *w);
+void DrawNewsNewVehicleAvail(Window *w, const NewsItem *ni);
+void DrawNewsBankrupcy(Window *w, const NewsItem *ni);
 static void MoveToNextItem();
 
 StringID GetNewsStringNewVehicleAvail(const NewsItem *ni);
@@ -117,118 +127,118 @@
 static void NewsWindowProc(Window *w, WindowEvent *e)
 {
 	switch (e->event) {
-	case WE_CREATE: { // If chatbar is open at creation time, we need to go above it
-		const Window *w1 = FindWindowById(WC_SEND_NETWORK_MSG, 0);
-		w->message.msg = (w1 != NULL) ? w1->height : 0;
-	} break;
-
-	case WE_PAINT: {
-		const NewsItem *ni = WP(w, news_d).ni;
-		ViewPort *vp;
-
-		switch (ni->display_mode) {
-			case NM_NORMAL:
-			case NM_THIN: {
-				DrawNewsBorder(w);
-
-				DrawString(2, 1, STR_00C6, TC_FROMSTRING);
-
-				SetDParam(0, ni->date);
-				DrawStringRightAligned(428, 1, STR_01FF, TC_FROMSTRING);
-
-				if (!(ni->flags & NF_VIEWPORT)) {
-					CopyInDParam(0, ni->params, lengthof(ni->params));
-					DrawStringMultiCenter(215, ni->display_mode == NM_NORMAL ? 76 : 56,
-						ni->string_id, w->width - 4);
-				} else {
-					/* Back up transparency options to draw news view */
-					TransparencyOptionBits to_backup = _transparency_opt;
-					_transparency_opt = 0;
-					DrawWindowViewport(w);
-					_transparency_opt = to_backup;
-
-					/* Shade the viewport into gray, or color*/
-					vp = w->viewport;
-					GfxFillRect(vp->left - w->left, vp->top - w->top,
-						vp->left - w->left + vp->width - 1, vp->top - w->top + vp->height - 1,
-						(ni->flags & NF_INCOLOR ? PALETTE_TO_TRANSPARENT : PALETTE_TO_STRUCT_GREY) | (1 << USE_COLORTABLE)
-					);
+		case WE_CREATE: { // If chatbar is open at creation time, we need to go above it
+			const Window *w1 = FindWindowById(WC_SEND_NETWORK_MSG, 0);
+			w->message.msg = (w1 != NULL) ? w1->height : 0;
+		} break;
 
-					CopyInDParam(0, ni->params, lengthof(ni->params));
-					DrawStringMultiCenter(w->width / 2, 20, ni->string_id, w->width - 4);
-				}
-				break;
-			}
+		case WE_PAINT: {
+			const NewsItem *ni = WP(w, news_d).ni;
+			ViewPort *vp;
 
-			case NM_CALLBACK: {
-				_draw_news_callback[ni->callback](w);
-				break;
-			}
+			switch (ni->display_mode) {
+				case NM_NORMAL:
+				case NM_THIN: {
+					DrawNewsBorder(w);
 
-			default: {
-				DrawWindowWidgets(w);
-				if (!(ni->flags & NF_VIEWPORT)) {
-					CopyInDParam(0, ni->params, lengthof(ni->params));
-					DrawStringMultiCenter(140, 38, ni->string_id, 276);
-				} else {
-					DrawWindowViewport(w);
-					CopyInDParam(0, ni->params, lengthof(ni->params));
-					DrawStringMultiCenter(w->width / 2, w->height - 16, ni->string_id, w->width - 4);
+					DrawString(2, 1, STR_00C6, TC_FROMSTRING);
+
+					SetDParam(0, ni->date);
+					DrawStringRightAligned(428, 1, STR_01FF, TC_FROMSTRING);
+
+					if (!(ni->flags & NF_VIEWPORT)) {
+						CopyInDParam(0, ni->params, lengthof(ni->params));
+						DrawStringMultiCenter(215, ni->display_mode == NM_NORMAL ? 76 : 56,
+							ni->string_id, w->width - 4);
+					} else {
+						/* Back up transparency options to draw news view */
+						TransparencyOptionBits to_backup = _transparency_opt;
+						_transparency_opt = 0;
+						DrawWindowViewport(w);
+						_transparency_opt = to_backup;
+
+						/* Shade the viewport into gray, or color*/
+						vp = w->viewport;
+						GfxFillRect(vp->left - w->left, vp->top - w->top,
+							vp->left - w->left + vp->width - 1, vp->top - w->top + vp->height - 1,
+							(ni->flags & NF_INCOLOR ? PALETTE_TO_TRANSPARENT : PALETTE_TO_STRUCT_GREY) | (1 << USE_COLORTABLE)
+						);
+
+						CopyInDParam(0, ni->params, lengthof(ni->params));
+						DrawStringMultiCenter(w->width / 2, 20, ni->string_id, w->width - 4);
+					}
+					break;
 				}
-				break;
-			}
-		}
-	} break;
 
-	case WE_CLICK: {
-		switch (e->we.click.widget) {
-		case 1: {
-			NewsItem *ni = WP(w, news_d).ni;
-			DeleteWindow(w);
-			ni->duration = 0;
-			_forced_news = INVALID_NEWS;
-		} break;
-		case 0: {
-			NewsItem *ni = WP(w, news_d).ni;
-			if (ni->flags & NF_VEHICLE) {
-				Vehicle *v = GetVehicle(ni->data_a);
-				ScrollMainWindowTo(v->x_pos, v->y_pos);
-			} else if (ni->flags & NF_TILE) {
-				if (!ScrollMainWindowToTile(ni->data_a) && ni->data_b != 0)
-					ScrollMainWindowToTile(ni->data_b);
+				case NM_CALLBACK: {
+					_draw_news_callback[ni->callback](w, ni);
+					break;
+				}
+
+				default: {
+					DrawWindowWidgets(w);
+					if (!(ni->flags & NF_VIEWPORT)) {
+						CopyInDParam(0, ni->params, lengthof(ni->params));
+						DrawStringMultiCenter(140, 38, ni->string_id, 276);
+					} else {
+						DrawWindowViewport(w);
+						CopyInDParam(0, ni->params, lengthof(ni->params));
+						DrawStringMultiCenter(w->width / 2, w->height - 16, ni->string_id, w->width - 4);
+					}
+					break;
+				}
 			}
 		} break;
-		}
-	} break;
-
-	case WE_KEYPRESS:
-		if (e->we.keypress.keycode == WKC_SPACE) {
-			/* Don't continue. */
-			e->we.keypress.cont = false;
-			DeleteWindow(w);
-		}
-		break;
 
-	case WE_MESSAGE: // The chatbar has notified us that is was either created or closed
-		switch (e->we.message.msg) {
-			case WE_CREATE: w->message.msg = e->we.message.wparam; break;
-			case WE_DESTROY: w->message.msg = 0; break;
-		}
-		break;
+		case WE_CLICK: {
+			switch (e->we.click.widget) {
+			case 1: {
+				NewsItem *ni = WP(w, news_d).ni;
+				DeleteWindow(w);
+				ni->duration = 0;
+				_forced_news = INVALID_NEWS;
+			} break;
+			case 0: {
+				NewsItem *ni = WP(w, news_d).ni;
+				if (ni->flags & NF_VEHICLE) {
+					Vehicle *v = GetVehicle(ni->data_a);
+					ScrollMainWindowTo(v->x_pos, v->y_pos);
+				} else if (ni->flags & NF_TILE) {
+					if (!ScrollMainWindowToTile(ni->data_a) && ni->data_b != 0)
+						ScrollMainWindowToTile(ni->data_b);
+				}
+			} break;
+			}
+		} break;
 
-	case WE_TICK: { // Scroll up newsmessages from the bottom in steps of 4 pixels
-		int diff;
-		int y = max(w->top - 4, _screen.height - w->height - 12 - w->message.msg);
-		if (y == w->top) return;
+		case WE_KEYPRESS:
+			if (e->we.keypress.keycode == WKC_SPACE) {
+				/* Don't continue. */
+				e->we.keypress.cont = false;
+				DeleteWindow(w);
+			}
+			break;
 
-		if (w->viewport != NULL)
-			w->viewport->top += y - w->top;
+		case WE_MESSAGE: // The chatbar has notified us that is was either created or closed
+			switch (e->we.message.msg) {
+				case WE_CREATE: w->message.msg = e->we.message.wparam; break;
+				case WE_DESTROY: w->message.msg = 0; break;
+			}
+			break;
 
-		diff = Delta(w->top, y);
-		w->top = y;
+		case WE_TICK: { // Scroll up newsmessages from the bottom in steps of 4 pixels
+			int diff;
+			int y = max(w->top - 4, _screen.height - w->height - 12 - w->message.msg);
+			if (y == w->top) return;
 
-		SetDirtyBlocks(w->left, w->top - diff, w->left + w->width, w->top + w->height);
-	} break;
+			if (w->viewport != NULL)
+				w->viewport->top += y - w->top;
+
+			diff = Delta(w->top, y);
+			w->top = y;
+
+			SetDirtyBlocks(w->left, w->top - diff, w->left + w->width, w->top + w->height);
+		} break;
 	}
 }
 
@@ -254,17 +264,15 @@
 
 /**
  * Add a new newsitem to be shown.
- * @param string String to display, can have special values based on parameter \a flags
- * @param flags various control bits that will show various news-types. See macro NEWS_FLAGS()
+ * @param string String to display, can have special values based on parameter \a display_mode
+ * @param display_mode, any of the NewsMode enums (NM_)
+ * @param flags any of the NewsFlag enums (NF_)
+ * @param type news category, any of the NewsType enums (NT_)
+ * @param callback news callback function, any of the NewsCallback enums (DNC_)
  * @param data_a news-specific value based on news type
  * @param data_b news-specific value based on news type
- * @note flags exists of 4 byte-sized extra parameters.
- *  -# Bits  0 -  7 display_mode, any of the NewsMode enums (NM_)
- *  -# Bits  8 - 15 news flags, any of the NewsFlags enums (NF_)
- *  -# Bits 16 - 23 news category, any of the NewsType enums (NT_)
- *  -# Bits 24 - 31 news callback function, any of the NewsCallback enums (DNC_)
  *
- * If the display mode is NM_CALLBACK, special news is shown and parameter
+ * @note If the display mode is NM_CALLBACK, special news is shown and parameter
  * \a string has a special meaning.
  *  - For DNC_TRAINAVAIL, DNC_ROADAVAIL, DNC_SHIPAVAIL, DNC_AIRCRAFTAVAIL messages: StringID is
  *    the index of the engine that is shown
@@ -274,11 +282,11 @@
  *    @see NewsBankrupcy
  *
  * @see NewsMode
- * @see NewsFlags
+ * @see NewsFlag
  * @see NewsType
  * @see NewsCallback
  */
-void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b)
+void AddNewsItem(StringID string, NewsMode display_mode, NewsFlag flags, NewsType type, NewsCallback callback, uint data_a, uint data_b)
 {
 	NewsID l_news;
 
@@ -306,36 +314,33 @@
 	  _current_news, _oldest_news, _latest_news, _forced_news, _total_news);*/
 
 	/* Add news to _latest_news */
-	{
-		Window *w;
-		NewsItem *ni = &_news_items[_latest_news];
-		memset(ni, 0, sizeof(*ni));
-
-		ni->string_id = string;
-		ni->display_mode = (byte)flags;
-		ni->flags = (byte)(flags >> 8);
-
-		/* show this news message in color? */
-		if (_cur_year >= _patches.colored_news_year) ni->flags |= NF_INCOLOR;
+	NewsItem *ni = &_news_items[_latest_news];
+	memset(ni, 0, sizeof(*ni));
 
-		ni->type = (byte)(flags >> 16);
-		ni->callback = (byte)(flags >> 24);
-		ni->data_a = data_a;
-		ni->data_b = data_b;
-		ni->date = _date;
-		CopyOutDParam(ni->params, 0, lengthof(ni->params));
+	ni->string_id = string;
+	ni->display_mode = display_mode;
+	ni->flags = flags;
 
-		w = FindWindowById(WC_MESSAGE_HISTORY, 0);
-		if (w == NULL) return;
-		SetWindowDirty(w);
-		w->vscroll.count = _total_news;
-	}
+	/* show this news message in color? */
+	if (_cur_year >= _patches.colored_news_year) ni->flags |= NF_INCOLOR;
+
+	ni->type = type;
+	ni->callback = callback;
+	ni->data_a = data_a;
+	ni->data_b = data_b;
+	ni->date = _date;
+	CopyOutDParam(ni->params, 0, lengthof(ni->params));
+
+	Window *w = FindWindowById(WC_MESSAGE_HISTORY, 0);
+	if (w == NULL) return;
+	SetWindowDirty(w);
+	w->vscroll.count = _total_news;
 }
 
 
 /**
  * Maximum age of news items.
- * Don't show item if it's older than x days, corresponds with NewsType in news.h
+ * Don't show item if it's older than x days, corresponds with NewsType in news_type.h
  * @see NewsType
  */
 static const byte _news_items_age[NT_END] = {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/news_type.h	Fri Mar 28 08:53:36 2008 +0000
@@ -0,0 +1,96 @@
+/* $Id$ */
+
+/** @file news_type.h Types related to news. */
+
+#ifndef NEWS_TYPE_H
+#define NEWS_TYPE_H
+
+#include "window_type.h"
+#include "date_type.h"
+#include "strings_type.h"
+
+/**
+ * Type of news.
+ */
+enum NewsType {
+	NT_ARRIVAL_PLAYER,  ///< Cargo arrived for player
+	NT_ARRIVAL_OTHER,   ///< Cargo arrived for competitor
+	NT_ACCIDENT,        ///< An accident or disaster has occurred
+	NT_COMPANY_INFO,    ///< Company info (new companies, bankrupcy messages)
+	NT_OPENCLOSE,       ///< Opening and closing of industries
+	NT_ECONOMY,         ///< Economic changes (recession, industry up/dowm)
+	NT_INDUSTRY_PLAYER, ///< Production changes of industry serviced by local player
+	NT_INDUSTRY_OTHER,  ///< Production changes of industry serviced by competitor(s)
+	NT_INDUSTRY_NOBODY, ///< Other industry production changes
+	NT_ADVICE,          ///< Bits of news about vehicles of the player
+	NT_NEW_VEHICLES,    ///< New vehicle has become available
+	NT_ACCEPTANCE,      ///< A type of cargo is (no longer) accepted
+	NT_SUBSIDIES,       ///< News about subsidies (announcements, expirations, acceptance)
+	NT_GENERAL,         ///< General news (from towns)
+	NT_END,             ///< end-of-array marker
+};
+
+/**
+ * News mode.
+ */
+enum NewsMode {
+	NM_SMALL    = 0, ///< Show only a small popup informing us about vehicle age for example
+	NM_NORMAL   = 1, ///< Show a simple news message (height 170 pixels)
+	NM_THIN     = 2, ///< Show a simple news message (height 130 pixels)
+	NM_CALLBACK = 3, ///< Do some special processing before displaying news message. Which callback to call is in NewsCallback
+};
+
+/**
+ * Various OR-able news-item flags.
+ * note: NF_INCOLOR is set automatically if needed
+ */
+enum NewsFlag {
+	NF_NONE      = 0,        ///< No flag is set.
+	NF_VIEWPORT  = (1 << 1), ///< Does the news message have a viewport? (ingame picture of happening)
+	NF_TILE      = (1 << 2), ///< When clicked on the news message scroll to a given tile? Tile is in data_a/data_b
+	NF_VEHICLE   = (1 << 3), ///< When clicked on the message scroll to the vehicle? VehicleID is in data_a
+	NF_FORCE_BIG = (1 << 4), ///< Force the appearance of a news message if it has already been shown (internal)
+	NF_INCOLOR   = (1 << 5), ///< Show the newsmessage in colour, otherwise it defaults to black & white
+};
+DECLARE_ENUM_AS_BIT_SET(NewsFlag);
+
+
+/**
+ * Special news items
+ */
+enum NewsCallback {
+	DNC_VEHICLEAVAIL  = 0,    ///< Show new vehicle available message. StringID is EngineID
+	DNC_BANKRUPCY     = 1,    ///< Show bankrupcy message. StringID is PlayerID (0-3) and NewsBankrupcy (4-7)
+	DNC_NONE          = 0xFF, ///< No news callback.
+};
+
+/**
+ * Kinds of bankrupcy
+ */
+enum NewsBankrupcy {
+	NB_BTROUBLE,    ///< Company is in trouble (warning)
+	NB_BMERGER,     ///< Company has been bought by another company
+	NB_BBANKRUPT,   ///< Company has gone bankrupt
+	NB_BNEWCOMPANY, ///< A new company has been started
+};
+
+struct NewsItem {
+	StringID string_id;    ///< Message text (sometimes also used for storing other info)
+	uint16 duration;       ///< Remaining time for showing this news message
+	Date date;             ///< Date of the news
+	NewsFlag flags;        ///< NewsFlags bits @see NewsFlag
+	NewsMode display_mode; ///< Display mode value @see NewsMode
+	NewsType type;         ///< News category @see NewsType
+	NewsCallback callback; ///< Call-back function
+
+	uint data_a;           ///< Reference to tile or vehicle
+	uint data_b;           ///< Reference to second tile or vehicle
+
+	uint64 params[10];
+};
+
+typedef bool ValidationProc(uint data_a, uint data_b);
+typedef void DrawNewsCallbackProc(Window *w, const NewsItem *ni);
+typedef StringID GetNewsStringCallbackProc(const NewsItem *ni);
+
+#endif /* NEWS_TYPE_H */
--- a/src/openttd.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/openttd.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -28,7 +28,7 @@
 #include "command_func.h"
 #include "town.h"
 #include "industry.h"
-#include "news.h"
+#include "news_func.h"
 #include "engine.h"
 #include "fileio.h"
 #include "fios.h"
--- a/src/openttd.h	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/openttd.h	Fri Mar 28 08:53:36 2008 +0000
@@ -13,7 +13,6 @@
 struct Waypoint;
 struct Station;
 struct ViewPort;
-struct NewsItem;
 struct DrawPixelInfo;
 struct Group;
 typedef byte VehicleOrderID;  ///< The index of an order within its current vehicle (not pool related)
--- a/src/order_cmd.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/order_cmd.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -11,7 +11,7 @@
 #include "command_func.h"
 #include "station.h"
 #include "player_func.h"
-#include "news.h"
+#include "news_func.h"
 #include "saveload.h"
 #include "vehicle_gui.h"
 #include "cargotype.h"
@@ -1135,7 +1135,7 @@
 		SetDParam(0, v->unitnumber);
 		AddNewsItem(
 			message,
-			NEWS_FLAGS(NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, 0),
+			NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE,
 			v->index,
 			0
 		);
--- a/src/players.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/players.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -9,7 +9,7 @@
 #include "player_gui.h"
 #include "town.h"
 #include "station.h"
-#include "news.h"
+#include "news_func.h"
 #include "saveload.h"
 #include "command_func.h"
 #include "network/network.h"
@@ -336,7 +336,7 @@
 
 		if (!IsHumanPlayer(p->index)) {
 			SetDParam(0, t->index);
-			AddNewsItem((StringID)(p->index | NB_BNEWCOMPANY), NEWS_FLAGS(NM_CALLBACK, NF_TILE, NT_COMPANY_INFO, DNC_BANKRUPCY), p->last_build_coordinate, 0);
+			AddNewsItem((StringID)(p->index | NB_BNEWCOMPANY), NM_CALLBACK, NF_TILE, NT_COMPANY_INFO, DNC_BANKRUPCY, p->last_build_coordinate, 0);
 		}
 		return;
 	}
@@ -902,7 +902,7 @@
 
 			/* Show the bankrupt news */
 			SetDParam(0, p->index);
-			AddNewsItem( (StringID)(p->index | NB_BBANKRUPT), NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
+			AddNewsItem((StringID)(p->index | NB_BBANKRUPT), NM_CALLBACK, NF_NONE, NT_COMPANY_INFO, DNC_BANKRUPCY, 0, 0);
 
 			/* Remove the company */
 			ChangeOwnershipOfPlayerItems(p->index, PLAYER_SPECTATOR);
--- a/src/roadveh_cmd.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/roadveh_cmd.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -14,7 +14,7 @@
 #include "engine.h"
 #include "command_func.h"
 #include "station.h"
-#include "news.h"
+#include "news_func.h"
 #include "pathfind.h"
 #include "npf.h"
 #include "player_func.h"
@@ -699,7 +699,7 @@
 	AddNewsItem(
 		(pass == 1) ?
 			STR_9031_ROAD_VEHICLE_CRASH_DRIVER : STR_9032_ROAD_VEHICLE_CRASH_DIE,
-		NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
+		NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
 		v->index,
 		0
 	);
@@ -918,28 +918,22 @@
 	if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) {
 		/* Check if station was ever visited before */
 		if (!(st->had_vehicle_of_type & HVOT_BUS)) {
-			uint32 flags;
-
 			st->had_vehicle_of_type |= HVOT_BUS;
 			SetDParam(0, st->index);
-			flags = (v->owner == _local_player) ? NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_PLAYER, 0) : NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_OTHER, 0);
 			AddNewsItem(
 				v->u.road.roadtype == ROADTYPE_ROAD ? STR_902F_CITIZENS_CELEBRATE_FIRST : STR_CITIZENS_CELEBRATE_FIRST_PASSENGER_TRAM,
-				flags,
+				NM_THIN, NF_VIEWPORT | NF_VEHICLE, (v->owner == _local_player) ? NT_ARRIVAL_PLAYER : NT_ARRIVAL_OTHER, DNC_NONE,
 				v->index,
 				0);
 		}
 	} else {
 		/* Check if station was ever visited before */
 		if (!(st->had_vehicle_of_type & HVOT_TRUCK)) {
-			uint32 flags;
-
 			st->had_vehicle_of_type |= HVOT_TRUCK;
 			SetDParam(0, st->index);
-			flags = (v->owner == _local_player) ? NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_PLAYER, 0) : NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_OTHER, 0);
 			AddNewsItem(
 				v->u.road.roadtype == ROADTYPE_ROAD ? STR_9030_CITIZENS_CELEBRATE_FIRST : STR_CITIZENS_CELEBRATE_FIRST_CARGO_TRAM,
-				flags,
+				NM_THIN, NF_VIEWPORT | NF_VEHICLE, (v->owner == _local_player) ? NT_ARRIVAL_PLAYER : NT_ARRIVAL_OTHER, DNC_NONE,
 				v->index,
 				0
 			);
--- a/src/settings.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/settings.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -37,7 +37,7 @@
 #include "genworld.h"
 #include "rail.h"
 #include "train.h"
-#include "news.h"
+#include "news_func.h"
 #include "window_func.h"
 #include "strings_func.h"
 #include "vehicle_func.h"
--- a/src/ship_cmd.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/ship_cmd.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -12,7 +12,7 @@
 #include "pathfind.h"
 #include "station_map.h"
 #include "station.h"
-#include "news.h"
+#include "news_func.h"
 #include "engine.h"
 #include "player_func.h"
 #include "player_base.h"
@@ -406,15 +406,12 @@
 {
 	/* Check if station was ever visited before */
 	if (!(st->had_vehicle_of_type & HVOT_SHIP)) {
-		uint32 flags;
-
 		st->had_vehicle_of_type |= HVOT_SHIP;
 
 		SetDParam(0, st->index);
-		flags = (v->owner == _local_player) ? NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_PLAYER, 0) : NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_OTHER, 0);
 		AddNewsItem(
 			STR_9833_CITIZENS_CELEBRATE_FIRST,
-			flags,
+			NM_THIN, NF_VIEWPORT | NF_VEHICLE, (v->owner == _local_player) ? NT_ARRIVAL_PLAYER : NT_ARRIVAL_OTHER, DNC_NONE,
 			v->index,
 			0);
 	}
--- a/src/station.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/station.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -9,7 +9,6 @@
 #include "station_map.h"
 #include "station.h"
 #include "town.h"
-#include "news.h"
 #include "saveload.h"
 #include "player_func.h"
 #include "airport.h"
--- a/src/station_cmd.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/station_cmd.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -15,7 +15,7 @@
 #include "viewport_func.h"
 #include "command_func.h"
 #include "town.h"
-#include "news.h"
+#include "news_func.h"
 #include "saveload.h"
 #include "airport.h"
 #include "sprite.h"
@@ -432,7 +432,7 @@
 	}
 
 	SetDParam(0, st->index);
-	AddNewsItem(msg, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT | NF_TILE, NT_ACCEPTANCE, 0), st->xy, 0);
+	AddNewsItem(msg, NM_SMALL, NF_VIEWPORT | NF_TILE, NT_ACCEPTANCE, DNC_NONE, st->xy, 0);
 }
 
 /**
--- a/src/strings.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/strings.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -8,7 +8,6 @@
 #include "namegen.h"
 #include "station.h"
 #include "town.h"
-#include "news.h"
 #include "screenshot.h"
 #include "waypoint.h"
 #include "industry.h"
--- a/src/town_cmd.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/town_cmd.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -17,7 +17,7 @@
 #include "industry.h"
 #include "station.h"
 #include "player_base.h"
-#include "news.h"
+#include "news_func.h"
 #include "saveload.h"
 #include "gui.h"
 #include "unmovable_map.h"
@@ -2118,7 +2118,7 @@
 	SetDParam(1, _current_player);
 
 	AddNewsItem(STR_2055_TRAFFIC_CHAOS_IN_ROAD_REBUILDING,
-		NEWS_FLAGS(NM_NORMAL, NF_TILE, NT_GENERAL, 0), t->xy, 0);
+		NM_NORMAL, NF_TILE, NT_GENERAL, DNC_NONE, t->xy, 0);
 }
 
 static bool DoBuildStatueOfCompany(TileIndex tile, TownID town_id)
--- a/src/train_cmd.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/train_cmd.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -17,7 +17,7 @@
 #include "pathfind.h"
 #include "npf.h"
 #include "station.h"
-#include "news.h"
+#include "news_func.h"
 #include "engine.h"
 #include "player_func.h"
 #include "player_base.h"
@@ -2495,7 +2495,7 @@
 				SetDParam(0, v->unitnumber);
 				AddNewsItem(
 					STR_TRAIN_IS_LOST,
-					NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0),
+					NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE,
 					v->index,
 					0);
 			}
@@ -2765,12 +2765,9 @@
 	if (!(st->had_vehicle_of_type & HVOT_TRAIN)) {
 		st->had_vehicle_of_type |= HVOT_TRAIN;
 		SetDParam(0, st->index);
-		uint32 flags = v->owner == _local_player ?
-			NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ARRIVAL_PLAYER, 0) :
-			NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ARRIVAL_OTHER,  0);
 		AddNewsItem(
 			STR_8801_CITIZENS_CELEBRATE_FIRST,
-			flags,
+			NM_THIN, NF_VIEWPORT | NF_VEHICLE, v->owner == _local_player ? NT_ARRIVAL_PLAYER : NT_ARRIVAL_OTHER, DNC_NONE,
 			v->index,
 			0
 		);
@@ -3019,7 +3016,7 @@
 
 	SetDParam(0, tcc.num);
 	AddNewsItem(STR_8868_TRAIN_CRASH_DIE_IN_FIREBALL,
-		NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
+		NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
 		v->index,
 		0
 	);
@@ -3739,7 +3736,7 @@
 				SetDParam(0, v->unitnumber);
 				AddNewsItem(
 					STR_TRAIN_IS_UNPROFITABLE,
-					NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0),
+					NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE,
 					v->index,
 					0);
 			}
--- a/src/vehicle.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/vehicle.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -13,7 +13,7 @@
 #include "timetable.h"
 #include "viewport_func.h"
 #include "gfx_func.h"
-#include "news.h"
+#include "news_func.h"
 #include "command_func.h"
 #include "saveload.h"
 #include "player_func.h"
@@ -1544,7 +1544,7 @@
 
 	SetDParam(0, _vehicle_type_names[v->type]);
 	SetDParam(1, v->unitnumber);
-	AddNewsItem(msg, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0), v->index, 0);
+	AddNewsItem(msg, NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE, v->index, 0);
 }
 
 void AgeVehicle(Vehicle *v)
@@ -2258,7 +2258,7 @@
 					/* Notify the user that we stopped the vehicle */
 					SetDParam(0, _vehicle_type_names[v->type]);
 					SetDParam(1, v->unitnumber);
-					AddNewsItem(STR_ORDER_REFIT_FAILED, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0), v->index, 0);
+					AddNewsItem(STR_ORDER_REFIT_FAILED, NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE, v->index, 0);
 				}
 			} else if (v->owner == _local_player && cost.GetCost() != 0) {
 				ShowCostOrIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, cost.GetCost());
@@ -2284,7 +2284,7 @@
 				}
 
 				SetDParam(0, v->unitnumber);
-				AddNewsItem(string, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0), v->index, 0);
+				AddNewsItem(string, NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE, v->index, 0);
 			}
 		}
 	}
--- a/src/water_cmd.cpp	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/water_cmd.cpp	Fri Mar 28 08:53:36 2008 +0000
@@ -13,7 +13,7 @@
 #include "viewport_func.h"
 #include "command_func.h"
 #include "town.h"
-#include "news.h"
+#include "news_func.h"
 #include "depot.h"
 #include "vehicle_gui.h"
 #include "train.h"
@@ -855,7 +855,7 @@
 
 		SetDParam(0, pass);
 		AddNewsItem(STR_B006_FLOOD_VEHICLE_DESTROYED,
-			NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
+			NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
 			v->index,
 			0);
 		CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE);
--- a/src/window_gui.h	Fri Mar 28 04:57:32 2008 +0000
+++ b/src/window_gui.h	Fri Mar 28 08:53:36 2008 +0000
@@ -392,16 +392,6 @@
 };
 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp_d));
 
-struct news_d {
-	uint16 follow_vehicle;
-	int32 scrollpos_x;
-	int32 scrollpos_y;
-	int32 dest_scrollpos_x;
-	int32 dest_scrollpos_y;
-	NewsItem *ni;
-};
-assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(news_d));
-
 struct highscore_d {
 	uint32 background_img;
 	int8 rank;