summaryrefslogtreecommitdiff
path: root/src/aircraft.h
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2007-03-06 22:11:58 +0000
committerbjarni <bjarni@openttd.org>2007-03-06 22:11:58 +0000
commitf61f1962c5e3422e56d0b1a03038d8ec27ade93a (patch)
tree878e2f7dfe1dea81959070b7ca59a854d6b85921 /src/aircraft.h
parenta24913d4613ee15aadb7cb39ec0924d4120fa0f8 (diff)
downloadopenttd-f61f1962c5e3422e56d0b1a03038d8ec27ade93a.tar.xz
(svn r9040) -Codechange: the build window and CmdBuildAircraft() now shares the code to figure out if an aircraft is buildable in the hangar in question
This should help ensuring that the build command and the list are consistent in what aircraft are buildable
Diffstat (limited to 'src/aircraft.h')
-rw-r--r--src/aircraft.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/aircraft.h b/src/aircraft.h
index 048e70afe..f020b2504 100644
--- a/src/aircraft.h
+++ b/src/aircraft.h
@@ -42,6 +42,20 @@ static inline bool IsAircraftInHangarStopped(const Vehicle* v)
return IsAircraftInHangar(v) && v->vehstatus & VS_STOPPED;
}
+/** Checks if an aircraft is buildable at the tile in question
+ * @param engine The engine to test
+ * @param tile The tile where the hangar is
+ * @return true if the aircraft can be build
+ */
+static inline bool IsAircraftBuildableAtStation(EngineID engine, TileIndex tile)
+{
+ const Station *st = GetStationByTile(tile);
+ const AirportFTAClass *apc = st->Airport();
+ const AircraftVehicleInfo *avi = AircraftVehInfo(engine);
+
+ return apc->flags & (avi->subtype & AIR_CTOL ? AirportFTAClass::AIRPLANES : AirportFTAClass::HELICOPTERS);
+}
+
uint16 AircraftDefaultCargoCapacity(CargoID cid, const AircraftVehicleInfo*);
void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);