(svn r13100) -Codechange: reduce the amount of parameters passed via AddNewsMessage as there is (for each news message type) a tuple of 4 parameters that is the same for all calls.
--- a/src/aircraft_cmd.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/aircraft_cmd.cpp Thu May 15 13:39:36 2008 +0000
@@ -1398,7 +1398,7 @@
SetDParam(1, st->index);
AddNewsItem(newsitem,
- NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
+ NS_ACCIDENT_VEHICLE,
v->index,
0);
@@ -1443,7 +1443,7 @@
/* show newsitem of celebrating citizens */
AddNewsItem(
STR_A033_CITIZENS_CELEBRATE_FIRST,
- NM_THIN, NF_VIEWPORT | NF_VEHICLE, (v->owner == _local_player) ? NT_ARRIVAL_PLAYER : NT_ARRIVAL_OTHER, DNC_NONE,
+ (v->owner == _local_player) ? NS_ARRIVAL_PLAYER : NS_ARRIVAL_OTHER,
v->index,
0);
}
--- a/src/autoreplace_cmd.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/autoreplace_cmd.cpp Thu May 15 13:39:36 2008 +0000
@@ -323,7 +323,7 @@
if (v == NULL) {
/* We sold all the wagons and the train is still not short enough */
SetDParam(0, front->unitnumber);
- AddNewsItem(STR_TRAIN_TOO_LONG_AFTER_REPLACEMENT, NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE, front->index, 0);
+ AddNewsItem(STR_TRAIN_TOO_LONG_AFTER_REPLACEMENT, NS_ADVICE, front->index, 0);
return cost;
}
@@ -480,7 +480,7 @@
default: NOT_REACHED(); message = 0; break;
}
- AddNewsItem(message, NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, DNC_NONE, v->index, 0);
+ AddNewsItem(message, NS_ADVICE, v->index, 0);
}
}
}
--- a/src/currency.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/currency.cpp Thu May 15 13:39:36 2008 +0000
@@ -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, NM_NORMAL, NF_NONE, NT_ECONOMY, DNC_NONE, 0, 0);
+ AddNewsItem(STR_EURO_INTRODUCE, NS_ECONOMY, 0, 0);
}
}
--- a/src/disaster_cmd.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/disaster_cmd.cpp Thu May 15 13:39:36 2008 +0000
@@ -234,7 +234,7 @@
SetDParam(0, GetStationIndex(tile));
AddNewsItem(STR_B000_ZEPPELIN_DISASTER_AT,
- NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
+ NS_ACCIDENT_VEHICLE,
v->index,
0);
}
@@ -367,7 +367,7 @@
u->vehstatus |= VS_CRASHED;
AddNewsItem(STR_B001_ROAD_VEHICLE_DESTROYED,
- NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
+ NS_ACCIDENT_VEHICLE,
u->index,
0);
}
@@ -442,7 +442,7 @@
DestructIndustry(i);
SetDParam(0, i->town->index);
- AddNewsItem(STR_B002_OIL_REFINERY_EXPLOSION, NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, DNC_NONE, i->xy, 0);
+ AddNewsItem(STR_B002_OIL_REFINERY_EXPLOSION, NS_ACCIDENT_TILE, i->xy, 0);
SndPlayTileFx(SND_12_EXPLOSION, i->xy);
}
} else if (v->current_order.GetDestination() == 0) {
@@ -515,7 +515,7 @@
DestructIndustry(i);
SetDParam(0, i->town->index);
- AddNewsItem(STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS, NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, DNC_NONE, i->xy, 0);
+ AddNewsItem(STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS, NS_ACCIDENT_TILE, i->xy, 0);
SndPlayTileFx(SND_12_EXPLOSION, i->xy);
}
} else if (v->current_order.GetDestination() == 0) {
@@ -600,7 +600,7 @@
t = ClosestTownFromTile(v->dest_tile, (uint)-1);
SetDParam(0, t->index);
AddNewsItem(STR_B004_UFO_LANDS_NEAR,
- NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, DNC_NONE,
+ NS_ACCIDENT_TILE,
v->tile,
0);
@@ -978,7 +978,7 @@
if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_CAN_SUBSIDENCE) && --index < 0) {
SetDParam(0, i->town->index);
AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES,
- NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, DNC_NONE, i->xy + TileDiffXY(1, 1), 0);
+ NS_ACCIDENT_TILE, i->xy + TileDiffXY(1, 1), 0);
{
TileIndex tile = i->xy;
--- a/src/economy.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/economy.cpp Thu May 15 13:39:36 2008 +0000
@@ -531,7 +531,7 @@
SetDParam(1, STR_7057_WILL_BE_SOLD_OFF_OR_DECLARED);
SetDParam(2, owner);
AddNewsItem(STR_02B6,
- NM_CALLBACK, NF_NONE, NT_COMPANY_INFO, DNC_BANKRUPCY, 0, owner | NB_BTROUBLE);
+ NS_COMPANY_TROUBLE, 0, owner | NB_BTROUBLE);
break;
case 3: {
/* XXX - In multiplayer, should we ask other players if it wants to take
@@ -541,7 +541,7 @@
SetDParam(1, STR_7057_WILL_BE_SOLD_OFF_OR_DECLARED);
SetDParam(2, owner);
AddNewsItem(STR_02B6,
- NM_CALLBACK, NF_NONE, NT_COMPANY_INFO, DNC_BANKRUPCY, 0, owner | NB_BTROUBLE);
+ NS_COMPANY_TROUBLE, 0, owner | NB_BTROUBLE);
break;
}
@@ -564,7 +564,7 @@
SetDParam(0, STR_705C_BANKRUPT);
SetDParam(1, STR_705D_HAS_BEEN_CLOSED_DOWN_BY);
SetDParam(2, p->index);
- AddNewsItem(STR_02B6, NM_CALLBACK, NF_NONE, NT_COMPANY_INFO, DNC_BANKRUPCY, 0, owner | NB_BBANKRUPT);
+ AddNewsItem(STR_02B6, NS_COMPANY_BANKRUPT, 0, owner | NB_BBANKRUPT);
if (IsHumanPlayer(owner)) {
/* XXX - If we are in offline mode, leave the player playing. Eg. there
@@ -774,10 +774,10 @@
if (--_economy.fluct == 0) {
_economy.fluct = -(int)GB(Random(), 0, 2);
- AddNewsItem(STR_7073_WORLD_RECESSION_FINANCIAL, NM_NORMAL, NF_NONE, NT_ECONOMY, DNC_NONE, 0, 0);
+ AddNewsItem(STR_7073_WORLD_RECESSION_FINANCIAL, NS_ECONOMY, 0, 0);
} else if (_economy.fluct == -12) {
_economy.fluct = GB(Random(), 0, 8) + 312;
- AddNewsItem(STR_7074_RECESSION_OVER_UPTURN_IN, NM_NORMAL, NF_NONE, NT_ECONOMY, DNC_NONE, 0, 0);
+ AddNewsItem(STR_7074_RECESSION_OVER_UPTURN_IN, NS_ECONOMY, 0, 0);
}
}
@@ -1117,14 +1117,14 @@
if (s->age == 12-1) {
pair = SetupSubsidyDecodeParam(s, 1);
- AddNewsItem(STR_202E_OFFER_OF_SUBSIDY_EXPIRED, NM_NORMAL, NF_TILE | NF_TILE2, NT_SUBSIDIES, DNC_NONE, pair.a, pair.b);
+ AddNewsItem(STR_202E_OFFER_OF_SUBSIDY_EXPIRED, NS_SUBSIDIES, 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, NM_NORMAL, NF_TILE | NF_TILE2, NT_SUBSIDIES, DNC_NONE, pair.a, pair.b);
+ AddNewsItem(STR_202F_SUBSIDY_WITHDRAWN_SERVICE, NS_SUBSIDIES, pair.a, pair.b);
}
s->cargo_type = CT_INVALID;
modified = true;
@@ -1163,7 +1163,7 @@
if (!CheckSubsidyDuplicate(s)) {
s->age = 0;
pair = SetupSubsidyDecodeParam(s, 0);
- AddNewsItem(STR_2030_SERVICE_SUBSIDY_OFFERED, NM_NORMAL, NF_TILE | NF_TILE2, NT_SUBSIDIES, DNC_NONE, pair.a, pair.b);
+ AddNewsItem(STR_2030_SERVICE_SUBSIDY_OFFERED, NS_SUBSIDIES, pair.a, pair.b);
modified = true;
break;
}
@@ -1380,7 +1380,7 @@
SetDParam(0, _current_player);
AddNewsItem(
STR_2031_SERVICE_SUBSIDY_AWARDED + _opt.diff.subsidy_multiplier,
- NM_NORMAL, NF_TILE | NF_TILE2, NT_SUBSIDIES, DNC_NONE,
+ NS_SUBSIDIES,
pair.a, pair.b
);
@@ -1822,7 +1822,7 @@
SetDParam(2, p->index);
SetDParam(3, _current_player);
SetDParam(4, p->bankrupt_value);
- AddNewsItem(STR_02B6, NM_CALLBACK, NF_NONE, NT_COMPANY_INFO, DNC_BANKRUPCY, 0, _current_player | NB_BMERGER);
+ AddNewsItem(STR_02B6, NS_COMPANY_MERGER, 0, _current_player | NB_BMERGER);
/* original code does this a little bit differently */
PlayerID pi = p->index;
--- a/src/engine.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/engine.cpp Thu May 15 13:39:36 2008 +0000
@@ -468,7 +468,7 @@
SetDParam(0, GetEngineCategoryName(index));
SetDParam(1, index);
- AddNewsItem(STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE, NM_CALLBACK, NF_NONE, NT_NEW_VEHICLES, DNC_VEHICLEAVAIL, index, 0);
+ AddNewsItem(STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE, NS_NEW_VEHICLES, index, 0);
}
void EnginesMonthlyLoop()
--- a/src/industry_cmd.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/industry_cmd.cpp Thu May 15 13:39:36 2008 +0000
@@ -1651,7 +1651,7 @@
SetDParam(1, ind->town->index);
}
AddNewsItem(indspec->new_industry_text,
- NM_THIN, NF_VIEWPORT | NF_TILE, NT_OPENCLOSE, DNC_NONE, ind->xy, 0);
+ NS_OPENCLOSE, ind->xy, 0);
break;
}
}
@@ -1870,7 +1870,7 @@
SetDParam(1, ind->town->index);
}
AddNewsItem(ind_spc->new_industry_text,
- NM_THIN, NF_VIEWPORT | NF_TILE, NT_OPENCLOSE, DNC_NONE, ind->xy, 0);
+ NS_OPENCLOSE, ind->xy, 0);
}
/**
@@ -2002,12 +2002,12 @@
*/
static void ReportNewsProductionChangeIndustry(Industry *ind, CargoID type, int percent)
{
- NewsType nt;
+ NewsSubtype ns;
switch (WhoCanServiceIndustry(ind)) {
- case 0: nt = NT_INDUSTRY_NOBODY; break;
- case 1: nt = NT_INDUSTRY_OTHER; break;
- case 2: nt = NT_INDUSTRY_PLAYER; break;
+ case 0: ns = NS_INDUSTRY_NOBODY; break;
+ case 1: ns = NS_INDUSTRY_OTHER; break;
+ case 2: ns = NS_INDUSTRY_PLAYER; break;
default: NOT_REACHED(); break;
}
SetDParam(2, abs(percent));
@@ -2015,7 +2015,7 @@
SetDParam(1, ind->index);
AddNewsItem(
percent >= 0 ? STR_INDUSTRY_PROD_GOUP : STR_INDUSTRY_PROD_GODOWN,
- NM_THIN, NF_VIEWPORT | NF_TILE, nt, DNC_NONE,
+ ns,
ind->xy + TileDiffXY(1, 1), 0
);
}
@@ -2183,15 +2183,15 @@
}
if (!suppress_message && str != STR_NULL) {
- NewsType nt;
+ NewsSubtype ns;
/* Compute news category */
if (closeit) {
- nt = NT_OPENCLOSE;
+ ns = NS_OPENCLOSE;
} else {
switch (WhoCanServiceIndustry(i)) {
- case 0: nt = NT_INDUSTRY_NOBODY; break;
- case 1: nt = NT_INDUSTRY_OTHER; break;
- case 2: nt = NT_INDUSTRY_PLAYER; break;
+ case 0: ns = NS_INDUSTRY_NOBODY; break;
+ case 1: ns = NS_INDUSTRY_OTHER; break;
+ case 2: ns = NS_INDUSTRY_PLAYER; break;
default: NOT_REACHED(); break;
}
}
@@ -2209,7 +2209,7 @@
}
/* and report the news to the user */
AddNewsItem(str,
- NM_THIN, NF_VIEWPORT | NF_TILE, nt, DNC_NONE,
+ ns,
i->xy + TileDiffXY(1, 1), 0);
}
}
--- a/src/news_func.h Thu May 15 11:17:56 2008 +0000
+++ b/src/news_func.h Thu May 15 13:39:36 2008 +0000
@@ -8,7 +8,7 @@
#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 AddNewsItem(StringID string, NewsSubtype subtype, uint data_a, uint data_b);
void NewsLoop();
void DrawNewsBorder(const Window *w);
void InitNewsItemStructs();
--- a/src/news_gui.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/news_gui.cpp Thu May 15 13:39:36 2008 +0000
@@ -83,6 +83,41 @@
DrawNewsBankrupcy, ///< DNC_BANKRUPCY
};
+/**
+ * Data common to all news items of a given subtype (structure)
+ */
+struct NewsSubtypeData {
+ NewsType type; ///< News category @see NewsType
+ NewsMode display_mode; ///< Display mode value @see NewsMode
+ NewsFlag flags; ///< Initial NewsFlags bits @see NewsFlag
+ NewsCallback callback; ///< Call-back function
+};
+
+/**
+ * Data common to all news items of a given subtype (actual data)
+ */
+static const struct NewsSubtypeData _news_subtype_data[NS_END] = {
+ /* type, display_mode, flags, callback */
+ { NT_ARRIVAL_PLAYER, NM_THIN, NF_VIEWPORT|NF_VEHICLE, DNC_NONE }, ///< NS_ARRIVAL_PLAYER
+ { NT_ARRIVAL_OTHER, NM_THIN, NF_VIEWPORT|NF_VEHICLE, DNC_NONE }, ///< NS_ARRIVAL_OTHER
+ { NT_ACCIDENT, NM_THIN, NF_VIEWPORT|NF_TILE, DNC_NONE }, ///< NS_ACCIDENT_TILE
+ { NT_ACCIDENT, NM_THIN, NF_VIEWPORT|NF_VEHICLE, DNC_NONE }, ///< NS_ACCIDENT_VEHICLE
+ { NT_COMPANY_INFO, NM_CALLBACK, NF_NONE, DNC_BANKRUPCY }, ///< NS_COMPANY_TROUBLE
+ { NT_COMPANY_INFO, NM_CALLBACK, NF_NONE, DNC_BANKRUPCY }, ///< NS_COMPANY_MERGER
+ { NT_COMPANY_INFO, NM_CALLBACK, NF_NONE, DNC_BANKRUPCY }, ///< NS_COMPANY_BANKRUPT
+ { NT_COMPANY_INFO, NM_CALLBACK, NF_TILE, DNC_BANKRUPCY }, ///< NS_COMPANY_NEW
+ { NT_OPENCLOSE, NM_THIN, NF_VIEWPORT|NF_TILE, DNC_NONE }, ///< NS_OPENCLOSE
+ { NT_ECONOMY, NM_NORMAL, NF_NONE, DNC_NONE }, ///< NS_ECONOMY
+ { NT_INDUSTRY_PLAYER, NM_THIN, NF_VIEWPORT|NF_TILE, DNC_NONE }, ///< NS_INDUSTRY_PLAYER
+ { NT_INDUSTRY_OTHER, NM_THIN, NF_VIEWPORT|NF_TILE, DNC_NONE }, ///< NS_INDUSTRY_OTHER
+ { NT_INDUSTRY_NOBODY, NM_THIN, NF_VIEWPORT|NF_TILE, DNC_NONE }, ///< NS_INDUSTRY_NOBODY
+ { NT_ADVICE, NM_SMALL, NF_VIEWPORT|NF_VEHICLE, DNC_NONE }, ///< NS_ADVICE
+ { NT_NEW_VEHICLES, NM_CALLBACK, NF_NONE, DNC_VEHICLEAVAIL }, ///< NS_NEW_VEHICLES
+ { NT_ACCEPTANCE, NM_SMALL, NF_VIEWPORT|NF_TILE, DNC_NONE }, ///< NS_ACCEPTANCE
+ { NT_SUBSIDIES, NM_NORMAL, NF_TILE|NF_TILE2, DNC_NONE }, ///< NS_SUBSIDIES
+ { NT_GENERAL, NM_NORMAL, NF_TILE, DNC_NONE }, ///< NS_GENERAL
+};
+
/** Initialize the news-items data structures */
void InitNewsItemStructs()
{
@@ -124,8 +159,9 @@
case WE_PAINT: {
const NewsItem *ni = WP(w, news_d).ni;
+ const NewsMode display_mode = _news_subtype_data[ni->subtype].display_mode;
- switch (ni->display_mode) {
+ switch (display_mode) {
case NM_NORMAL:
case NM_THIN: {
DrawNewsBorder(w);
@@ -137,7 +173,7 @@
if (!(ni->flags & NF_VIEWPORT)) {
CopyInDParam(0, ni->params, lengthof(ni->params));
- DrawStringMultiCenter(215, ni->display_mode == NM_NORMAL ? 76 : 56,
+ DrawStringMultiCenter(215, display_mode == NM_NORMAL ? 76 : 56,
ni->string_id, w->width - 4);
} else {
/* Back up transparency options to draw news view */
@@ -160,7 +196,7 @@
}
case NM_CALLBACK:
- _draw_news_callback[ni->callback](w, ni);
+ _draw_news_callback[_news_subtype_data[ni->subtype].callback](w, ni);
break;
default:
@@ -283,7 +319,7 @@
* @see NewsType
* @see NewsCallback
*/
-void AddNewsItem(StringID string, NewsMode display_mode, NewsFlag flags, NewsType type, NewsCallback callback, uint data_a, uint data_b)
+void AddNewsItem(StringID string, NewsSubtype subtype, uint data_a, uint data_b)
{
if (_game_mode == GM_MENU) return;
@@ -314,14 +350,12 @@
memset(ni, 0, sizeof(*ni));
ni->string_id = string;
- ni->display_mode = display_mode;
- ni->flags = flags;
+ ni->subtype = subtype;
+ ni->flags = _news_subtype_data[subtype].flags;
/* 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;
@@ -407,12 +441,12 @@
ni->flags &= ~NF_FORCE_BIG;
ni->duration = 555;
- SoundFx sound = _news_type_data[ni->type].sound;
+ SoundFx sound = _news_type_data[_news_subtype_data[ni->subtype].type].sound;
if (sound != 0) SndPlayFx(sound);
int top = _screen.height;
Window *w;
- switch (ni->display_mode) {
+ switch (_news_subtype_data[ni->subtype].display_mode) {
case NM_NORMAL:
case NM_CALLBACK:
_news_type13_desc.top = top;
@@ -493,11 +527,12 @@
if (_current_news != _latest_news) {
_current_news = (_current_news == INVALID_NEWS) ? _oldest_news : IncreaseIndex(_current_news);
NewsItem *ni = &_news_items[_current_news];
+ const NewsType type = _news_subtype_data[ni->subtype].type;
/* check the date, don't show too old items */
- if (_date - _news_type_data[ni->type].age > ni->date) return;
+ if (_date - _news_type_data[type].age > ni->date) return;
- switch (_news_type_data[ni->type].display) {
+ switch (_news_type_data[type].display) {
default: NOT_REACHED();
case ND_OFF: { // Off - show nothing only a small reminder in the status bar
Window *w = FindWindowById(WC_STATUS_BAR, 0);
--- a/src/news_type.h Thu May 15 11:17:56 2008 +0000
+++ b/src/news_type.h Thu May 15 13:39:36 2008 +0000
@@ -32,6 +32,31 @@
};
/**
+ * News subtypes.
+ */
+enum NewsSubtype {
+ NS_ARRIVAL_PLAYER, ///< NT_ARRIVAL_PLAYER
+ NS_ARRIVAL_OTHER, ///< NT_ARRIVAL_OTHER
+ NS_ACCIDENT_TILE, ///< NT_ACCIDENT (tile)
+ NS_ACCIDENT_VEHICLE, ///< NT_ACCIDENT (vehicle)
+ NS_COMPANY_TROUBLE, ///< NT_COMPANY_INFO (trouble)
+ NS_COMPANY_MERGER, ///< NT_COMPANY_INFO (merger)
+ NS_COMPANY_BANKRUPT, ///< NT_COMPANY_INFO (bankrupt)
+ NS_COMPANY_NEW, ///< NT_COMPANY_INFO (new company)
+ NS_OPENCLOSE, ///< NT_OPENCLOSE
+ NS_ECONOMY, ///< NT_ECONOMY
+ NS_INDUSTRY_PLAYER, ///< NT_INDUSTRY_PLAYER
+ NS_INDUSTRY_OTHER, ///< NT_INDUSTRY_OTHER
+ NS_INDUSTRY_NOBODY, ///< NT_INDUSTRY_NOBODY
+ NS_ADVICE, ///< NT_ADVICE
+ NS_NEW_VEHICLES, ///< NT_NEW_VEHICLES
+ NS_ACCEPTANCE, ///< NT_ACCEPTANCE
+ NS_SUBSIDIES, ///< NT_SUBSIDIES
+ NS_GENERAL, ///< NT_GENERAL
+ NS_END, ///< end-of-array marker
+};
+
+/**
* News mode.
*/
enum NewsMode {
@@ -100,10 +125,8 @@
StringID string_id; ///< Message text
uint16 duration; ///< Remaining time for showing this news message
Date date; ///< Date of the news
+ NewsSubtype subtype; ///< News subtype @see NewsSubtype
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; ///< Custom data 1 (usually tile or vehicle)
uint data_b; ///< Custom data 2
--- a/src/order_cmd.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/order_cmd.cpp Thu May 15 13:39:36 2008 +0000
@@ -1444,7 +1444,7 @@
SetDParam(0, v->unitnumber);
AddNewsItem(
message,
- NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE,
+ NS_ADVICE,
v->index,
0
);
--- a/src/players.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/players.cpp Thu May 15 13:39:36 2008 +0000
@@ -360,7 +360,7 @@
SetDParam(1, STR_705F_STARTS_CONSTRUCTION_NEAR);
SetDParam(2, p->index);
SetDParam(3, t->index);
- AddNewsItem(STR_02B6, NM_CALLBACK, NF_TILE, NT_COMPANY_INFO, DNC_BANKRUPCY, p->last_build_coordinate, p->index | NB_BNEWCOMPANY);
+ AddNewsItem(STR_02B6, NS_COMPANY_NEW, p->last_build_coordinate, p->index | NB_BNEWCOMPANY);
}
return;
}
@@ -939,7 +939,7 @@
SetDParam(0, STR_705C_BANKRUPT);
SetDParam(1, STR_705D_HAS_BEEN_CLOSED_DOWN_BY);
SetDParam(2, p->index);
- AddNewsItem(STR_02B6, NM_CALLBACK, NF_NONE, NT_COMPANY_INFO, DNC_BANKRUPCY, 0, p->index | NB_BBANKRUPT);
+ AddNewsItem(STR_02B6, NS_COMPANY_BANKRUPT, 0, p->index | NB_BBANKRUPT);
/* Remove the company */
ChangeOwnershipOfPlayerItems(p->index, PLAYER_SPECTATOR);
--- a/src/roadveh_cmd.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/roadveh_cmd.cpp Thu May 15 13:39:36 2008 +0000
@@ -664,7 +664,7 @@
AddNewsItem(
(pass == 1) ?
STR_9031_ROAD_VEHICLE_CRASH_DRIVER : STR_9032_ROAD_VEHICLE_CRASH_DIE,
- NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
+ NS_ACCIDENT_VEHICLE,
v->index,
0
);
@@ -830,7 +830,7 @@
SetDParam(0, st->index);
AddNewsItem(
v->u.road.roadtype == ROADTYPE_ROAD ? STR_902F_CITIZENS_CELEBRATE_FIRST : STR_CITIZENS_CELEBRATE_FIRST_PASSENGER_TRAM,
- NM_THIN, NF_VIEWPORT | NF_VEHICLE, (v->owner == _local_player) ? NT_ARRIVAL_PLAYER : NT_ARRIVAL_OTHER, DNC_NONE,
+ (v->owner == _local_player) ? NS_ARRIVAL_PLAYER : NS_ARRIVAL_OTHER,
v->index,
0);
}
@@ -841,7 +841,7 @@
SetDParam(0, st->index);
AddNewsItem(
v->u.road.roadtype == ROADTYPE_ROAD ? STR_9030_CITIZENS_CELEBRATE_FIRST : STR_CITIZENS_CELEBRATE_FIRST_CARGO_TRAM,
- NM_THIN, NF_VIEWPORT | NF_VEHICLE, (v->owner == _local_player) ? NT_ARRIVAL_PLAYER : NT_ARRIVAL_OTHER, DNC_NONE,
+ (v->owner == _local_player) ? NS_ARRIVAL_PLAYER : NS_ARRIVAL_OTHER,
v->index,
0
);
--- a/src/ship_cmd.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/ship_cmd.cpp Thu May 15 13:39:36 2008 +0000
@@ -349,7 +349,7 @@
SetDParam(0, st->index);
AddNewsItem(
STR_9833_CITIZENS_CELEBRATE_FIRST,
- NM_THIN, NF_VIEWPORT | NF_VEHICLE, (v->owner == _local_player) ? NT_ARRIVAL_PLAYER : NT_ARRIVAL_OTHER, DNC_NONE,
+ (v->owner == _local_player) ? NS_ARRIVAL_PLAYER : NS_ARRIVAL_OTHER,
v->index,
0);
}
--- a/src/station_cmd.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/station_cmd.cpp Thu May 15 13:39:36 2008 +0000
@@ -409,7 +409,7 @@
}
SetDParam(0, st->index);
- AddNewsItem(msg, NM_SMALL, NF_VIEWPORT | NF_TILE, NT_ACCEPTANCE, DNC_NONE, st->xy, 0);
+ AddNewsItem(msg, NS_ACCEPTANCE, st->xy, 0);
}
/**
--- a/src/town_cmd.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/town_cmd.cpp Thu May 15 13:39:36 2008 +0000
@@ -2152,7 +2152,7 @@
SetDParam(1, _current_player);
AddNewsItem(STR_2055_TRAFFIC_CHAOS_IN_ROAD_REBUILDING,
- NM_NORMAL, NF_TILE, NT_GENERAL, DNC_NONE, t->xy, 0);
+ NS_GENERAL, t->xy, 0);
}
static bool DoBuildStatueOfCompany(TileIndex tile, TownID town_id)
--- a/src/train_cmd.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/train_cmd.cpp Thu May 15 13:39:36 2008 +0000
@@ -2450,7 +2450,7 @@
SetDParam(0, v->unitnumber);
AddNewsItem(
STR_TRAIN_IS_LOST,
- NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE,
+ NS_ADVICE,
v->index,
0);
}
@@ -2647,7 +2647,7 @@
SetDParam(0, st->index);
AddNewsItem(
STR_8801_CITIZENS_CELEBRATE_FIRST,
- NM_THIN, NF_VIEWPORT | NF_VEHICLE, v->owner == _local_player ? NT_ARRIVAL_PLAYER : NT_ARRIVAL_OTHER, DNC_NONE,
+ v->owner == _local_player ? NS_ARRIVAL_PLAYER : NS_ARRIVAL_OTHER,
v->index,
0
);
@@ -2893,7 +2893,7 @@
SetDParam(0, tcc.num);
AddNewsItem(STR_8868_TRAIN_CRASH_DIE_IN_FIREBALL,
- NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
+ NS_ACCIDENT_VEHICLE,
v->index,
0
);
@@ -3617,7 +3617,7 @@
SetDParam(0, v->unitnumber);
AddNewsItem(
STR_TRAIN_IS_UNPROFITABLE,
- NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE,
+ NS_ADVICE,
v->index,
0);
}
--- a/src/vehicle.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/vehicle.cpp Thu May 15 13:39:36 2008 +0000
@@ -952,7 +952,7 @@
SetDParam(0, _vehicle_type_names[v->type]);
SetDParam(1, v->unitnumber);
- AddNewsItem(msg, NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE, v->index, 0);
+ AddNewsItem(msg, NS_ADVICE, v->index, 0);
}
void AgeVehicle(Vehicle *v)
@@ -1651,7 +1651,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, NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE, v->index, 0);
+ AddNewsItem(STR_ORDER_REFIT_FAILED, NS_ADVICE, v->index, 0);
}
} else if (v->owner == _local_player && cost.GetCost() != 0) {
ShowCostOrIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, cost.GetCost());
@@ -1677,7 +1677,7 @@
}
SetDParam(0, v->unitnumber);
- AddNewsItem(string, NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE, v->index, 0);
+ AddNewsItem(string, NS_ADVICE, v->index, 0);
}
}
}
--- a/src/water_cmd.cpp Thu May 15 11:17:56 2008 +0000
+++ b/src/water_cmd.cpp Thu May 15 13:39:36 2008 +0000
@@ -861,7 +861,7 @@
SetDParam(0, pass);
AddNewsItem(STR_B006_FLOOD_VEHICLE_DESTROYED,
- NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
+ NS_ACCIDENT_VEHICLE,
v->index,
0);
CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE);