summaryrefslogtreecommitdiff
path: root/src/newgrf_engine.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2008-03-03 20:56:30 +0000
committerglx <glx@openttd.org>2008-03-03 20:56:30 +0000
commitb64f637c720add4799c38c62b82c2858cdae9e0a (patch)
treedb93eac119a52cc01a0e4e720f4e99b3b98e4cc2 /src/newgrf_engine.cpp
parentcf0e6d4cb48b733b1f6ca8819c05638218899f76 (diff)
downloadopenttd-b64f637c720add4799c38c62b82c2858cdae9e0a.tar.xz
(svn r12331) -Feature: [NewGRF] vehicle variable FE bit 8
Diffstat (limited to 'src/newgrf_engine.cpp')
-rw-r--r--src/newgrf_engine.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index 648f46919..ef31b976c 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -627,16 +627,15 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
uint16 modflags = 0;
if (v->type == VEH_TRAIN) {
- /* @todo: There are some other bits that should be implemented:
- * bit 8: (Maybe?) Toggled whenever the train reverses.
- */
const Vehicle *u = IsTrainWagon(v) && HasBit(v->vehicle_flags, VRF_POWEREDWAGON) ? v->First() : v;
RailType railtype = GetRailType(v->tile);
bool powered = IsTrainEngine(v) || (IsTrainWagon(v) && HasBit(v->vehicle_flags, VRF_POWEREDWAGON));
bool has_power = powered && HasPowerOnRail(u->u.rail.railtype, railtype);
bool is_electric = powered && u->u.rail.railtype == RAILTYPE_ELECTRIC;
+
if (has_power) SetBit(modflags, 5);
if (is_electric && !has_power) SetBit(modflags, 6);
+ if (HasBit(v->u.rail.flags, VRF_TOGGLE_REVERSE)) SetBit(modflags, 8);
}
if (HasBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE)) SetBit(modflags, 10);