From b1ef3b117eb04f1dd7675f4a796f390aedfadba9 Mon Sep 17 00:00:00 2001 From: KUDr Date: Wed, 7 Jun 2006 17:04:22 +0000 Subject: (svn r5148) - Fix: [YAPF] RVs can now find depot they are currently in (thanks Darkvater) --- yapf/yapf_road.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/yapf/yapf_road.cpp b/yapf/yapf_road.cpp index 5bf679b56..6fbff3ecb 100644 --- a/yapf/yapf_road.cpp +++ b/yapf/yapf_road.cpp @@ -430,6 +430,12 @@ Depot* YapfFindNearestRoadDepot(const Vehicle *v) 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; -- cgit v1.2.3-70-g09d2