changeset 15823:d9032e02c0c5 draft

(svn r20502) -Fix (r12330): VRF_POWEREDWAGON is part of train flags, not vehicle_flags.
author frosch <frosch@openttd.org>
date Sun, 15 Aug 2010 18:25:57 +0000
parents 942de975cc28
children 5ca623849e16
files src/newgrf_engine.cpp
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -670,9 +670,10 @@
 
 			if (v->type == VEH_TRAIN) {
 				const Train *t = Train::From(v);
-				const Train *u = t->IsWagon() && HasBit(t->vehicle_flags, VRF_POWEREDWAGON) ? t->First() : t;
+				bool is_powered_wagon = HasBit(t->flags, VRF_POWEREDWAGON);
+				const Train *u = is_powered_wagon ? t->First() : t; // for powered wagons the engine defines the type of engine (i.e. railtype)
 				RailType railtype = GetRailType(v->tile);
-				bool powered = t->IsEngine() || (t->IsWagon() && HasBit(t->vehicle_flags, VRF_POWEREDWAGON));
+				bool powered = t->IsEngine() || is_powered_wagon;
 				bool has_power = HasPowerOnRail(u->railtype, railtype);
 
 				if (powered && has_power) SetBit(modflags, 5);