disaster_cmd.c
changeset 2026 567e3bc9af72
parent 1999 e1596a4aab01
child 2049 538e73c53f54
equal deleted inserted replaced
2025:6d1723144029 2026:567e3bc9af72
   260 
   260 
   261 	if (v->current_order.station == 0) {
   261 	if (v->current_order.station == 0) {
   262 // fly around randomly
   262 // fly around randomly
   263 		int x = TileX(v->dest_tile) * 16;
   263 		int x = TileX(v->dest_tile) * 16;
   264 		int y = TileY(v->dest_tile) * 16;
   264 		int y = TileY(v->dest_tile) * 16;
   265 		if (abs(x - v->x_pos) +	abs(y - v->y_pos) >= 16) {
   265 		if (abs(x - v->x_pos) + abs(y - v->y_pos) >= 16) {
   266 			v->direction = GetDirectionTowards(v, x, y);
   266 			v->direction = GetDirectionTowards(v, x, y);
   267 			GetNewVehiclePos(v, &gp);
   267 			GetNewVehiclePos(v, &gp);
   268 			SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
   268 			SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
   269 			return;
   269 			return;
   270 		}
   270 		}
   329 
   329 
   330 static void DestructIndustry(Industry *i)
   330 static void DestructIndustry(Industry *i)
   331 {
   331 {
   332 	TileIndex tile;
   332 	TileIndex tile;
   333 
   333 
   334 	for(tile=0; tile != MapSize(); tile++) {
   334 	for (tile = 0; tile != MapSize(); tile++) {
   335 		if (IsTileType(tile, MP_INDUSTRY) &&	_map2[tile] == i->index) {
   335 		if (IsTileType(tile, MP_INDUSTRY) && _map2[tile] == i->index) {
   336 			_map_owner[tile] = 0;
   336 			_map_owner[tile] = 0;
   337 			MarkTileDirtyByTile(tile);
   337 			MarkTileDirtyByTile(tile);
   338 		}
   338 		}
   339 	}
   339 	}
   340 }
   340 }
   561 		w->vehstatus |= VS_DISASTER;
   561 		w->vehstatus |= VS_DISASTER;
   562 	} else if (v->current_order.station < 1) {
   562 	} else if (v->current_order.station < 1) {
   563 
   563 
   564 		int x = TileX(v->dest_tile) * 16;
   564 		int x = TileX(v->dest_tile) * 16;
   565 		int y = TileY(v->dest_tile) * 16;
   565 		int y = TileY(v->dest_tile) * 16;
   566 		if (abs(x - v->x_pos) +	abs(y - v->y_pos) >= 16) {
   566 		if (abs(x - v->x_pos) + abs(y - v->y_pos) >= 16) {
   567 			v->direction = GetDirectionTowards(v, x, y);
   567 			v->direction = GetDirectionTowards(v, x, y);
   568 			GetNewVehiclePos(v, &gp);
   568 			GetNewVehiclePos(v, &gp);
   569 			SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
   569 			SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
   570 			return;
   570 			return;
   571 		}
   571 		}
   905 	int maxloop = 15;
   905 	int maxloop = 15;
   906 	int index = Random() & 0xF;
   906 	int index = Random() & 0xF;
   907 
   907 
   908 	do {
   908 	do {
   909 		FOR_ALL_INDUSTRIES(i) {
   909 		FOR_ALL_INDUSTRIES(i) {
   910 			if (i->xy != 0 && i->type == IT_COAL_MINE	&& --index < 0) {
   910 			if (i->xy != 0 && i->type == IT_COAL_MINE && --index < 0) {
   911 
   911 
   912 				SetDParam(0, i->town->index);
   912 				SetDParam(0, i->town->index);
   913 				AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES,
   913 				AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES,
   914 					NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy + TileDiffXY(1, 1), 0);
   914 					NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy + TileDiffXY(1, 1), 0);
   915 
   915