changeset 13929:aed7190b4bf6 draft

(svn r18461) -Fix (r18456): when moving a wagon from the front of a train one could make a train 1 longer than allowed
author rubidium <rubidium@openttd.org>
date Fri, 11 Dec 2009 18:49:03 +0000
parents e0475ae251b9
children decc3774c2c4
files src/train_cmd.cpp
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1112,7 +1112,9 @@
 	 * will be within the required lengths. */
 	if (src_len + dst_len <= max_len) return CommandCost();
 
-	if (!move_chain && !src_head->IsFrontEngine() && src_head == src && (src_len - 1) > max_len) {
+	if (!move_chain && !src_head->IsFrontEngine() && src_head == src &&
+			/* First case moving within, second is make a new one */
+			(src_head == dst_head ? src_len : src_len - 1) > max_len) {
 		/* Moving of a *single* non-engine at the front of the chain,
 		 * i.e. a free wagon list. If the next unit is an engine a new
 		 * train will be created instead of removing a vehicle from a