changeset 6044:f3ad05be7c49 draft

(svn r8771) -Fix r8343: build aircraft windows will no longer show aircraft that can't use the airport in question Now it's even better than ever because unless the no jetcrash cheat is enabled, the small airports will not show fast aircraft
author bjarni <bjarni@openttd.org>
date Sat, 17 Feb 2007 12:45:15 +0000
parents 6845063aa422
children 5b541e0c8c93
files src/build_vehicle_gui.cpp
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -692,6 +692,24 @@
 	sel_id = INVALID_ENGINE;
 	for (eid = AIRCRAFT_ENGINES_INDEX; eid < AIRCRAFT_ENGINES_INDEX + NUM_AIRCRAFT_ENGINES; eid++) {
 		if (IsEngineBuildable(eid, VEH_Aircraft, _local_player)) {
+			const AircraftVehicleInfo *avi = AircraftVehInfo(eid);
+			switch (bv->filter.flags & ~AirportFTAClass::SHORT_STRIP /* we don't care about the length of the runway here */) {
+				case AirportFTAClass::HELICOPTERS:
+					if (avi->subtype != AIR_HELICOPTER) continue;
+					break;
+
+				case AirportFTAClass::AIRPLANES:
+					if (avi->subtype != AIR_AIRCRAFT) continue;
+					break;
+
+				case AirportFTAClass::ALL: break;
+				default:
+					NOT_REACHED();
+			}
+
+			if (bv->filter.flags & AirportFTAClass::SHORT_STRIP &&
+				avi->subtype & AIR_FAST && !_cheats.no_jetcrash.value) continue; // don't build large aircraft in small airports
+
 			EngList_Add(&bv->eng_list, eid);
 
 			if (eid == bv->sel_engine) sel_id = eid;