summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Nelson <peter1138@openttd.org>2018-05-28 08:37:43 +0100
committerCharles Pigott <charlespigott@googlemail.com>2019-01-14 19:57:07 +0000
commit7284b593c71dc54a055077d7f12dac91fca34324 (patch)
tree952f1211e0ca808eabc9b0eb58e7e31479182112 /src
parent8b6420441814e95ca32ffd4c601e3646f840c58c (diff)
downloadopenttd-7284b593c71dc54a055077d7f12dac91fca34324.tar.xz
Change: When ship is lost, pick first available track instead of a random track.
Diffstat (limited to 'src')
-rw-r--r--src/ship_cmd.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 88e2392e0..1594c2bf4 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -464,10 +464,8 @@ static Track ChooseShipTrack(Ship *v, TileIndex tile, DiagDirection enterdir, Tr
track = TrackBitsToTrack(v->state);
if (track != TRACK_X && track != TRACK_Y) track = TrackToOppositeTrack(track);
if (!HasBit(tracks, track)) {
- /* Can't continue in same direction so pick a random available track. */
- do {
- track = (Track)RandomRange(TRACK_END);
- } while ((TrackToTrackBits(track) & tracks) == TRACK_BIT_NONE);
+ /* Can't continue in same direction so pick first available track. */
+ track = FindFirstTrack(tracks);
}
path_found = false;
} else {