summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2005-05-03 20:45:23 +0000
committermatthijs <matthijs@openttd.org>2005-05-03 20:45:23 +0000
commitf04ba0b67992c7aa3c0056675bf7f81a00c6d969 (patch)
tree7bc7501d9478e3e45c2b4d8d2bea5cbc5d3deb9c /train_cmd.c
parentf7eb57c0fcf60e6992ce38ae61533b6c75f13a24 (diff)
downloadopenttd-f04ba0b67992c7aa3c0056675bf7f81a00c6d969.tar.xz
(svn r2262) - Fix: Assertion when vehicle in a depot wants to do pathfinding.
GetVehicleTrackdir now tries to get a valid trackdir as much as possibly, by assuming that a vehicle is facing outwards in a depot or road station, for example. - Codechange: [Multistop] Multistop now also tries to find a slot for road vehicles that are in stations, since the pathfinder now properly handles that.
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/train_cmd.c b/train_cmd.c
index d9eb5cd29..577257800 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -1298,14 +1298,16 @@ static bool TrainFindDepotEnumProc(uint tile, TrainFindDepotData *tfdd, int trac
return length >= tfdd->best_length;
}
-// returns the tile of a depot to goto to. The given vehicle must be on track,
-// so not crashed, in a depot, etc.
+// returns the tile of a depot to goto to. The given vehicle must not be
+// crashed!
static TrainFindDepotData FindClosestTrainDepot(Vehicle *v)
{
int i;
TrainFindDepotData tfdd;
uint tile = v->tile;
+ assert(!(v->vehstatus & VS_CRASHED));
+
tfdd.owner = v->owner;
tfdd.best_length = (uint)-1;