(svn r14089) -Fix [FS#2219]: trains not being able to find a route to a depot when the front is already in the depot.

This commit is contained in:
rubidium
2008-08-17 11:04:37 +00:00
parent a8c9ba2ffe
commit 38905d596f
2 changed files with 9 additions and 6 deletions

View File

@@ -2128,9 +2128,14 @@ static TrainFindDepotData FindClosestTrainDepot(Vehicle *v, int max_distance)
TrainFindDepotData tfdd;
tfdd.owner = v->owner;
tfdd.best_length = UINT_MAX;
tfdd.reverse = false;
if (IsRailDepotTile(v->tile)) {
tfdd.tile = v->tile;
tfdd.best_length = 0;
return tfdd;
}
PBSTileInfo origin = FollowTrainReservation(v);
if (IsRailDepotTile(origin.tile)) {
tfdd.tile = origin.tile;
@@ -2138,6 +2143,8 @@ static TrainFindDepotData FindClosestTrainDepot(Vehicle *v, int max_distance)
return tfdd;
}
tfdd.best_length = UINT_MAX;
uint8 pathfinder = _settings_game.pf.pathfinder_for_trains;
if ((_settings_game.pf.reserve_paths || HasReservedTracks(v->tile, v->u.rail.track)) && pathfinder == VPF_NTP) pathfinder = VPF_NPF;