610 static Vehicle *FindFloodableVehicleOnTile(TileIndex tile) |
610 static Vehicle *FindFloodableVehicleOnTile(TileIndex tile) |
611 { |
611 { |
612 if (IsTileType(tile, MP_STATION) && IsAirport(tile)) { |
612 if (IsTileType(tile, MP_STATION) && IsAirport(tile)) { |
613 const Station *st = GetStationByTile(tile); |
613 const Station *st = GetStationByTile(tile); |
614 const AirportFTAClass *airport = st->Airport(); |
614 const AirportFTAClass *airport = st->Airport(); |
|
615 |
|
616 //TODO: account for irregular shaped airports, and orientation |
615 for (uint x = 0; x < airport->size_x; x++) { |
617 for (uint x = 0; x < airport->size_x; x++) { |
616 for (uint y = 0; y < airport->size_y; y++) { |
618 for (uint y = 0; y < airport->size_y; y++) { |
617 tile = TILE_ADDXY(st->airport_tile, x, y); |
619 tile = TILE_ADDXY(st->airport_tile, x, y); |
618 Vehicle *v = FindVehicleOnTileZ(tile, 1 + airport->delta_z); |
620 //TODO: airport->delta_z no longer used. need to get actual height of individual tile in layout |
619 if (v != NULL && (v->vehstatus & VS_CRASHED) == 0) return v; |
621 //Vehicle *v = FindVehicleOnTileZ(tile, 1 + airport->delta_z); |
|
622 //if (v != NULL && (v->vehstatus & VS_CRASHED) == 0) return v; |
620 } |
623 } |
621 } |
624 } |
622 |
625 |
623 /* No vehicle could be flooded on this airport anymore */ |
626 /* No vehicle could be flooded on this airport anymore */ |
624 return NULL; |
627 return NULL; |
655 * that station has a big z_offset for the aircraft. */ |
658 * that station has a big z_offset for the aircraft. */ |
656 if (!IsTileType(v->tile, MP_STATION) || !IsAirport(v->tile) || GetTileMaxZ(v->tile) != 0) return; |
659 if (!IsTileType(v->tile, MP_STATION) || !IsAirport(v->tile) || GetTileMaxZ(v->tile) != 0) return; |
657 const Station *st = GetStationByTile(v->tile); |
660 const Station *st = GetStationByTile(v->tile); |
658 const AirportFTAClass *airport = st->Airport(); |
661 const AirportFTAClass *airport = st->Airport(); |
659 |
662 |
660 if (v->z_pos != airport->delta_z + 1) return; |
663 //TODO: airport->delta_z no longer used. need to get actual height of individual tile in layout |
|
664 //if (v->z_pos != airport->delta_z + 1) return; |
661 } |
665 } |
662 Vehicle *u; |
666 Vehicle *u; |
663 |
667 |
664 if (v->type != VEH_AIRCRAFT) v = GetFirstVehicleInChain(v); |
668 if (v->type != VEH_AIRCRAFT) v = GetFirstVehicleInChain(v); |
665 u = v; |
669 u = v; |