Changeset - r9234:c3f7730d9a9b
[Not reviewed]
master
0 19 0
rubidium - 16 years ago 2008-05-15 13:39:36
rubidium@openttd.org
(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.
19 files changed with 126 insertions and 68 deletions:
0 comments (0 inline, 0 general)
src/aircraft_cmd.cpp
Show inline comments
 
@@ -1395,13 +1395,13 @@ static void CrashAirplane(Vehicle *v)
 
		SetDParam(1, st->index);
 
		newsitem = STR_A034_PLANE_CRASH_DIE_IN_FIREBALL;
 
	}
 

	
 
	SetDParam(1, st->index);
 
	AddNewsItem(newsitem,
 
		NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
 
		NS_ACCIDENT_VEHICLE,
 
		v->index,
 
		0);
 

	
 
	SndPlayVehicleFx(SND_12_EXPLOSION, v);
 
}
 

	
 
@@ -1440,13 +1440,13 @@ static void AircraftEntersTerminal(Vehic
 
	if (!(st->had_vehicle_of_type & HVOT_AIRCRAFT)) {
 
		st->had_vehicle_of_type |= HVOT_AIRCRAFT;
 
		SetDParam(0, st->index);
 
		/* 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);
 
	}
 

	
 
	v->BeginLoading();
 
}
src/autoreplace_cmd.cpp
Show inline comments
 
@@ -320,13 +320,13 @@ static CommandCost WagonRemoval(Vehicle 
 
			v = GetNextVehicle(v);
 
		}
 

	
 
		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;
 
		}
 

	
 
		/* We found a wagon we can sell */
 
		Vehicle *temp = v;
 
		v = GetNextVehicle(v);
 
@@ -477,13 +477,13 @@ CommandCost MaybeReplaceVehicle(Vehicle 
 
					case VEH_SHIP:     message = STR_SHIP_AUTORENEW_FAILED;        break;
 
					case VEH_AIRCRAFT: message = STR_AIRCRAFT_AUTORENEW_FAILED;    break;
 
						// This should never happen
 
					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);
 
			}
 
		}
 
	}
 

	
 
	if (display_costs && IsLocalPlayer() && (flags & DC_EXEC) && CmdSucceeded(cost)) {
 
		ShowCostOrIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, cost.GetCost());
src/currency.cpp
Show inline comments
 
@@ -151,13 +151,13 @@ uint GetMaskOfAllowedCurrencies()
 
void CheckSwitchToEuro()
 
{
 
	if (_currency_specs[_opt.currency].to_euro != CF_NOEURO &&
 
			_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);
 
	}
 
}
 

	
 
/**
 
 * Will fill _currency_specs array with
 
 * default values from origin_currency_specs
src/disaster_cmd.cpp
Show inline comments
 
@@ -231,13 +231,13 @@ static void DisasterTick_Zeppeliner(Vehi
 
					IsHumanPlayer(GetTileOwner(tile))) {
 
				v->current_order.SetDestination(1);
 
				v->age = 0;
 

	
 
				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);
 
			}
 
		}
 

	
 
		if (v->y_pos >= ((int)MapSizeY() + 9) * TILE_SIZE - 1) DeleteDisasterVeh(v);
 
@@ -364,13 +364,13 @@ static void DisasterTick_Ufo(Vehicle *v)
 
			v->age++;
 
			if (u->u.road.crashed_ctr == 0) {
 
				u->u.road.crashed_ctr++;
 
				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);
 
			}
 
		}
 

	
 
		/* Destroy? */
 
