summaryrefslogtreecommitdiff
path: root/src/build_vehicle_gui.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-04-29 21:31:29 +0000
committerpeter1138 <peter1138@openttd.org>2008-04-29 21:31:29 +0000
commita00371c8db9d3b944d901ea0468eb58fe51418a7 (patch)
tree82b8c0d69acb1c38843e4fcf0b11f46a057ef270 /src/build_vehicle_gui.cpp
parent1d01390fa6d6ca83cd0cb148137d2a81749b380d (diff)
downloadopenttd-a00371c8db9d3b944d901ea0468eb58fe51418a7.tar.xz
(svn r12924) -Feature: Introducing the so called 'engine pool' which primarily removes the fixed engine type limits and also happens to allow (with the patch option 'dynamic_engines') multiple NewGRF vehicle sets to coexist.
Diffstat (limited to 'src/build_vehicle_gui.cpp')
-rw-r--r--src/build_vehicle_gui.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 5174a949e..317037723 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -800,9 +800,10 @@ static void GenerateBuildTrainList(Window *w)
* Also check to see if the previously selected engine is still available,
* and if not, reset selection to INVALID_ENGINE. This could be the case
* when engines become obsolete and are removed */
- EngineID eid;
- FOR_ALL_ENGINEIDS_OF_TYPE(eid, VEH_TRAIN) {
- const RailVehicleInfo *rvi = RailVehInfo(eid);
+ const Engine *e;
+ FOR_ALL_ENGINES_OF_TYPE(e, VEH_TRAIN) {
+ EngineID eid = e->index;
+ const RailVehicleInfo *rvi = &e->u.rail;
if (bv->filter.railtype != RAILTYPE_END && !HasPowerOnRail(rvi->railtype, bv->filter.railtype)) continue;
if (!IsEngineBuildable(eid, VEH_TRAIN, _local_player)) continue;
@@ -839,8 +840,9 @@ static void GenerateBuildRoadVehList(Window *w)
EngList_RemoveAll(&bv->eng_list);
- EngineID eid;
- FOR_ALL_ENGINEIDS_OF_TYPE(eid, VEH_ROAD) {
+ const Engine *e;
+ FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
+ EngineID eid = e->index;
if (!IsEngineBuildable(eid, VEH_ROAD, _local_player)) continue;
if (!HasBit(bv->filter.roadtypes, HasBit(EngInfo(eid)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD)) continue;
EngList_Add(&bv->eng_list, eid);
@@ -858,8 +860,9 @@ static void GenerateBuildShipList(Window *w)
EngList_RemoveAll(&bv->eng_list);
- EngineID eid;
- FOR_ALL_ENGINEIDS_OF_TYPE(eid, VEH_SHIP) {
+ const Engine *e;
+ FOR_ALL_ENGINES_OF_TYPE(e, VEH_SHIP) {
+ EngineID eid = e->index;
if (!IsEngineBuildable(eid, VEH_SHIP, _local_player)) continue;
EngList_Add(&bv->eng_list, eid);
@@ -880,8 +883,9 @@ static void GenerateBuildAircraftList(Window *w)
* Also check to see if the previously selected plane is still available,
* and if not, reset selection to INVALID_ENGINE. This could be the case
* when planes become obsolete and are removed */
- EngineID eid;
- FOR_ALL_ENGINEIDS_OF_TYPE(eid, VEH_AIRCRAFT) {
+ const Engine *e;
+ FOR_ALL_ENGINES_OF_TYPE(e, VEH_AIRCRAFT) {
+ EngineID eid = e->index;
if (!IsEngineBuildable(eid, VEH_AIRCRAFT, _local_player)) continue;
/* First VEH_END window_numbers are fake to allow a window open for all different types at once */
if (w->window_number > VEH_END && !CanAircraftUseStation(eid, w->window_number)) continue;