summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-07-19 19:17:41 +0000
committerfrosch <frosch@openttd.org>2009-07-19 19:17:41 +0000
commit7b92d9efe4efbc69b4a2b4563f2fc7645bc8938d (patch)
tree8494dfb1d08cb55203440c4c2f02f077394b6041 /src/train_cmd.cpp
parent3999dbe7f786931607c0f185ed1fc166b0bdd012 (diff)
downloadopenttd-7b92d9efe4efbc69b4a2b4563f2fc7645bc8938d.tar.xz
(svn r16884) -Codechange: Add Train::GetFirstEnginePart() and use it.
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 2f1e81658..19a8cd84f 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1105,9 +1105,9 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, u
}
/* if an articulated part is being handled, deal with its parent vehicle */
- while (src->IsArticulatedPart()) src = src->Previous();
+ src = src->GetFirstEnginePart();
if (dst != NULL) {
- while (dst->IsArticulatedPart()) dst = dst->Previous();
+ dst = dst->GetFirstEnginePart();
}
/* don't move the same vehicle.. */
@@ -1445,7 +1445,7 @@ CommandCost CmdSellRailWagon(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
if (v->vehstatus & VS_CRASHED) return_cmd_error(STR_CAN_T_SELL_DESTROYED_VEHICLE);
- while (v->IsArticulatedPart()) v = v->Previous();
+ v = v->GetFirstEnginePart();
Train *first = v->First();
/* make sure the vehicle is stopped in the depot */