@@ -439,13 +439,13 @@ static void DisasterTick_Airplane(Vehicl
 
			v->age = 0;
 

	
 
			i = GetIndustry(v->dest_tile);
 
			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) {
 
		int x, y;
 
		TileIndex tile;
 
		uint ind;
 
@@ -512,13 +512,13 @@ static void DisasterTick_Helicopter(Vehi
 
			v->age = 0;
 

	
 
			i = GetIndustry(v->dest_tile);
 
			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) {
 
		int x, y;
 
		TileIndex tile;
 
		uint ind;
 
@@ -597,13 +597,13 @@ static void DisasterTick_Big_Ufo(Vehicle
 
			}
 
		}
 

	
 
		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);
 

	
 
		u = new DisasterVehicle();
 
		if (u == NULL) {
 
			DeleteDisasterVeh(v);
 
@@ -975,13 +975,13 @@ static void Disaster_CoalMine_Init()
 
		const Industry *i;
 

	
 
		FOR_ALL_INDUSTRIES(i) {
 
			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;
 
					TileIndexDiff step = TileOffsByDiagDir((DiagDirection)GB(Random(), 0, 2));
 
					uint n;
 

	
src/economy.cpp
Show inline comments
 
@@ -528,23 +528,23 @@ static void PlayersCheckBankrupt(Player 
 
	switch (p->quarters_of_bankrupcy) {
 
		case 2:
 
			SetDParam(0, STR_7056_TRANSPORT_COMPANY_IN_TROUBLE);
 
			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
 
		          over when it is a human company? -- TrueLight */
 
			if (IsHumanPlayer(owner)) {
 
				SetDParam(0, STR_7056_TRANSPORT_COMPANY_IN_TROUBLE);
 
				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;
 
			}
 

	
 
			/* Check if the company has any value.. if not, declare it bankrupt
 
			 *  right now */
 
			Money val = CalculateCompanyValue(p);
 
@@ -561,13 +561,13 @@ static void PlayersCheckBankrupt(Player 
 
			DeletePlayerWindows(owner);
 

	
 
			/* Show bankrupt news */
 
			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
 
				 * is no THE-END, otherwise mark the player as spectator to make sure
 
				 * he/she is no long in control of this company */
 
				if (!_networking) {
 
@@ -771,16 +771,16 @@ static void PlayersPayInterest()
 
static void HandleEconomyFluctuations()
 
{
 
	if (_opt.diff.economy == 0) return;
 

	
 
	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);
 
	}
 
}
 

	
 
static byte _price_category[NUM_PRICES] = {
 
	0, 2, 2, 2, 2, 2, 2, 2,
 
	2, 2, 2, 2, 2, 2, 2, 2,
 
@@ -1114,20 +1114,20 @@ static void SubsidyMonthlyHandler()
 

	
 
	for (s = _subsidies; s != endof(_subsidies); s++) {
 
		if (s->cargo_type == CT_INVALID) continue;
 

	
 
		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;
 
		} else {
 
			s->age++;
 
		}
 
@@ -1160,13 +1160,13 @@ static void SubsidyMonthlyHandler()
 
					s->to = (cs->town_effect == TE_GOODS || cs->town_effect == TE_FOOD) ? ((Town*)fr.to)->index : ((Industry*)fr.to)->index;
 
				}
 
	add_subsidy:
 
				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;
 
				}
 
			}
 
		} while (n--);
 
	}
 
@@ -1377,13 +1377,13 @@ static bool CheckSubsidised(Station *fro
 
			pair = SetupSubsidyDecodeParam(s, 0);
 
			InjectDParam(1);
 

	
 
			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
 
			);
 

	
 
			InvalidateWindow(WC_SUBSIDIES_LIST, 0);
 
			return true;
 
		}
 
@@ -1819,13 +1819,13 @@ static void DoAcquireCompany(Player *p)
 

	
 
	SetDParam(0, STR_7059_TRANSPORT_COMPANY_MERGER);
 
	SetDParam(1, p->bankrupt_value == 0 ? STR_707F_HAS_BEEN_TAKEN_OVER_BY : STR_705A_HAS_BEEN_SOLD_TO_FOR);
 
	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;
 
	ChangeNetworkOwner(pi, _current_player);
 
	ChangeOwnershipOfPlayerItems(pi, _current_player);
 

	
src/engine.cpp
Show inline comments
 
@@ -465,13 +465,13 @@ static void NewVehicleAvailable(Engine *
 
			if (p->is_active) SetBit(p->avail_roadtypes, HasBit(e->info.misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
 
		}
 
	}
 

	
 
	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()
 
{
 
	if (_cur_year < YEAR_ENGINE_AGING_STOPS) {
 
		Engine *e;
src/industry_cmd.cpp
Show inline comments
 
@@ -1648,13 +1648,13 @@ CommandCost CmdBuildIndustry(TileIndex t
 
							SetDParam(1, STR_TOWN);
 
							SetDParam(2, ind->town->index);
 
						} else {
 
							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;
 
					}
 
				}
 
			}
 
		}
 
	} else {
 
@@ -1867,13 +1867,13 @@ static void MaybeNewIndustry(void)
 
		SetDParam(1, STR_TOWN);
 
		SetDParam(2, ind->town->index);
 
	} else {
 
		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);
 
}
 

	
 
