summaryrefslogtreecommitdiff
path: root/src/pathfinder/opf/opf_ship.cpp
diff options
context:
space:
mode:
authorCharles Pigott <charlespigott@googlemail.com>2018-10-14 23:36:14 +0100
committerfrosch <github@elsenhans.name>2018-10-31 12:41:49 +0100
commitb5028efc1fa862073c908c435f84098ccd246fdc (patch)
treeec0a38f99b8885e4d977bb4e5ece8fd37d96a8e3 /src/pathfinder/opf/opf_ship.cpp
parent52ed3bcbaa88717ab50f71150ed9fc0b6af4715a (diff)
downloadopenttd-b5028efc1fa862073c908c435f84098ccd246fdc.tar.xz
Fix: Protect against a few out of bounds or uninitialised usage errors
Diffstat (limited to 'src/pathfinder/opf/opf_ship.cpp')
-rw-r--r--src/pathfinder/opf/opf_ship.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/pathfinder/opf/opf_ship.cpp b/src/pathfinder/opf/opf_ship.cpp
index 1a866337c..c993f8203 100644
--- a/src/pathfinder/opf/opf_ship.cpp
+++ b/src/pathfinder/opf/opf_ship.cpp
@@ -145,6 +145,7 @@ static uint FindShipTrack(const Ship *v, TileIndex tile, DiagDirection dir, Trac
Track best_track = INVALID_TRACK;
+ assert(bits != TRACK_BIT_NONE);
do {
Track i = RemoveFirstTrack(&bits);
@@ -176,7 +177,7 @@ good:;
best_length = pfs.best_length;
bad:;
- } while (bits != 0);
+ } while (bits != TRACK_BIT_NONE);
*track = best_track;
return best_bird_dist;