src/disaster_cmd.cpp
branchnoai
changeset 9826 9707ad4c9b60
parent 9732 f8eb3e208514
child 9837 c9ec4f82e0d0
equal deleted inserted replaced
9825:cc77111ebd85 9826:9707ad4c9b60
    22 
    22 
    23 #include "industry_map.h"
    23 #include "industry_map.h"
    24 #include "station_map.h"
    24 #include "station_map.h"
    25 #include "command_func.h"
    25 #include "command_func.h"
    26 #include "tile_cmd.h"
    26 #include "tile_cmd.h"
    27 #include "news.h"
    27 #include "news_func.h"
    28 #include "station.h"
    28 #include "station.h"
    29 #include "waypoint.h"
    29 #include "waypoint.h"
    30 #include "town.h"
    30 #include "town.h"
    31 #include "industry.h"
    31 #include "industry.h"
    32 #include "player_func.h"
    32 #include "player_func.h"
   231 				v->current_order.dest = 1;
   231 				v->current_order.dest = 1;
   232 				v->age = 0;
   232 				v->age = 0;
   233 
   233 
   234 				SetDParam(0, GetStationIndex(tile));
   234 				SetDParam(0, GetStationIndex(tile));
   235 				AddNewsItem(STR_B000_ZEPPELIN_DISASTER_AT,
   235 				AddNewsItem(STR_B000_ZEPPELIN_DISASTER_AT,
   236 					NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
   236 					NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
   237 					v->index,
   237 					v->index,
   238 					0);
   238 					0);
   239 			}
   239 			}
   240 		}
   240 		}
   241 
   241 
   364 			if (u->u.road.crashed_ctr == 0) {
   364 			if (u->u.road.crashed_ctr == 0) {
   365 				u->u.road.crashed_ctr++;
   365 				u->u.road.crashed_ctr++;
   366 				u->vehstatus |= VS_CRASHED;
   366 				u->vehstatus |= VS_CRASHED;
   367 
   367 
   368 				AddNewsItem(STR_B001_ROAD_VEHICLE_DESTROYED,
   368 				AddNewsItem(STR_B001_ROAD_VEHICLE_DESTROYED,
   369 					NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
   369 					NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, DNC_NONE,
   370 					u->index,
   370 					u->index,
   371 					0);
   371 					0);
   372 			}
   372 			}
   373 		}
   373 		}
   374 
   374 
   439 
   439 
   440 			i = GetIndustry(v->dest_tile);
   440 			i = GetIndustry(v->dest_tile);
   441 			DestructIndustry(i);
   441 			DestructIndustry(i);
   442 
   442 
   443 			SetDParam(0, i->town->index);
   443 			SetDParam(0, i->town->index);
   444 			AddNewsItem(STR_B002_OIL_REFINERY_EXPLOSION, NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0), i->xy, 0);
   444 			AddNewsItem(STR_B002_OIL_REFINERY_EXPLOSION, NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, DNC_NONE, i->xy, 0);
   445 			SndPlayTileFx(SND_12_EXPLOSION, i->xy);
   445 			SndPlayTileFx(SND_12_EXPLOSION, i->xy);
   446 		}
   446 		}
   447 	} else if (v->current_order.dest == 0) {
   447 	} else if (v->current_order.dest == 0) {
   448 		int x, y;
   448 		int x, y;
   449 		TileIndex tile;
   449 		TileIndex tile;
   512 
   512 
   513 			i = GetIndustry(v->dest_tile);
   513 			i = GetIndustry(v->dest_tile);
   514 			DestructIndustry(i);
   514 			DestructIndustry(i);
   515 
   515 
   516 			SetDParam(0, i->town->index);
   516 			SetDParam(0, i->town->index);
   517 			AddNewsItem(STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS, NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0), i->xy, 0);
   517 			AddNewsItem(STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS, NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, DNC_NONE, i->xy, 0);
   518 			SndPlayTileFx(SND_12_EXPLOSION, i->xy);
   518 			SndPlayTileFx(SND_12_EXPLOSION, i->xy);
   519 		}
   519 		}
   520 	} else if (v->current_order.dest == 0) {
   520 	} else if (v->current_order.dest == 0) {
   521 		int x, y;
   521 		int x, y;
   522 		TileIndex tile;
   522 		TileIndex tile;
   597 		}
   597 		}
   598 
   598 
   599 		t = ClosestTownFromTile(v->dest_tile, (uint)-1);
   599 		t = ClosestTownFromTile(v->dest_tile, (uint)-1);
   600 		SetDParam(0, t->index);
   600 		SetDParam(0, t->index);
   601 		AddNewsItem(STR_B004_UFO_LANDS_NEAR,
   601 		AddNewsItem(STR_B004_UFO_LANDS_NEAR,
   602 			NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0),
   602 			NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, DNC_NONE,
   603 			v->tile,
   603 			v->tile,
   604 			0);
   604 			0);
   605 
   605 
   606 		u = new DisasterVehicle();
   606 		u = new DisasterVehicle();
   607 		if (u == NULL) {
   607 		if (u == NULL) {
   975 
   975 
   976 		FOR_ALL_INDUSTRIES(i) {
   976 		FOR_ALL_INDUSTRIES(i) {
   977 			if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_CAN_SUBSIDENCE) && --index < 0) {
   977 			if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_CAN_SUBSIDENCE) && --index < 0) {
   978 				SetDParam(0, i->town->index);
   978 				SetDParam(0, i->town->index);
   979 				AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES,
   979 				AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES,
   980 					NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0), i->xy + TileDiffXY(1, 1), 0);
   980 					NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, DNC_NONE, i->xy + TileDiffXY(1, 1), 0);
   981 
   981 
   982 				{
   982 				{
   983 					TileIndex tile = i->xy;
   983 					TileIndex tile = i->xy;
   984 					TileIndexDiff step = TileOffsByDiagDir((DiagDirection)GB(Random(), 0, 2));
   984 					TileIndexDiff step = TileOffsByDiagDir((DiagDirection)GB(Random(), 0, 2));
   985 					uint n;
   985 					uint n;