/**
 
 * Protects an industry from closure if the appropriate flags and conditions are met
 
 * INDUSTRYBEH_CANCLOSE_LASTINSTANCE must be set (which, by default, it is not) and the
 
 * count of industries of this type must one (or lower) in order to be protected
 
@@ -1999,26 +1999,26 @@ int WhoCanServiceIndustry(Industry* ind)
 
* @param ind: Industry with changed production
 
* @param type: Cargo type that has changed
 
* @param percent: Percentage of change (>0 means increase, <0 means decrease)
 
*/
 
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));
 
	SetDParam(0, GetCargo(type)->name);
 
	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
 
	);
 
}
 

	
 
enum {
 
	PERCENT_TRANSPORTED_60 = 153,
 
@@ -2180,21 +2180,21 @@ static void ChangeIndustryProduction(Ind
 
	if (closeit && !CheckIndustryCloseDownProtection(i->type)) {
 
		i->prod_level = PRODLEVEL_CLOSURE;
 
		str = indspec->closure_text;
 
	}
 

	
 
	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;
 
			}
 
		}
 
		/* Set parameters of news string */
 
		if (str > STR_LAST_STRINGID) {
 
			SetDParam(0, STR_TOWN);
 
@@ -2206,13 +2206,13 @@ static void ChangeIndustryProduction(Ind
 
			SetDParam(2, indspec->name);
 
		} else {
 
			SetDParam(0, i->index);
 
		}
 
		/* 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);
 
	}
 
}
 

	
 
void IndustryMonthlyLoop()
 
{
src/news_func.h
Show inline comments
 
@@ -5,13 +5,13 @@
 
#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 AddNewsItem(StringID string, NewsSubtype subtype, uint data_a, uint data_b);
 
void NewsLoop();
 
void DrawNewsBorder(const Window *w);
 
void InitNewsItemStructs();
 

	
 
extern NewsItem _statusbar_news_item;
 
extern bool _news_ticker_sound;
src/news_gui.cpp
Show inline comments
 
@@ -80,12 +80,47 @@ static void MoveToNextItem();
 

	
 
static DrawNewsCallbackProc * const _draw_news_callback[] = {
 
	DrawNewsNewVehicleAvail,  ///< DNC_VEHICLEAVAIL
 
	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()
 
{
 
	free(_news_items);
 
	_max_news_items = max(ScaleByMapSize(30), 30U);
 
	_news_items = CallocT<NewsItem>(_max_news_items);
 
@@ -121,26 +156,27 @@ static void NewsWindowProc(Window *w, Wi
 
			WP(w, news_d).chat_height = (w1 != NULL) ? w1->height : 0;
 
			break;
 
		}
 

	
 
		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);
 

	
 
					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,
 
						DrawStringMultiCenter(215, 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);
 
@@ -157,13 +193,13 @@ static void NewsWindowProc(Window *w, Wi
 
						DrawStringMultiCenter(w->width / 2, 20, ni->string_id, w->width - 4);
 
					}
 
					break;
 
				}
 

	
 
				case NM_CALLBACK:
 
					_draw_news_callback[ni->callback](w, ni);
 
					_draw_news_callback[_news_subtype_data[ni->subtype].callback](w, ni);
 
					break;
 

	
 
				default:
 
					DrawWindowWidgets(w);
 
					if (!(ni->flags & NF_VIEWPORT)) {
 
						CopyInDParam(0, ni->params, lengthof(ni->params));
 
@@ -280,13 +316,13 @@ static inline NewsID DecreaseIndex(NewsI
 
 *
 
 * @see NewsMode
 
 * @see NewsFlag
 
 * @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;
 

	
 
	/* check the rare case that the oldest (to be overwritten) news item is open */
 
	if (_total_news == _max_news_items && (_oldest_news == _current_news || _oldest_news == _forced_news)) {
 
		MoveToNextItem();
 
@@ -311,20 +347,18 @@ void AddNewsItem(StringID string, NewsMo
 

	
 
	/* Add news to _latest_news */
 
	NewsItem *ni = &_news_items[_latest_news];
 
	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;
 
	CopyOutDParam(ni->params, 0, lengthof(ni->params));
 

	
 
	Window *w = FindWindowById(WC_MESSAGE_HISTORY, 0);
 
@@ -404,18 +438,18 @@ static WindowDesc _news_type0_desc = {
 
/** Open up an own newspaper window for the news item */
 
static void ShowNewspaper(NewsItem *ni)
 
{
 
	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;
 
			w = new Window(&_news_type13_desc);
 
			if (ni->flags & NF_VIEWPORT) {
 
				InitializeWindowViewport(w, 2, 58, 426, 110,
 
@@ -490,17 +524,18 @@ static void MoveToNextItem()
 
	_forced_news = INVALID_NEWS;
 

	
 
	/* if we're not at the last item, then move on */
 
	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);
 

	
 
				if (w != NULL) {
 
					WP(w, def_d).data_2 = 91;
src/news_type.h
Show inline comments
 
@@ -29,12 +29,37 @@ enum NewsType {
 
	NT_SUBSIDIES,       ///< News about subsidies (announcements, expirations, acceptance)
 
	NT_GENERAL,         ///< General news (from towns)
 
	NT_END,             ///< end-of-array marker
 
};
 

	
 
/**
 
 * 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 {
 
	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)
 
@@ -97,16 +122,14 @@ struct NewsTypeData {
 
};
 

	
 
struct NewsItem {
 
	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
 

	
 
	uint64 params[10];
 
};
src/order_cmd.cpp
Show inline comments
 
@@ -1441,13 +1441,13 @@ void CheckOrders(const Vehicle* v)
 
		message = STR_TRAIN_HAS_TOO_FEW_ORDERS + (v->type << 2) + problem_type;
 
		//DEBUG(misc, 3, "Triggered News Item for vehicle %d", v->index);
 

	
 
		SetDParam(0, v->unitnumber);
 
		AddNewsItem(
 
			message,
 
			NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE,
 
			NS_ADVICE,
 
			v->index,
 
			0
 
		);
 
	}
 
}
 

	
src/players.cpp
Show inline comments
 
@@ -357,13 +357,13 @@ set_name:;
 

	
 
		if (!IsHumanPlayer(p->index)) {
 
			SetDParam(0, STR_705E_NEW_TRANSPORT_COMPANY_LAUNCHED);
 
			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;
 
	}
 
bad_town_name:;
 

	
 
	if (p->president_name_1 == SPECSTR_PRESIDENT_NAME) {
 
@@ -936,13 +936,13 @@ CommandCost CmdPlayerCtrl(TileIndex tile
 
			DeletePlayerWindows(p->index);
 

	
 
			/* Show the bankrupt news */
 
			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);
 
			p->is_active = false;
 
		}
 
	} break;
src/roadveh_cmd.cpp
Show inline comments
 
@@ -661,13 +661,13 @@ static void RoadVehCrash(Vehicle *v)
 
	InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 

	
 
	SetDParam(0, pass);
 
	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
 
	);
 

	
 
	ModifyStationRatingAround(v->tile, v->owner, -160, 22);
 
	SndPlayVehicleFx(SND_12_EXPLOSION, v);
 
@@ -827,24 +827,24 @@ static void RoadVehArrivesAt(const Vehic
 
		/* Check if station was ever visited before */
 
		if (!(st->had_vehicle_of_type & HVOT_BUS)) {
 
			st->had_vehicle_of_type |= HVOT_BUS;
 
			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);
 
		}
 
	} else {
 
		/* Check if station was ever visited before */
 
		if (!(st->had_vehicle_of_type & HVOT_TRUCK)) {
 
			st->had_vehicle_of_type |= HVOT_TRUCK;
 
			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
 
			);
 
		}
 
	}
 
}
src/ship_cmd.cpp
Show inline comments
 
