summaryrefslogtreecommitdiff
path: root/src/station_base.h
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-03-18 21:02:20 +0000
committeryexo <yexo@openttd.org>2010-03-18 21:02:20 +0000
commitc4a88ce0225a57243a79e28d133c2ecd884bee68 (patch)
tree766e1e5469d2c9d2956f5d6c79fd5bba787cf2ca /src/station_base.h
parent0eb5709c86f8dbfdcf7f91a178e46be4a1bc53d0 (diff)
downloadopenttd-c4a88ce0225a57243a79e28d133c2ecd884bee68.tar.xz
(svn r19455) -Codechange: split all airport information in Station to a seperate class
Diffstat (limited to 'src/station_base.h')
-rw-r--r--src/station_base.h40
1 files changed, 22 insertions, 18 deletions
diff --git a/src/station_base.h b/src/station_base.h
index e3aa8b726..bee8c6986 100644
--- a/src/station_base.h
+++ b/src/station_base.h
@@ -45,6 +45,25 @@ struct GoodsEntry {
StationCargoList cargo; ///< The cargo packets of cargo waiting in this station
};
+/** All airport-related information. Only valid if tile != INVALID_TILE. */
+struct Airport : public TileArea {
+ Airport() : TileArea(INVALID_TILE, 0, 0) {}
+
+ uint64 flags; ///< stores which blocks on the airport are taken. was 16 bit earlier on, then 32
+ byte type;
+
+ const AirportSpec *GetSpec() const
+ {
+ if (this->tile == INVALID_TILE) return &AirportSpec::dummy;
+ return AirportSpec::Get(this->type);
+ }
+
+ const AirportFTAClass *GetFTA() const
+ {
+ if (this->tile == INVALID_TILE) return GetAirport(AT_DUMMY);
+ return this->GetSpec()->fsm;
+ }
+};
typedef SmallVector<Industry *, 2> IndustryVector;
@@ -58,24 +77,12 @@ public:
RoadStop *GetPrimaryRoadStop(const struct RoadVehicle *v) const;
- const AirportFTAClass *Airport() const
- {
- if (airport.tile == INVALID_TILE) return GetAirport(AT_DUMMY);
- return GetAirport(airport_type);
- }
-
- const AirportSpec *GetAirportSpec() const
- {
- if (airport.tile == INVALID_TILE) return &AirportSpec::dummy;
- return AirportSpec::Get(this->airport_type);
- }
-
RoadStop *bus_stops; ///< All the road stops
TileArea bus_station; ///< Tile area the bus 'station' part covers
RoadStop *truck_stops; ///< All the truck stops
TileArea truck_station; ///< Tile area the truck 'station' part covers
- TileArea airport; ///< Tile area the airport covers
+ Airport airport; ///< Tile area the airport covers
TileIndex dock_tile; ///< The location of the dock
IndustryType indtype; ///< Industry type to get the name from
@@ -84,9 +91,6 @@ public:
byte time_since_load;
byte time_since_unload;
- byte airport_type;
-
- uint64 airport_flags; ///< stores which blocks on the airport are taken. was 16 bit earlier on, then 32
byte last_vehicle_type;
std::list<Vehicle *> loading_vehicles;
@@ -130,8 +134,8 @@ public:
FORCEINLINE TileIndex GetHangarTile(uint hangar_num) const
{
assert(this->airport.tile != INVALID_TILE);
- assert(hangar_num < this->GetAirportSpec()->nof_depots);
- return this->airport.tile + ToTileIndexDiff(this->GetAirportSpec()->depot_table[hangar_num]);
+ assert(hangar_num < this->airport.GetSpec()->nof_depots);
+ return this->airport.tile + ToTileIndexDiff(this->airport.GetSpec()->depot_table[hangar_num]);
}
/* virtual */ uint32 GetNewGRFVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) const;