summaryrefslogtreecommitdiff
path: root/src/pathfinder/npf
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/pathfinder/npf
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/pathfinder/npf')
-rw-r--r--src/pathfinder/npf/npf.cpp6
-rw-r--r--src/pathfinder/npf/npf_func.h4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp
index d6ad43e4d..45d968529 100644
--- a/src/pathfinder/npf/npf.cpp
+++ b/src/pathfinder/npf/npf.cpp
@@ -1240,7 +1240,7 @@ bool NPFTrainCheckReverse(const Train *v)
return ftd.best_bird_dist != 0 && NPFGetFlag(&ftd.node, NPF_FLAG_REVERSE);
}
-Track NPFTrainChooseTrack(const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found, bool reserve_track, struct PBSTileInfo *target)
+Track NPFTrainChooseTrack(const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, bool reserve_track, struct PBSTileInfo *target)
{
NPFFindStationOrTileData fstd;
NPFFillWithOrderData(&fstd, v, reserve_track);
@@ -1260,7 +1260,7 @@ Track NPFTrainChooseTrack(const Train *v, TileIndex tile, DiagDirection enterdir
/* We are already at our target. Just do something
* @todo maybe display error?
* @todo: go straight ahead if possible? */
- if (path_not_found) *path_not_found = false;
+ path_found = true;
return FindFirstTrack(tracks);
}
@@ -1268,7 +1268,7 @@ Track NPFTrainChooseTrack(const Train *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. */
- if (path_not_found != NULL) *path_not_found = (ftd.best_bird_dist != 0);
+ path_found = (ftd.best_bird_dist == 0);
/* Discard enterdir information, making it a normal track */
return TrackdirToTrack(ftd.best_trackdir);
}
diff --git a/src/pathfinder/npf/npf_func.h b/src/pathfinder/npf/npf_func.h
index f0913dfa8..3f9ce4280 100644
--- a/src/pathfinder/npf/npf_func.h
+++ b/src/pathfinder/npf/npf_func.h
@@ -81,11 +81,11 @@ bool NPFTrainCheckReverse(const Train *v);
* @param tile the tile to find the path from (should be next tile the train is about to enter)
* @param enterdir diagonal direction which the RV will enter this new tile from
* @param tracks available trackdirs on the new tile (to choose from)
- * @param path_not_found [out] true is returned if no path can be found (returned Trackdir is only a 'guess')
+ * @param path_found [out] Whether a path has been found (true) or has been guessed (false)
* @param reserve_track indicates whether YAPF should try to reserve the found path
* @param target [out] the target tile of the reservation, free is set to true if path was reserved
* @return the best track for next turn
*/
-Track NPFTrainChooseTrack(const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found, bool reserve_track, struct PBSTileInfo *target);
+Track NPFTrainChooseTrack(const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, bool reserve_track, struct PBSTileInfo *target);
#endif /* NPF_FUNC_H */