changeset 13941:5a2efeabdd21 draft

(svn r18473) -Fix (r18470): crash when moving a multiheaded part to be just after itself
author rubidium <rubidium@openttd.org>
date Sat, 12 Dec 2009 23:24:11 +0000
parents b76c3fa5c59d
children 06db5e527f36
files src/train_cmd.cpp
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1368,9 +1368,12 @@
 
 	if (src->IsRearDualheaded()) return_cmd_error(STR_ERROR_REAR_ENGINE_FOLLOW_FRONT);
 
-	/* when moving all wagons, we can't have the same src_head and dst_head */
+	/* When moving all wagons, we can't have the same src_head and dst_head */
 	if (move_chain && src_head == dst_head) return CommandCost();
 
+	/* When moving a multiheaded part to be place after itself, bail out. */
+	if (!move_chain && dst->IsRearDualheaded() && src == dst->other_multiheaded_part) return CommandCost();
+
 	/* Check if all vehicles in the source train are stopped inside a depot. */
 	if (!src_head->IsStoppedInDepot()) return_cmd_error(STR_ERROR_TRAINS_CAN_ONLY_BE_ALTERED_INSIDE_A_DEPOT);