summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKUDr <kudr@openttd.org>2006-06-07 17:04:22 +0000
committerKUDr <kudr@openttd.org>2006-06-07 17:04:22 +0000
commitf2f4ca1dc4ac8b7713739eb35d73d6e6b016fa41 (patch)
treee9c6805120a5e944a5eaa76b359bf3cd9c862143
parent36672afd8f20859189e783c693e9dc770bae1cac (diff)
downloadopenttd-f2f4ca1dc4ac8b7713739eb35d73d6e6b016fa41.tar.xz
(svn r5148) - Fix: [YAPF] RVs can now find depot they are currently in (thanks Darkvater)
-rw-r--r--yapf/yapf_road.cpp6
1 files changed, 6 insertions, 0 deletions
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;