summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-08-15 18:25:57 +0000
committerfrosch <frosch@openttd.org>2010-08-15 18:25:57 +0000
commitc52f42ea21bfc76e48a9ef93f721aa47376c474a (patch)
tree1324f522cb6b80966a282e5e24d5975cbdc91997
parent292ffad04eee12fcfc4d07b297c8ff96299dd17a (diff)
downloadopenttd-c52f42ea21bfc76e48a9ef93f721aa47376c474a.tar.xz
(svn r20502) -Fix (r12330): VRF_POWEREDWAGON is part of train flags, not vehicle_flags.
-rw-r--r--src/newgrf_engine.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index fd8835b8a..097a27f74 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -670,9 +670,10 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
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);