summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-07-07 16:04:38 +0000
committerrubidium <rubidium@openttd.org>2008-07-07 16:04:38 +0000
commit03d32e12fba1a4568aee7734d37e7e7195b72e8d (patch)
tree42f09b84ea0d899a29f40831cd1677ba5895dc10
parentfbdc1c047643d0d6647dfe7562f4739c30f298d1 (diff)
downloadopenttd-03d32e12fba1a4568aee7734d37e7e7195b72e8d.tar.xz
(svn r13680) -Fix: NPF crashing when a ship tried to find a nearby depot when on an aqueduct.
-rw-r--r--src/vehicle.cpp5
1 files changed, 4 insertions, 1 deletions
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: