summaryrefslogtreecommitdiff
path: root/src/disaster_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-05-24 16:52:42 +0000
committerfrosch <frosch@openttd.org>2009-05-24 16:52:42 +0000
commita4557c7da4329188e3561d9404891c0346f8f70e (patch)
tree96e7ba45ee42e5b0d0c8ca2867b081a56ebef645 /src/disaster_cmd.cpp
parentb7d065ce99886e2cf86883469a077f653428e5b8 (diff)
downloadopenttd-a4557c7da4329188e3561d9404891c0346f8f70e.tar.xz
(svn r16416) -Fix [FS#2912]: Rework deleting of news when referenced vehicles/stations/industries are deleted.
Diffstat (limited to 'src/disaster_cmd.cpp')
-rw-r--r--src/disaster_cmd.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp
index 8a2ed7e61..96735f199 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -207,10 +207,9 @@ static bool DisasterTick_Zeppeliner(DisasterVehicle *v)
v->age = 0;
SetDParam(0, GetStationIndex(v->tile));
- AddNewsItem(STR_NEWS_DISASTER_ZEPPELIN,
- NS_ACCIDENT_VEHICLE,
- v->index,
- 0);
+ AddVehicleNewsItem(STR_NEWS_DISASTER_ZEPPELIN,
+ NS_ACCIDENT,
+ v->index); // Delete the news, when the zeppelin is gone
AI::NewEvent(GetTileOwner(v->tile), new AIEventDisasterZeppelinerCrashed(GetStationIndex(v->tile)));
}
}
@@ -340,10 +339,9 @@ static bool DisasterTick_Ufo(DisasterVehicle *v)
if (u->crashed_ctr == 0) {
u->crashed_ctr++;
- AddNewsItem(STR_NEWS_DISASTER_SMALL_UFO,
- NS_ACCIDENT_VEHICLE,
- u->index,
- 0);
+ AddVehicleNewsItem(STR_NEWS_DISASTER_SMALL_UFO,
+ NS_ACCIDENT,
+ u->index); // delete the news, when the roadvehicle is gone
AI::NewEvent(u->owner, new AIEventVehicleCrashed(u->index, u->tile, AIEventVehicleCrashed::CRASH_RV_UFO));
@@ -426,7 +424,7 @@ static bool DisasterTick_Aircraft(DisasterVehicle *v, uint16 image_override, boo
DestructIndustry(i);
SetDParam(0, i->town->index);
- AddNewsItem(news_message, NS_ACCIDENT_TILE, i->xy, 0);
+ AddIndustryNewsItem(news_message, NS_ACCIDENT, i->index); // delete the news, when the industry closes
SndPlayTileFx(SND_12_EXPLOSION, i->xy);
}
} else if (v->current_order.GetDestination() == 0) {
@@ -523,9 +521,9 @@ static bool DisasterTick_Big_Ufo(DisasterVehicle *v)
Town *t = ClosestTownFromTile(v->dest_tile, UINT_MAX);
SetDParam(0, t->index);
AddNewsItem(STR_NEWS_DISASTER_BIG_UFO,
- NS_ACCIDENT_TILE,
- v->tile,
- 0);
+ NS_ACCIDENT,
+ NR_TILE,
+ v->tile);
if (!Vehicle::CanAllocateItem(2)) {
delete v;
@@ -865,7 +863,7 @@ static void Disaster_CoalMine_Init()
if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_CAN_SUBSIDENCE) && --index < 0) {
SetDParam(0, i->town->index);
AddNewsItem(STR_NEWS_DISASTER_COAL_MINE_SUBSIDENCE,
- NS_ACCIDENT_TILE, i->xy + TileDiffXY(1, 1), 0);
+ NS_ACCIDENT, NR_TILE, i->xy + TileDiffXY(1, 1)); // keep the news, even when the mine closes
{
TileIndex tile = i->xy;