(svn r19455) -Codechange: split all airport information in Station to a seperate class

This commit is contained in:
yexo
2010-03-18 21:02:20 +00:00
parent 6b67d9042c
commit 22a27d3b62
23 changed files with 100 additions and 97 deletions

View File

@@ -96,7 +96,7 @@
if (st->owner != _current_company) return -1;
if ((st->facilities & FACIL_AIRPORT) == 0) return -1;
return st->GetAirportSpec()->nof_depots;
return st->airport.GetSpec()->nof_depots;
}
/* static */ TileIndex AIAirport::GetHangarOfAirport(TileIndex tile)
@@ -120,7 +120,7 @@
if (!AIStation::HasStationType(station_id, AIStation::STATION_AIRPORT)) return AT_INVALID;
return (AirportType)::Station::Get(station_id)->airport_type;
return (AirportType)::Station::Get(station_id)->airport.type;
}

View File

@@ -29,7 +29,7 @@ AIDepotList::AIDepotList(AITile::TransportType transport_type)
const Station *st;
FOR_ALL_STATIONS(st) {
if (st->owner == ::_current_company) {
const AirportSpec *as = st->GetAirportSpec();
const AirportSpec *as = st->airport.GetSpec();
for (uint i = 0; i < as->nof_depots; i++) {
this->AddItem(st->GetHangarTile(i));
}

View File

@@ -181,7 +181,7 @@ 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());
if (st->GetAirportSpec()->nof_depots == 0) return INVALID_TILE;
if (st->airport.GetSpec()->nof_depots == 0) return INVALID_TILE;
return st->GetHangarTile(0);
}

View File

@@ -188,7 +188,7 @@
int num = 0;
const Station *st;
FOR_ALL_STATIONS(st) {
if (st->town == t && (st->facilities & FACIL_AIRPORT) && st->airport_type != AT_OILRIG) num++;
if (st->town == t && (st->facilities & FACIL_AIRPORT) && st->airport.type != AT_OILRIG) num++;
}
return max(0, 2 - num);
}