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
commit0984d10d9f438b64ff0534cd7fd0e9d051909708 (patch)
tree42f09b84ea0d899a29f40831cd1677ba5895dc10
parent4db7c4f549e2a30236052db08ceb31cf4d7f0131 (diff)
downloadopenttd-0984d10d9f438b64ff0534cd7fd0e9d051909708.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: