disaster_cmd.c
changeset 1901 03bf9bf99319
parent 1891 862800791170
child 1977 37bbebf94434
equal deleted inserted replaced
1900:1f3309a61546 1901:03bf9bf99319
    19 	if (!EnsureNoVehicle(tile))
    19 	if (!EnsureNoVehicle(tile))
    20 		return;
    20 		return;
    21 
    21 
    22 	switch (GetTileType(tile)) {
    22 	switch (GetTileType(tile)) {
    23 		case MP_RAILWAY:
    23 		case MP_RAILWAY:
    24 			if (IS_HUMAN_PLAYER(_map_owner[tile])) DoClearSquare(tile);
    24 			if (IS_HUMAN_PLAYER(GetTileOwner(tile))) DoClearSquare(tile);
    25 			break;
    25 			break;
    26 
    26 
    27 		case MP_HOUSE: {
    27 		case MP_HOUSE: {
    28 			byte p = _current_player;
    28 			byte p = _current_player;
    29 			_current_player = OWNER_NONE;
    29 			_current_player = OWNER_NONE;
   171 		} else if (v->current_order.station == 0) {
   171 		} else if (v->current_order.station == 0) {
   172 			tile = v->tile; /**/
   172 			tile = v->tile; /**/
   173 
   173 
   174 			if (IsValidTile(tile) &&
   174 			if (IsValidTile(tile) &&
   175 					IsTileType(tile, MP_STATION) &&
   175 					IsTileType(tile, MP_STATION) &&
   176 				IS_BYTE_INSIDE(_map5[tile], 8, 0x43) &&
   176 					IS_BYTE_INSIDE(_map5[tile], 8, 0x43) &&
   177 				IS_HUMAN_PLAYER(_map_owner[tile])) {
   177 					IS_HUMAN_PLAYER(GetTileOwner(tile))) {
   178 
       
   179 				v->current_order.station = 1;
   178 				v->current_order.station = 1;
   180 				v->age = 0;
   179 				v->age = 0;
   181 
   180 
   182 				SetDParam(0, _map2[tile]);
   181 				SetDParam(0, _map2[tile]);
   183 				AddNewsItem(STR_B000_ZEPPELIN_DISASTER_AT,
   182 				AddNewsItem(STR_B000_ZEPPELIN_DISASTER_AT,
   197 
   196 
   198 		tile = v->tile; /**/
   197 		tile = v->tile; /**/
   199 
   198 
   200 		if (IsValidTile(tile) &&
   199 		if (IsValidTile(tile) &&
   201 				IsTileType(tile, MP_STATION) &&
   200 				IsTileType(tile, MP_STATION) &&
   202 			IS_BYTE_INSIDE(_map5[tile], 8, 0x43) &&
   201 				IS_BYTE_INSIDE(_map5[tile], 8, 0x43) &&
   203 			IS_HUMAN_PLAYER(_map_owner[tile])) {
   202 				IS_HUMAN_PLAYER(GetTileOwner(tile))) {
   204 
       
   205 			st = GetStation(_map2[tile]);
   203 			st = GetStation(_map2[tile]);
   206 			CLRBITS(st->airport_flags, RUNWAY_IN_block);
   204 			CLRBITS(st->airport_flags, RUNWAY_IN_block);
   207 		}
   205 		}
   208 
   206 
   209 		SetDisasterVehiclePos(v, v->x_pos, v->y_pos, v->z_pos);
   207 		SetDisasterVehiclePos(v, v->x_pos, v->y_pos, v->z_pos);
   240 	}
   238 	}
   241 
   239 
   242 	tile = v->tile;/**/
   240 	tile = v->tile;/**/
   243 	if (IsValidTile(tile) &&
   241 	if (IsValidTile(tile) &&
   244 			IsTileType(tile, MP_STATION) &&
   242 			IsTileType(tile, MP_STATION) &&
   245 		IS_BYTE_INSIDE(_map5[tile], 8, 0x43) &&
   243 			IS_BYTE_INSIDE(_map5[tile], 8, 0x43) &&
   246 		IS_HUMAN_PLAYER(_map_owner[tile])) {
   244 			IS_HUMAN_PLAYER(GetTileOwner(tile))) {
   247 
   245 
   248 		st = GetStation(_map2[tile]);
   246 		st = GetStation(_map2[tile]);
   249 		SETBITS(st->airport_flags, RUNWAY_IN_block);
   247 		SETBITS(st->airport_flags, RUNWAY_IN_block);
   250 	}
   248 	}
   251 }
   249 }
   579 		v->current_order.station = 1;
   577 		v->current_order.station = 1;
   580 
   578 
   581 		tile_org = tile = TILE_MASK(Random());
   579 		tile_org = tile = TILE_MASK(Random());
   582 		do {
   580 		do {
   583 			if (IsTileType(tile, MP_RAILWAY) &&
   581 			if (IsTileType(tile, MP_RAILWAY) &&
   584 					(_map5[tile]&~3)!=0xC0 &&	IS_HUMAN_PLAYER(_map_owner[tile]))
   582 					(_map5[tile] & ~3) != 0xC0 && IS_HUMAN_PLAYER(GetTileOwner(tile)))
   585 						break;
   583 				break;
   586 			tile = TILE_MASK(tile+1);
   584 			tile = TILE_MASK(tile+1);
   587 		} while (tile != tile_org);
   585 		} while (tile != tile_org);
   588 		v->dest_tile = tile;
   586 		v->dest_tile = tile;
   589 		v->age = 0;
   587 		v->age = 0;
   590 	} else
   588 	} else