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
commit5e8b14df3e563be00e60bbf8ee609826226f1328 (patch)
tree4abc7fb6a38e6ab3cbe13b306a29074ac0080b13
parent134e689aff192d6e41b48fbe6c5163ee7fbee902 (diff)
downloadopenttd-5e8b14df3e563be00e60bbf8ee609826226f1328.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;