summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2008-04-14 20:48:17 +0000
committerglx <glx@openttd.org>2008-04-14 20:48:17 +0000
commit3a84a74f4d0ceadac5736e48ad8c29575266ced2 (patch)
tree6ca8f0301bdf922ab7cb2ac47d6e502440c5e681 /src
parent172237e32604d122397016123a89dc0bdcb14d09 (diff)
downloadopenttd-3a84a74f4d0ceadac5736e48ad8c29575266ced2.tar.xz
(svn r12711) -Codechange: remove unneeded loops
Diffstat (limited to 'src')
-rw-r--r--src/train_cmd.cpp3
-rw-r--r--src/vehicle.cpp3
-rw-r--r--src/vehicle_base.h2
3 files changed, 3 insertions, 5 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 076a9e225..b77a349d0 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1811,8 +1811,7 @@ static void ReverseTrainDirection(Vehicle *v)
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
}
- /* set reversed flag on all parts */
- for (Vehicle *u = v; u != NULL; u = u->Next()) ToggleBit(u->u.rail.flags, VRF_TOGGLE_REVERSE);
+ ToggleBit(v->u.rail.flags, VRF_TOGGLE_REVERSE);
ClrBit(v->u.rail.flags, VRF_REVERSING);
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 9d092d673..54cb8e288 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -2188,8 +2188,7 @@ void VehicleEnterDepot(Vehicle *v)
if (!IsFrontEngine(v)) v = v->First();
UpdateSignalsOnSegment(v->tile, INVALID_DIAGDIR, v->owner);
v->load_unload_time_rem = 0;
- /* Reset reversed flag */
- for (Vehicle *u = v; u != NULL; u = u->Next()) ClrBit(u->u.rail.flags, VRF_TOGGLE_REVERSE);
+ ClrBit(v->u.rail.flags, VRF_TOGGLE_REVERSE);
TrainConsistChanged(v);
break;
diff --git a/src/vehicle_base.h b/src/vehicle_base.h
index 55966821f..806dc2dc7 100644
--- a/src/vehicle_base.h
+++ b/src/vehicle_base.h
@@ -139,7 +139,7 @@ enum VehicleRailFlags {
/* used to mark that electric train engine is allowed to run on normal rail */
VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL = 6,
- /* used for vehicle var 0xFE bit 8 (toggled each time the train is reversed) */
+ /* used for vehicle var 0xFE bit 8 (toggled each time the train is reversed, accurate for first vehicle only) */
VRF_TOGGLE_REVERSE = 7,
};