changeset 2825:7fa5565fc187 draft

(svn r3373) -Fix: don't link a wagon to itself, which resulted in a wagon disapearing, and a depot which was unable to remove
author truelight <truelight@openttd.org>
date Fri, 06 Jan 2006 18:26:02 +0000
parents af06f6ef243b
children c50fd40c9d5b
files train_cmd.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -958,6 +958,8 @@
 		if (dst->next == NULL) {
 			/* It's the last one, so we will add the wagon just before the rear engine */
 			dst = GetPrevVehicleInChain(dst);
+			/* Now if the vehicle we want to link to is the vehicle itself, drop out */
+			if (dst == src) return CMD_ERROR;
 			// if dst is NULL, it means that dst got a rear multiheaded engine as first engine. We can't use that
 			if (dst == NULL) return CMD_ERROR;
 		} else {