summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackykid <hackykid@openttd.org>2005-06-06 21:32:04 +0000
committerhackykid <hackykid@openttd.org>2005-06-06 21:32:04 +0000
commit4184611d3a43d046f341858b97c5fb2c1783b58c (patch)
tree4abc7fb6a38e6ab3cbe13b306a29074ac0080b13
parentac1af7848ea174c6e8ec97d7edaeee77ca3207aa (diff)
downloadopenttd-4184611d3a43d046f341858b97c5fb2c1783b58c.tar.xz
(svn r2427) - Fix: CmdMoveRailVehice; Prevent possible assertion failure when moving vehicles within one chain.
-rw-r--r--train_cmd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/train_cmd.c b/train_cmd.c
index a2d1aeda6..d473148c0 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -845,6 +845,9 @@ int32 CmdMoveRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
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;