summaryrefslogtreecommitdiff
path: root/src/autoreplace_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/autoreplace_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/autoreplace_gui.cpp')
-rw-r--r--src/autoreplace_gui.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 7dc37ab3b..a980d59c0 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -20,6 +20,7 @@
#include "player_func.h"
#include "widgets/dropdown_func.h"
#include "engine_func.h"
+#include "engine_base.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -198,8 +199,9 @@ static void GenerateReplaceVehList(Window *w, bool draw_left)
EngineList *list = &WP(w, replaceveh_d).list[i];
EngList_RemoveAll(list);
- EngineID eid;
- FOR_ALL_ENGINEIDS_OF_TYPE(eid, type) {
+ const Engine *e;
+ FOR_ALL_ENGINES_OF_TYPE(e, type) {
+ EngineID eid = e->index;
if (type == VEH_TRAIN && !GenerateReplaceRailList(eid, draw_left, WP(w, replaceveh_d).wagon_btnstate)) continue; // special rules for trains
if (draw_left) {
@@ -214,7 +216,7 @@ static void GenerateReplaceVehList(Window *w, bool draw_left)
if (!EnginesGotCargoInCommon(eid, WP(w, replaceveh_d).sel_engine[0])) continue; // the engines needs to be able to carry the same cargo
/* Road vehicles can't be replaced by trams and vice-versa */
- if (type == VEH_ROAD && HasBit(EngInfo(WP(w, replaceveh_d).sel_engine[0])->misc_flags, EF_ROAD_TRAM) != HasBit(EngInfo(eid)->misc_flags, EF_ROAD_TRAM)) continue;
+ if (type == VEH_ROAD && HasBit(EngInfo(WP(w, replaceveh_d).sel_engine[0])->misc_flags, EF_ROAD_TRAM) != HasBit(e->info.misc_flags, EF_ROAD_TRAM)) continue;
if (eid == WP(w, replaceveh_d).sel_engine[0]) continue; // we can't replace an engine into itself (that would be autorenew)
}