diff options
-rw-r--r-- | train_cmd.c | 3 |
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; |