(svn r2427) - Fix: CmdMoveRailVehice; Prevent possible assertion failure when moving vehicles within one chain.
authorhackykid
Mon, 06 Jun 2005 21:32:04 +0000
changeset 1921 263f1bcfc038
parent 1920 8a472263de70
child 1922 797081e56d13
(svn r2427) - Fix: CmdMoveRailVehice; Prevent possible assertion failure when moving vehicles within one chain.
train_cmd.c
--- a/train_cmd.c	Mon Jun 06 19:18:40 2005 +0000
+++ b/train_cmd.c	Mon Jun 06 21:32:04 2005 +0000
@@ -845,6 +845,9 @@
 				src_head = NULL;
 			}
 		} else {
+			// if moving within the same chain, dont use dst_head as it may get invalidated
+			if (src_head == dst_head)
+				dst_head = NULL;
 			// unlink single wagon from linked list
 			src_head = UnlinkWagon(src, src_head);
 			src->next = NULL;