summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-12-31 17:52:42 +0000
committerrubidium <rubidium@openttd.org>2008-12-31 17:52:42 +0000
commit56d108edf86916caf9ecf55809200ae0af0b9270 (patch)
treed22a025a3b452598337569dc3987b2eb4c0d28ed
parent3ad50741c1608fa71f524ab07316fb015b776267 (diff)
downloadopenttd-56d108edf86916caf9ecf55809200ae0af0b9270.tar.xz
(svn r14779) -Fix (r14747) [FS#2485]: selling an articulated vehicle removed only the first part and not the rest.
-rw-r--r--src/train_cmd.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index d1fa79a97..e98461410 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -938,7 +938,11 @@ static Vehicle *UnlinkWagon(Vehicle *v, Vehicle *first)
if (v == NULL) return NULL;
if (IsTrainWagon(v)) SetFreeWagon(v);
- first->SetNext(NULL);
+
+ /* First can be an articulated engine, meaning GetNextVehicle() isn't
+ * v->Next(). Thus set the next vehicle of the last articulated part
+ * and the last articulated part is just before the next vehicle (v). */
+ v->Previous()->SetNext(NULL);
return v;
}