diff options
author | truelight <truelight@openttd.org> | 2006-01-06 18:26:02 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2006-01-06 18:26:02 +0000 |
commit | a165a408031c43a2799c9eb3000b01029ff30522 (patch) | |
tree | e382eda37fb4d3e31b8d7a6ce04bf891c615a49d | |
parent | d639318abddb829a412ddc1e245e04f12d124a09 (diff) | |
download | openttd-a165a408031c43a2799c9eb3000b01029ff30522.tar.xz |
(svn r3373) -Fix: don't link a wagon to itself, which resulted in a wagon disapearing, and a depot which was unable to remove
-rw-r--r-- | train_cmd.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/train_cmd.c b/train_cmd.c index 95bdd34cf..ffe1d6785 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -958,6 +958,8 @@ int32 CmdMoveRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2) if (dst->next == NULL) { /* It's the last one, so we will add the wagon just before the rear engine */ dst = GetPrevVehicleInChain(dst); + /* Now if the vehicle we want to link to is the vehicle itself, drop out */ + if (dst == src) return CMD_ERROR; // if dst is NULL, it means that dst got a rear multiheaded engine as first engine. We can't use that if (dst == NULL) return CMD_ERROR; } else { |