From a00371c8db9d3b944d901ea0468eb58fe51418a7 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Tue, 29 Apr 2008 21:31:29 +0000 Subject: (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. --- src/autoreplace_gui.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/autoreplace_gui.cpp') 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) } -- cgit v1.2.3-54-g00ecf