summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-06-08 20:12:07 +0000
committerbjarni <bjarni@openttd.org>2006-06-08 20:12:07 +0000
commitc4fe960ebf38ffab9fc69deee10e6628fa22248c (patch)
treed3a252953c3bea3e0fb2402dee84252f12a5508b
parentef501eb6a6dc889d88b9abc413d4ef385eef56f6 (diff)
downloadopenttd-c4fe960ebf38ffab9fc69deee10e6628fa22248c.tar.xz
(svn r5175) -Fix: [autoreplace] FS#186 autoreplaced trains can leave all wagons in depot
also fixed a serious typo in peter1138's comments
-rw-r--r--train_cmd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/train_cmd.c b/train_cmd.c
index 582aa0530..773a4b55d 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -839,8 +839,10 @@ int CheckTrainStoppedInDepot(const Vehicle *v)
for (; v != NULL; v = v->next) {
/* This count is used by the depot code to determine the number of engines
* in the consist. Exclude articulated parts so that autoreplacing to
- * engines with more articulated parts that before works correctly. */
- if (!IsArticulatedPart(v)) count++;
+ * engines with more articulated parts that before works correctly.
+ *
+ * Also skip counting rear ends of multiheaded engines */
+ if (!IsArticulatedPart(v) && !(!IsTrainEngine(v) && IsMultiheaded(v))) count++;
if (v->u.rail.track != 0x80 || v->tile != tile ||
(IsFrontEngine(v) && !(v->vehstatus & VS_STOPPED))) {
return -1;