From 3a84a74f4d0ceadac5736e48ad8c29575266ced2 Mon Sep 17 00:00:00 2001 From: glx Date: Mon, 14 Apr 2008 20:48:17 +0000 Subject: (svn r12711) -Codechange: remove unneeded loops --- src/train_cmd.cpp | 3 +-- src/vehicle.cpp | 3 +-- src/vehicle_base.h | 2 +- 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, }; -- cgit v1.2.3-70-g09d2