From 6bc002ad7414fb7d27e9ace04865d501cc3b08b9 Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 13 Dec 2010 21:56:25 +0000 Subject: (svn r21510) -Feature [FS#1956]: vehicle lost message for road vehicles --- src/pathfinder/npf/npf.cpp | 4 +++- src/pathfinder/npf/npf_func.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src/pathfinder/npf') diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp index 45d968529..6cb013bc3 100644 --- a/src/pathfinder/npf/npf.cpp +++ b/src/pathfinder/npf/npf.cpp @@ -1133,7 +1133,7 @@ FindDepotData NPFRoadVehicleFindNearestDepot(const RoadVehicle *v, int max_penal return FindDepotData(ftd.node.tile, ftd.best_path_dist); } -Trackdir NPFRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs) +Trackdir NPFRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs, bool &path_found) { NPFFindStationOrTileData fstd; @@ -1145,6 +1145,7 @@ Trackdir NPFRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDir /* We are already at our target. Just do something * @todo: maybe display error? * @todo: go straight ahead if possible? */ + path_found = true; return (Trackdir)FindFirstBit2x64(trackdirs); } @@ -1152,6 +1153,7 @@ Trackdir NPFRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDir * the direction we need to take to get there, if ftd.best_bird_dist is not 0, * we did not find our target, but ftd.best_trackdir contains the direction leading * to the tile closest to our target. */ + path_found = (ftd.best_bird_dist == 0); return ftd.best_trackdir; } diff --git a/src/pathfinder/npf/npf_func.h b/src/pathfinder/npf/npf_func.h index 3f9ce4280..bdfee0cd7 100644 --- a/src/pathfinder/npf/npf_func.h +++ b/src/pathfinder/npf/npf_func.h @@ -33,9 +33,10 @@ FindDepotData NPFRoadVehicleFindNearestDepot(const RoadVehicle *v, int max_penal * @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 NPFRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs); +Trackdir NPFRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs, bool &path_found); /** * Finds the best path for given ship using NPF. -- cgit v1.2.3-54-g00ecf