1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-12 09:09:09 +00:00

(svn r5148) - Fix: [YAPF] RVs can now find depot they are currently in (thanks Darkvater)

This commit is contained in:
KUDr
2006-06-07 17:04:22 +00:00
parent 36672afd8f
commit f2f4ca1dc4

View File

@@ -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;