summaryrefslogtreecommitdiff
path: root/aircraft_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-07-22 14:43:53 +0000
committertron <tron@openttd.org>2006-07-22 14:43:53 +0000
commitfadc3a564c910d3b56c157a164e4e6770de2494e (patch)
treea4937442361134139cfc02c49524349fe016f776 /aircraft_cmd.c
parent81846cca24f76652d2d11bcc7d4e2566d4f61d03 (diff)
downloadopenttd-fadc3a564c910d3b56c157a164e4e6770de2494e.tar.xz
(svn r5594) Be more strict what's allowed to be built in a hangar: if the airport can't handle planes/helicopters don't present and disallow building planes/helicopters - the latter case wasn't covered yet.
Also remove an error message about building aircraft which can't be triggered by a normal client
Diffstat (limited to 'aircraft_cmd.c')
-rw-r--r--aircraft_cmd.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index f2ddad671..13909587c 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -196,7 +196,7 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Vehicle *vl[3], *v, *u, *w;
UnitID unit_num;
const AircraftVehicleInfo *avi;
- const Station *st2;
+ const AirportFTAClass* ap;
Engine *e;
if (!IsEngineBuildable(p1, VEH_Aircraft)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
@@ -211,18 +211,19 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
avi = AircraftVehInfo(p1);
+
+ // Prevent building aircraft types at places which can't handle them
+ ap = GetAirport(GetStationByTile(tile)->airport_type);
+ if ((avi->subtype & AIR_CTOL ? HELICOPTERS_ONLY : AIRCRAFT_ONLY) == ap->acc_planes) {
+ return CMD_ERROR;
+ }
+
// allocate 2 or 3 vehicle structs, depending on type
if (!AllocateVehicles(vl, avi->subtype & AIR_CTOL ? 2 : 3) ||
IsOrderPoolFull()) {
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
}
- // prevent building of aircraft in helidepot/helistation
- st2 = GetStationByTile(tile);
- if ((avi->subtype & AIR_CTOL) && (GetAirport(st2->airport_type)->acc_planes == HELICOPTERS_ONLY)) {
- return_cmd_error(STR_AIRPORT_HAS_NO_RUNWAY);
- }
-
unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_Aircraft);
if (unit_num > _patches.max_aircraft)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);