summaryrefslogtreecommitdiff
path: root/src/autoreplace_gui.cpp
diff options
context:
space:
mode:
authortron <tron@openttd.org>2007-01-24 07:14:09 +0000
committertron <tron@openttd.org>2007-01-24 07:14:09 +0000
commit0996de79df839647968838498d1953319705606d (patch)
treee2918d49dec3bdc87eab67e767fcb414e9cc04c2 /src/autoreplace_gui.cpp
parente2f72cbf1ff97f1b0eab68614ac730fe8cd47b73 (diff)
downloadopenttd-0996de79df839647968838498d1953319705606d.tar.xz
(svn r8385) -Fix
-Regression (r8314): I only did half the necessary changes to move railtype from Engine to RailVehicleInfo. Now do the rest.
Diffstat (limited to 'src/autoreplace_gui.cpp')
-rw-r--r--src/autoreplace_gui.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 42901ed8f..64118e6e9 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -60,9 +60,9 @@ static void train_engine_drawing_loop(int *x, int *y, int *pos, int *sel, Engine
colour = *sel == 0 ? 0xC : 0x10;
- if (!(ENGINE_AVAILABLE && show_outdated && RailVehInfo(i)->power && IsCompatibleRail(e->railtype, railtype))) {
- if ((!IsCompatibleRail(e->railtype, railtype) && show_compatible)
- || (e->railtype != railtype && !show_compatible)
+ if (!(ENGINE_AVAILABLE && show_outdated && RailVehInfo(i)->power && IsCompatibleRail(rvi->railtype, railtype))) {
+ if ((!IsCompatibleRail(rvi->railtype, railtype) && show_compatible)
+ || (rvi->railtype != railtype && !show_compatible)
|| !(rvi->flags & RVI_WAGON) != is_engine ||
!HASBIT(e->player_avail, _local_player))
continue;
@@ -113,16 +113,17 @@ static void SetupScrollStuffForReplaceWindow(Window *w)
for (i = 0; i < NUM_TRAIN_ENGINES; i++) {
EngineID eid = GetRailVehAtPosition(i);
const Engine* e = GetEngine(eid);
+ const RailVehicleInfo *rvi = RailVehInfo(eid);
const EngineInfo* info = EngInfo(eid);
// left window contains compatible engines while right window only contains engines of the selected type
if (ENGINE_AVAILABLE &&
- (RailVehInfo(eid)->power != 0) == (WP(w, replaceveh_d).wagon_btnstate != 0)) {
- if (IsCompatibleRail(e->railtype, railtype) && (p->num_engines[eid] > 0 || EngineHasReplacementForPlayer(p, eid))) {
+ (rvi->power != 0) == (WP(w, replaceveh_d).wagon_btnstate != 0)) {
+ if (IsCompatibleRail(rvi->railtype, railtype) && (p->num_engines[eid] > 0 || EngineHasReplacementForPlayer(p, eid))) {
if (sel[0] == count) selected_id[0] = eid;
count++;
}
- if (e->railtype == railtype && HASBIT(e->player_avail, _local_player)) {
+ if (rvi->railtype == railtype && HASBIT(e->player_avail, _local_player)) {
if (sel[1] == count2) selected_id[1] = eid;
count2++;
}