(svn r18807) -Codechange: introduce AirportSpec and move several non-statemachine-related variables to there

This commit is contained in:
yexo
2010-01-15 12:08:08 +00:00
parent c37d69d161
commit d669801f1d
16 changed files with 555 additions and 285 deletions

View File

@@ -181,9 +181,9 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
if (v->type != VEH_AIRCRAFT) return ::Depot::Get(order->GetDestination())->xy;
/* Aircraft's hangars are referenced by StationID, not DepotID */
const Station *st = ::Station::Get(order->GetDestination());
const AirportFTAClass *airport = st->Airport();
if (airport == NULL || airport->nof_depots == 0) return INVALID_TILE;
return st->airport_tile + ::ToTileIndexDiff(st->Airport()->airport_depots[0]);
const AirportSpec *as = st->GetAirportSpec();
if (as == NULL || as->nof_depots == 0) return INVALID_TILE;
return st->airport_tile + ::ToTileIndexDiff(as->depot_table[0]);
}
case OT_GOTO_STATION: {
@@ -200,8 +200,8 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
} else if (st->truck_stops != NULL) {
return st->truck_stops->xy;
} else if (st->airport_tile != INVALID_TILE) {
const AirportFTAClass *fta = st->Airport();
TILE_LOOP(tile, fta->size_x, fta->size_y, st->airport_tile) {
const AirportSpec *as = st->GetAirportSpec();
TILE_LOOP(tile, as->size_x, as->size_y, st->airport_tile) {
if (!::IsHangar(tile)) return tile;
}
}