From fadc3a564c910d3b56c157a164e4e6770de2494e Mon Sep 17 00:00:00 2001 From: tron Date: Sat, 22 Jul 2006 14:43:53 +0000 Subject: (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 --- aircraft_cmd.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'aircraft_cmd.c') 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); -- cgit v1.2.3-70-g09d2