summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJ0an Josep <juanjo.ng.83@gmail.com>2019-01-15 22:37:32 +0100
committerPeterN <peter@fuzzle.org>2019-01-26 22:55:12 +0000
commita5836874ef824f63d81e12064aba2f5c762109e8 (patch)
tree2e2277581d0e6e27283fa556b5fa1f298799f6ca /src
parenta18b0eba5b1dc4c60eac9313e485d6912676ce31 (diff)
downloadopenttd-a5836874ef824f63d81e12064aba2f5c762109e8.tar.xz
Codechange: Use track functions.
Diffstat (limited to 'src')
-rw-r--r--src/pathfinder/yapf/yapf_ship.cpp2
-rw-r--r--src/ship_cmd.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/pathfinder/yapf/yapf_ship.cpp b/src/pathfinder/yapf/yapf_ship.cpp
index 7ca95ae69..c6e484fea 100644
--- a/src/pathfinder/yapf/yapf_ship.cpp
+++ b/src/pathfinder/yapf/yapf_ship.cpp
@@ -59,7 +59,7 @@ public:
/* handle special case - when next tile is destination tile */
if (tile == v->dest_tile) {
/* convert tracks to trackdirs */
- TrackdirBits trackdirs = (TrackdirBits)(tracks | ((int)tracks << 8));
+ TrackdirBits trackdirs = TrackBitsToTrackdirBits(tracks);
/* limit to trackdirs reachable from enterdir */
trackdirs &= DiagdirReachesTrackdirs(enterdir);
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 4603043d6..ec0d43089 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -464,7 +464,7 @@ static Track ChooseShipTrack(Ship *v, TileIndex tile, DiagDirection enterdir, Tr
if (v->dest_tile == 0 || DistanceManhattan(tile, v->dest_tile) > SHIP_MAX_ORDER_DISTANCE + 5) {
/* No destination or destination too far, don't invoke pathfinder. */
track = TrackBitsToTrack(v->state);
- if (track != TRACK_X && track != TRACK_Y) track = TrackToOppositeTrack(track);
+ if (!IsDiagonalTrack(track)) 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) {