changeset 3975:ebfc6791b13b draft

(svn r5148) - Fix: [YAPF] RVs can now find depot they are currently in (thanks Darkvater)
author KUDr <KUDr@openttd.org>
date Wed, 07 Jun 2006 17:04:22 +0000
parents 29d0a0b26bca
children b166cb90c8d0
files yapf/yapf_road.cpp
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/yapf/yapf_road.cpp
+++ b/yapf/yapf_road.cpp
@@ -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;