@@ -346,13 +346,13 @@ static void ShipArrivesAt(const Vehicle*
 
	if (!(st->had_vehicle_of_type & HVOT_SHIP)) {
 
		st->had_vehicle_of_type |= HVOT_SHIP;
 

	
 
		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);
 
	}
 
}
 

	
 
struct PathFindShip {
src/station_cmd.cpp
Show inline comments
 
@@ -406,13 +406,13 @@ static void ShowRejectOrAcceptNews(const
 
{
 
	for (uint i = 0; i < num_items; i++) {
 
		SetDParam(i + 1, GetCargo(cargo[i])->name);
 
	}
 

	
 
	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);
 
}
 

	
 
/**
 
 * Get a list of the cargo types being produced around the tile (in a rectangle).
 
 * @param produced: Destination array of produced cargo
 
 * @param tile: Center of the search area
src/town_cmd.cpp
Show inline comments
 
@@ -2149,13 +2149,13 @@ static void TownActionRoadRebuild(Town *
 
	t->road_build_months = 6;
 

	
 
	SetDParam(0, t->index);
 
	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)
 
{
 
	/* Statues can be build on slopes, just like houses. Only the steep slopes is a no go. */
 
	if (IsSteepSlope(GetTileSlope(tile, NULL))) return false;
src/train_cmd.cpp
Show inline comments
 
@@ -2447,13 +2447,13 @@ static Track ChooseTrainTrack(Vehicle *v
 
			SetBit(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION);
 
			/* and notify user about the event */
 
			if (_patches.lost_train_warn && v->owner == _local_player) {
 
				SetDParam(0, v->unitnumber);
 
				AddNewsItem(
 
					STR_TRAIN_IS_LOST,
 
					NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE,
 
					NS_ADVICE,
 
					v->index,
 
					0);
 
			}
 
		}
 
	} else {
 
		/* route found, is the train marked with "path not found" flag? */
 
@@ -2644,13 +2644,13 @@ static void TrainEnterStation(Vehicle *v
 
	Station *st = GetStation(station);
 
	if (!(st->had_vehicle_of_type & HVOT_TRAIN)) {
 
		st->had_vehicle_of_type |= HVOT_TRAIN;
 
		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
 
		);
 
	}
 

	
 
	v->BeginLoading();
 
@@ -2890,13 +2890,13 @@ static void CheckTrainCollision(Vehicle 
 

	
 
	/* any dead -> no crash */
 
	if (tcc.num == 0) return;
 

	
 
	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
 
	);
 

	
 
	ModifyStationRatingAround(v->tile, v->owner, -160, 30);
 
	SndPlayVehicleFx(SND_13_BIG_CRASH, v);
 
@@ -3614,13 +3614,13 @@ void TrainsYearlyLoop()
 
			/* show warning if train is not generating enough income last 2 years (corresponds to a red icon in the vehicle list) */
 
			if (_patches.train_income_warn && v->owner == _local_player && v->age >= 730 && v->GetDisplayProfitThisYear() < 0) {
 
				SetDParam(1, v->GetDisplayProfitThisYear());
 
				SetDParam(0, v->unitnumber);
 
				AddNewsItem(
 
					STR_TRAIN_IS_UNPROFITABLE,
 
					NM_SMALL, NF_VIEWPORT | NF_VEHICLE, NT_ADVICE, DNC_NONE,
 
					NS_ADVICE,
 
					v->index,
 
					0);
 
			}
 

	
 
			v->profit_last_year = v->profit_this_year;
 
			v->profit_this_year = 0;
src/vehicle.cpp
Show inline comments
 
@@ -949,13 +949,13 @@ static void ShowVehicleGettingOld(Vehicl
 

	
 
	/* Do not show getting-old message if autorenew is active (and it can replace the vehicle) */
 
	if (GetPlayer(v->owner)->engine_renew && GetEngine(v->engine_type)->player_avail != 0) return;
 

	
 
	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)
 
{
 
	if (v->age < 65535) v->age++;
 

	
 
@@ -1648,13 +1648,13 @@ void VehicleEnterDepot(Vehicle *v)
 
			if (CmdFailed(cost)) {
 
				v->leave_depot_instantly = false; // We ensure that the vehicle stays in the depot
 
				if (v->owner == _local_player) {
 
					/* 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());
 
			}
 
		}
 

	
 
@@ -1674,13 +1674,13 @@ void VehicleEnterDepot(Vehicle *v)
 
					case VEH_SHIP:     string = STR_981C_SHIP_IS_WAITING_IN_DEPOT;  break;
 
					case VEH_AIRCRAFT: string = STR_A014_AIRCRAFT_IS_WAITING_IN;    break;
 
					default: NOT_REACHED(); string = STR_EMPTY; // Set the string to something to avoid a compiler warning
 
				}
 

	
 
				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);
 
			}
 
		}
 
	}
 
}
 

	
 
static bool IsUniqueVehicleName(const char *name)
src/water_cmd.cpp
Show inline comments
 
@@ -858,13 +858,13 @@ static void FloodVehicle(Vehicle *v)
 

	
 
		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 
		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
 

	
 
		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);
 
		SndPlayVehicleFx(SND_12_EXPLOSION, v);
 
	}
 
}
0 comments (0 inline, 0 general)