diff options
author | rubidium <rubidium@openttd.org> | 2010-12-13 21:56:25 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-12-13 21:56:25 +0000 |
commit | 6bc002ad7414fb7d27e9ace04865d501cc3b08b9 (patch) | |
tree | 14c0e17256d3047f9bcd9746746afe1b27b94a31 /src/pathfinder/yapf | |
parent | b05d2675fcb9d95ddf91b96c45985d03ce3cbd71 (diff) | |
download | openttd-6bc002ad7414fb7d27e9ace04865d501cc3b08b9.tar.xz |
(svn r21510) -Feature [FS#1956]: vehicle lost message for road vehicles
Diffstat (limited to 'src/pathfinder/yapf')
-rw-r--r-- | src/pathfinder/yapf/yapf.h | 3 | ||||
-rw-r--r-- | src/pathfinder/yapf/yapf_road.cpp | 14 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/pathfinder/yapf/yapf.h b/src/pathfinder/yapf/yapf.h index 60e10e42a..c0108697d 100644 --- a/src/pathfinder/yapf/yapf.h +++ b/src/pathfinder/yapf/yapf.h @@ -33,9 +33,10 @@ Track YapfShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, * @param tile the tile to find the path from (should be next tile the RV is about to enter) * @param enterdir diagonal direction which the RV will enter this new tile from * @param trackdirs available trackdirs on the new tile (to choose from) + * @param path_found [out] Whether a path has been found (true) or has been guessed (false) * @return the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found */ -Trackdir YapfRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs); +Trackdir YapfRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs, bool &path_found); /** * Finds the best path for given train using YAPF. diff --git a/src/pathfinder/yapf/yapf_road.cpp b/src/pathfinder/yapf/yapf_road.cpp index 446b84f24..eb832b320 100644 --- a/src/pathfinder/yapf/yapf_road.cpp +++ b/src/pathfinder/yapf/yapf_road.cpp @@ -328,13 +328,13 @@ public: return 'r'; } - static Trackdir stChooseRoadTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir) + static Trackdir stChooseRoadTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir, bool &path_found) { Tpf pf; - return pf.ChooseRoadTrack(v, tile, enterdir); + return pf.ChooseRoadTrack(v, tile, enterdir, path_found); } - FORCEINLINE Trackdir ChooseRoadTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir) + FORCEINLINE Trackdir ChooseRoadTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir, bool &path_found) { /* Handle special case - when next tile is destination tile. * However, when going to a station the (initial) destination @@ -356,7 +356,7 @@ public: Yapf().SetDestination(v); /* find the best path */ - Yapf().FindPath(v); + path_found = Yapf().FindPath(v); /* if path not found - return INVALID_TRACKDIR */ Trackdir next_trackdir = INVALID_TRACKDIR; @@ -475,10 +475,10 @@ struct CYapfRoadAnyDepot1 : CYapfT<CYapfRoad_TypesT<CYapfRoadAnyDepot1, CRoadNod struct CYapfRoadAnyDepot2 : CYapfT<CYapfRoad_TypesT<CYapfRoadAnyDepot2, CRoadNodeListExitDir , CYapfDestinationAnyDepotRoadT> > {}; -Trackdir YapfRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs) +Trackdir YapfRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs, bool &path_found) { /* default is YAPF type 2 */ - typedef Trackdir (*PfnChooseRoadTrack)(const RoadVehicle*, TileIndex, DiagDirection); + typedef Trackdir (*PfnChooseRoadTrack)(const RoadVehicle*, TileIndex, DiagDirection, bool &path_found); PfnChooseRoadTrack pfnChooseRoadTrack = &CYapfRoad2::stChooseRoadTrack; // default: ExitDir, allow 90-deg /* check if non-default YAPF type should be used */ @@ -486,7 +486,7 @@ Trackdir YapfRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDi pfnChooseRoadTrack = &CYapfRoad1::stChooseRoadTrack; // Trackdir, allow 90-deg } - Trackdir td_ret = pfnChooseRoadTrack(v, tile, enterdir); + Trackdir td_ret = pfnChooseRoadTrack(v, tile, enterdir, path_found); return (td_ret != INVALID_TRACKDIR) ? td_ret : (Trackdir)FindFirstBit2x64(trackdirs); } |