From b05d2675fcb9d95ddf91b96c45985d03ce3cbd71 Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 13 Dec 2010 21:55:59 +0000 Subject: (svn r21509) -Codechange: rename the rail pathfinders "path_not_found" parameter to "path_found" and remove the ! where the variables are set / read --- src/train_cmd.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/train_cmd.cpp') diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index b1119d8ee..bb473f3c8 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2134,16 +2134,16 @@ static const byte _initial_tile_subcoord[6][4][3] = { * @param tile The tile the train is about to enter * @param enterdir Diagonal direction the train is coming from * @param tracks Usable tracks on the new tile - * @param path_not_found [out] Set to false if the pathfinder couldn't find a way to the destination + * @param path_found [out] Whether a path has been found or not. * @param do_track_reservation Path reservation is requested * @param dest [out] State and destination of the requested path * @return The best track the train should follow */ -static Track DoTrainPathfind(const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found, bool do_track_reservation, PBSTileInfo *dest) +static Track DoTrainPathfind(const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, bool do_track_reservation, PBSTileInfo *dest) { switch (_settings_game.pf.pathfinder_for_trains) { - case VPF_NPF: return NPFTrainChooseTrack(v, tile, enterdir, tracks, path_not_found, do_track_reservation, dest); - case VPF_YAPF: return YapfTrainChooseTrack(v, tile, enterdir, tracks, path_not_found, do_track_reservation, dest); + case VPF_NPF: return NPFTrainChooseTrack(v, tile, enterdir, tracks, path_found, do_track_reservation, dest); + case VPF_YAPF: return YapfTrainChooseTrack(v, tile, enterdir, tracks, path_found, do_track_reservation, dest); default: NOT_REACHED(); } @@ -2403,12 +2403,12 @@ static Track ChooseTrainTrack(Train *v, TileIndex tile, DiagDirection enterdir, if (res_dest.tile != INVALID_TILE && !res_dest.okay) { /* Pathfinders are able to tell that route was only 'guessed'. */ - bool path_not_found = false; + bool path_found = true; TileIndex new_tile = res_dest.tile; - Track next_track = DoTrainPathfind(v, new_tile, dest_enterdir, tracks, &path_not_found, do_track_reservation, &res_dest); + Track next_track = DoTrainPathfind(v, new_tile, dest_enterdir, tracks, path_found, do_track_reservation, &res_dest); if (new_tile == tile) best_track = next_track; - v->HandlePathfindingResult(!path_not_found); + v->HandlePathfindingResult(path_found); } /* No track reservation requested -> finished. */ @@ -2453,7 +2453,8 @@ static Track ChooseTrainTrack(Train *v, TileIndex tile, DiagDirection enterdir, /* Get next order with destination. */ if (orders.SwitchToNextOrder(true)) { PBSTileInfo cur_dest; - DoTrainPathfind(v, next_tile, exitdir, reachable, NULL, true, &cur_dest); + bool path_found; + DoTrainPathfind(v, next_tile, exitdir, reachable, path_found, true, &cur_dest); if (cur_dest.tile != INVALID_TILE) { res_dest = cur_dest; if (res_dest.okay) continue; -- cgit v1.2.3-54-g00ecf