changeset 3985:b5ab3d385a75 draft

(svn r5175) -Fix: [autoreplace] FS#186 autoreplaced trains can leave all wagons in depot also fixed a serious typo in peter1138's comments
author bjarni <bjarni@openttd.org>
date Thu, 08 Jun 2006 20:12:07 +0000
parents e4ab10e99e4f
children cd3843a5859b
files train_cmd.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -839,8 +839,10 @@
 	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;