summaryrefslogtreecommitdiff
path: root/src/autoreplace_cmd.cpp
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2007-09-05 09:31:15 +0000
committerbjarni <bjarni@openttd.org>2007-09-05 09:31:15 +0000
commit9e5376fefe2d6fa600014f5d985a4554c4f883f2 (patch)
treeaadd9e10ab0ed6f92f50cc4280be6b3d044b6adc /src/autoreplace_cmd.cpp
parentb50a3d75223b2e83a4b3f8acbdee708d43b0730c (diff)
downloadopenttd-9e5376fefe2d6fa600014f5d985a4554c4f883f2.tar.xz
(svn r11044) -Fix (r11043): [autoreplace] a proper fix should cover all cases, not just the one mentioned in the bug report
Certain dualheaded/articulated consists could still trigger this issue
Diffstat (limited to 'src/autoreplace_cmd.cpp')
-rw-r--r--src/autoreplace_cmd.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp
index 3d939eaee..004d4627e 100644
--- a/src/autoreplace_cmd.cpp
+++ b/src/autoreplace_cmd.cpp
@@ -249,7 +249,8 @@ static CommandCost ReplaceVehicle(Vehicle **w, byte flags, Money total_cost)
CommandCost tmp_move;
if (old_v->type == VEH_TRAIN && IsFrontEngine(old_v)) {
- Vehicle *next_veh = IsMultiheaded(old_v) ? old_v->Next()->Next() : old_v->Next();
+ Vehicle *next_veh = GetNextVehicle(old_v);
+ if (IsMultiheaded(next_veh) && !IsTrainEngine(next_veh)) next_veh = next_veh->Next(); // don't try to move the rear multiheaded engine
if (next_veh != NULL) {
/* Verify that the wagons can be placed on the engine in question.
* This is done by building an engine, test if the wagons can be added and then sell the test engine. */