(svn r5289) - Backport from trunk (r5175, r5176): 0.4
authorDarkvater
Fri, 16 Jun 2006 18:59:26 +0000
branch0.4
changeset 10039 2f478be92946
parent 10038 946b26c14e3a
child 10040 cbf099a42001
(svn r5289) - Backport from trunk (r5175, r5176):
Autoreplaced trains can leave all wagons in depot under certain circumstances
train_cmd.c
--- a/train_cmd.c	Thu Jun 15 16:47:13 2006 +0000
+++ b/train_cmd.c	Fri Jun 16 18:59:26 2006 +0000
@@ -819,8 +819,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 than 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))) {
 			_error_message = STR_881A_TRAINS_CAN_ONLY_BE_ALTERED;