summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-12-13 21:55:59 +0000
committerrubidium <rubidium@openttd.org>2010-12-13 21:55:59 +0000
commitb05d2675fcb9d95ddf91b96c45985d03ce3cbd71 (patch)
tree80634e04047ca4b050593b14b2f7f35bf9234590 /src/train_cmd.cpp
parent6d831906a3da98d357149c6a56915f9fb06b417b (diff)
downloadopenttd-b05d2675fcb9d95ddf91b96c45985d03ce3cbd71.tar.xz
(svn r21509) -Codechange: rename the rail pathfinders "path_not_found" parameter to "path_found" and remove the ! where the variables are set / read
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp17
1 files changed, 9 insertions, 8 deletions
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;