(svn r13680) -Fix: NPF crashing when a ship tried to find a nearby depot when on an aqueduct.
authorrubidium
Mon, 07 Jul 2008 16:04:38 +0000
changeset 11122 ef4f97adc383
parent 11121 c257c3ae547c
child 11123 a3752bbcc23b
(svn r13680) -Fix: NPF crashing when a ship tried to find a nearby depot when on an aqueduct.
src/vehicle.cpp
--- a/src/vehicle.cpp	Mon Jul 07 09:23:54 2008 +0000
+++ b/src/vehicle.cpp	Mon Jul 07 16:04:38 2008 +0000
@@ -1650,7 +1650,7 @@
 			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 @@
 				// 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: