summaryrefslogtreecommitdiff
path: root/src/build_vehicle_gui.cpp
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
commit13c72c07d6b509dada6657a50475c2c8c53f7112 (patch)
tree878e2f7dfe1dea81959070b7ca59a854d6b85921 /src/build_vehicle_gui.cpp
parent6ab89d0031024a5cb01ddf48c212151ba075839a (diff)
downloadopenttd-13c72c07d6b509dada6657a50475c2c8c53f7112.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/build_vehicle_gui.cpp')
-rw-r--r--src/build_vehicle_gui.cpp23
1 files changed, 4 insertions, 19 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 5227b8944..03e09707b 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -694,26 +694,11 @@ static void GenerateBuildAircraftList(Window *w)
* when planes become obsolete and are removed */
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_HELI) continue;
- break;
-
- case AirportFTAClass::AIRPLANES:
- if (!(avi->subtype & AIR_CTOL)) continue;
- break;
-
- case AirportFTAClass::ALL: break;
- default:
- NOT_REACHED();
- }
-
- EngList_Add(&bv->eng_list, eid);
+ if (!IsEngineBuildable(eid, VEH_Aircraft, _local_player)) continue;
+ if (w->window_number != 0 && !IsAircraftBuildableAtStation(eid, w->window_number)) continue;
- if (eid == bv->sel_engine) sel_id = eid;
- }
+ EngList_Add(&bv->eng_list, eid);
+ if (eid == bv->sel_engine) sel_id = eid;
}
bv->sel_engine = sel_id;