diff options
author | matthijs <matthijs@openttd.org> | 2005-05-03 19:31:33 +0000 |
---|---|---|
committer | matthijs <matthijs@openttd.org> | 2005-05-03 19:31:33 +0000 |
commit | f7eb57c0fcf60e6992ce38ae61533b6c75f13a24 (patch) | |
tree | 717aa7afe0491338a1a0f2486f2f9242d228fb3f /train_cmd.c | |
parent | d082989dc9255d8857e950c3b8438669225da9c0 (diff) | |
download | openttd-f7eb57c0fcf60e6992ce38ae61533b6c75f13a24.tar.xz |
(svn r2261) - Fix: When crashed vehicles try to find a depot for servicing, openttd asserts.
Crashed vehicles shouldn't find depots anyway...
Diffstat (limited to 'train_cmd.c')
-rw-r--r-- | train_cmd.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/train_cmd.c b/train_cmd.c index ebbb129ef..d9eb5cd29 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -1298,7 +1298,8 @@ static bool TrainFindDepotEnumProc(uint tile, TrainFindDepotData *tfdd, int trac return length >= tfdd->best_length; } -// returns the tile of a depot to goto to. +// returns the tile of a depot to goto to. The given vehicle must be on track, +// so not crashed, in a depot, etc. static TrainFindDepotData FindClosestTrainDepot(Vehicle *v) { int i; @@ -1362,6 +1363,9 @@ int32 CmdTrainGotoDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2) if (v->type != VEH_Train || !CheckOwnership(v->owner)) return CMD_ERROR; + if (v->vehstatus & VS_CRASHED) + return CMD_ERROR; + if (v->current_order.type == OT_GOTO_DEPOT) { if (flags & DC_EXEC) { if (HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS)) { |