summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Nelson <peter1138@openttd.org>2019-01-13 23:29:29 +0000
committerCharles Pigott <charlespigott@googlemail.com>2019-01-14 19:57:07 +0000
commit6b0a467a50c706546129044a5bd6013bf6d310a1 (patch)
tree69c3b4910156bfeee549ac258249a31475a62423
parent7284b593c71dc54a055077d7f12dac91fca34324 (diff)
downloadopenttd-6b0a467a50c706546129044a5bd6013bf6d310a1.tar.xz
Change: Obey forbid_90_deg_turns when choosing available track with no destination.
-rw-r--r--src/ship_cmd.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 1594c2bf4..ab1f59f11 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -465,6 +465,10 @@ static Track ChooseShipTrack(Ship *v, TileIndex tile, DiagDirection enterdir, Tr
if (track != TRACK_X && track != TRACK_Y) track = TrackToOppositeTrack(track);
if (!HasBit(tracks, track)) {
/* Can't continue in same direction so pick first available track. */
+ if (_settings_game.pf.forbid_90_deg) {
+ tracks &= ~TrackCrossesTracks(TrackdirToTrack(v->GetVehicleTrackdir()));
+ if (tracks == TRACK_BIT_NONE) return INVALID_TRACK;
+ }
track = FindFirstTrack(tracks);
}
path_found = false;