From 4045429df6e39fbd020a5feda379177b2d2bc267 Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 13 Dec 2010 21:56:40 +0000 Subject: (svn r21511) -Feature: vehicle lost message for ships --- src/pathfinder/npf/npf.cpp | 3 ++- src/pathfinder/npf/npf_func.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/pathfinder/npf') diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp index 6cb013bc3..45c1c2d9c 100644 --- a/src/pathfinder/npf/npf.cpp +++ b/src/pathfinder/npf/npf.cpp @@ -1159,7 +1159,7 @@ Trackdir NPFRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDir /*** Ships ***/ -Track NPFShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks) +Track NPFShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found) { NPFFindStationOrTileData fstd; Trackdir trackdir = v->GetVehicleTrackdir(); @@ -1173,6 +1173,7 @@ Track NPFShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, * 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); if (ftd.best_trackdir == 0xff) return INVALID_TRACK; return TrackdirToTrack(ftd.best_trackdir); } diff --git a/src/pathfinder/npf/npf_func.h b/src/pathfinder/npf/npf_func.h index bdfee0cd7..f83c06f13 100644 --- a/src/pathfinder/npf/npf_func.h +++ b/src/pathfinder/npf/npf_func.h @@ -44,9 +44,10 @@ Trackdir NPFRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDir * @param tile the tile to find the path from (should be next tile the ship is about to enter) * @param enterdir diagonal direction which the ship will enter this new tile from * @param tracks available tracks 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_TRACK if the path could not be found */ -Track NPFShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks); +Track NPFShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found); /** * Used when user sends train to the nearest depot or if train needs servicing using NPF -- cgit v1.2.3-54-g00ecf