summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-09-02 22:47:45 +0000
committerbjarni <bjarni@openttd.org>2006-09-02 22:47:45 +0000
commit302772883ce9dd965ca6dfe9ade85530c6de8210 (patch)
tree864702554fea3f8634aab76b6bd5d2d495093735 /train_cmd.c
parent07199603b44327b9436ef0f878151a66243b45da (diff)
downloadopenttd-302772883ce9dd965ca6dfe9ade85530c6de8210.tar.xz
(svn r6352) -Fix: FS#322 Send to depot bug
now vehicles can't be sent to a depot when they are already inside a depot before they would remember the order and try to turn around when leaving the depot
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/train_cmd.c b/train_cmd.c
index 3e69da86c..79457b5d2 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -1973,6 +1973,10 @@ int32 CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
return 0;
}
+ /* check if at a standstill (not stopped only) in a depot
+ * the check is down here to make it possible to alter stop/service for trains entering the depot */
+ if (IsTileDepotType(v->tile, TRANSPORT_RAIL) && v->cur_speed == 0) return CMD_ERROR;
+
tfdd = FindClosestTrainDepot(v, 0);
if (tfdd.best_length == (uint)-1) return_cmd_error(STR_883A_UNABLE_TO_FIND_ROUTE_TO);