Fix ship collision avoidance near docks when dock not under station sign

See #77
This commit is contained in:
Jonathan G Rennison
2019-02-22 22:08:30 +00:00
parent 635ee89b86
commit e6ee962b03
3 changed files with 17 additions and 1 deletions

View File

@@ -647,7 +647,13 @@ static bool HandleSpeedOnAqueduct(Ship *v, TileIndex tile, TileIndex ramp)
*/
static void CheckDistanceBetweenShips(TileIndex tile, Ship *v, TrackBits tracks, Track *track_old, DiagDirection diagdir)
{
if (DistanceManhattan(v->dest_tile, tile) <= 3 && !v->current_order.IsType(OT_GOTO_WAYPOINT)) return; // No checking close to docks and depots.
// No checking close to docks and depots.
if (v->current_order.IsType(OT_GOTO_STATION)) {
Station *st = Station::Get(v->current_order.GetDestination());
if (st->IsWithinRangeOfDockingTile(tile, 3)) return;
} else if (!v->current_order.IsType(OT_GOTO_WAYPOINT)) {
if (DistanceManhattan(v->dest_tile, tile) <= 3) return;
}
Track track = *track_old;
TrackBits track_bits = TrackToTrackBits(track);