From 03d32e12fba1a4568aee7734d37e7e7195b72e8d Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 7 Jul 2008 16:04:38 +0000 Subject: (svn r13680) -Fix: NPF crashing when a ship tried to find a nearby depot when on an aqueduct. --- src/vehicle.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/vehicle.cpp b/src/vehicle.cpp index ff904aeb9..b0ad68113 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1650,7 +1650,7 @@ Trackdir GetVehicleTrackdir(const Vehicle *v) if (v->u.rail.track == TRACK_BIT_DEPOT) // We'll assume the train is facing outwards return DiagDirToDiagTrackdir(GetRailDepotDirection(v->tile)); // Train in depot - if (v->u.rail.track == TRACK_BIT_WORMHOLE) // train in tunnel, so just use his direction and assume a diagonal track + if (v->u.rail.track == TRACK_BIT_WORMHOLE) // train in tunnel or on bridge, so just use his direction and assume a diagonal track return DiagDirToDiagTrackdir(DirToDiagDir(v->direction)); return TrackDirectionToTrackdir(FindFirstTrack(v->u.rail.track), v->direction); @@ -1660,6 +1660,9 @@ Trackdir GetVehicleTrackdir(const Vehicle *v) // We'll assume the ship is facing outwards return DiagDirToDiagTrackdir(GetShipDepotDirection(v->tile)); + if (v->u.ship.state == TRACK_BIT_WORMHOLE) // ship on aqueduct, so just use his direction and assume a diagonal track + return DiagDirToDiagTrackdir(DirToDiagDir(v->direction)); + return TrackDirectionToTrackdir(FindFirstTrack(v->u.ship.state), v->direction); case VEH_ROAD: -- cgit v1.2.3-70-g09d2