summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-07-20 19:58:33 +0000
committerfrosch <frosch@openttd.org>2009-07-20 19:58:33 +0000
commitd5a4c893656f61950595c057c7643f4082228d47 (patch)
treeae65d69eb2c0ef06cd95925420d1e3fb1c11c382 /src/train_cmd.cpp
parente3752f3ef82278a34fe5cce5515e240589465c77 (diff)
downloadopenttd-d5a4c893656f61950595c057c7643f4082228d47.tar.xz
(svn r16894) -Codechange: Add [Specialised]Vehicle::Last().
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 19a8cd84f..a85b16f95 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -704,7 +704,7 @@ static CommandCost CmdBuildRailWagon(EngineID engine, TileIndex tile, DoCommandF
if (w->tile == tile && w->IsFreeWagon() &&
w->engine_type == engine &&
!(w->vehstatus & VS_CRASHED)) {
- u = GetLastVehicleInChain(w);
+ u = w->Last();
break;
}
}
@@ -1829,7 +1829,7 @@ static void AdvanceWagonsBeforeSwap(Train *v)
{
Train *base = v;
Train *first = base; // first vehicle to move
- Train *last = Train::From(GetLastVehicleInChain(v)); // last vehicle to move
+ Train *last = v->Last(); // last vehicle to move
uint length = CountVehiclesInChain(v);
while (length > 2) {
@@ -1878,7 +1878,7 @@ static void AdvanceWagonsAfterSwap(Train *v)
Train *base = v;
Train *first = base; // first vehicle to move
- Train *last = Train::From(GetLastVehicleInChain(v)); // last vehicle to move
+ Train *last = v->Last(); // last vehicle to move
uint length = CountVehiclesInChain(v);
/* we have to make sure all wagons that leave a depot because of train reversing are moved coorectly
@@ -2219,7 +2219,7 @@ static TrainFindDepotData FindClosestTrainDepot(Train *v, int max_distance)
} break;
case VPF_NPF: { // NPF
- const Vehicle *last = GetLastVehicleInChain(v);
+ const Vehicle *last = v->Last();
Trackdir trackdir = v->GetVehicleTrackdir();
Trackdir trackdir_rev = ReverseTrackdir(last->GetVehicleTrackdir());
@@ -3225,7 +3225,7 @@ static bool CheckReverseTrain(Train *v)
case VPF_NPF: { // NPF
NPFFindStationOrTileData fstd;
NPFFoundTargetData ftd;
- Vehicle *last = GetLastVehicleInChain(v);
+ Vehicle *last = v->Last();
NPFFillWithOrderData(&fstd, v);