(svn r5148) - Fix: [YAPF] RVs can now find depot they are currently in (thanks Darkvater)
authorKUDr
Wed, 07 Jun 2006 17:04:22 +0000
changeset 3975 92753022c942
parent 3974 08b438ca3429
child 3976 6135bc445350
(svn r5148) - Fix: [YAPF] RVs can now find depot they are currently in (thanks Darkvater)
yapf/yapf_road.cpp
--- a/yapf/yapf_road.cpp	Wed Jun 07 07:33:56 2006 +0000
+++ b/yapf/yapf_road.cpp	Wed Jun 07 17:04:22 2006 +0000
@@ -430,6 +430,12 @@
 	if ((GetTileTrackStatus(tile, TRANSPORT_ROAD) & TrackdirToTrackdirBits(trackdir)) == 0)
 		return NULL;
 
+	// handle the case when our vehicle is already in the depot tile
+	if (IsTileType(tile, MP_STREET) && IsTileDepotType(tile, TRANSPORT_ROAD)) {
+		// only what we need to return is the Depot*
+		return GetDepotByTile(tile);
+	}
+
 	// default is YAPF type 2
 	typedef Depot* (*PfnFindNearestDepot)(Vehicle*, TileIndex, Trackdir);
 	PfnFindNearestDepot pfnFindNearestDepot = &CYapfRoadAnyDepot2::stFindNearestDepot;