summaryrefslogtreecommitdiff
path: root/src/ai/api/ai_marine.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-03-21 21:43:23 +0000
committerfrosch <frosch@openttd.org>2009-03-21 21:43:23 +0000
commitd452a0a0ecaad276c893b62ab8f008a5af85ba82 (patch)
tree2816e5ec1ae12fd5f4cd0391c375c34b91225291 /src/ai/api/ai_marine.cpp
parentfd0f0bda721269e27950431db44886b309ef4596 (diff)
downloadopenttd-d452a0a0ecaad276c893b62ab8f008a5af85ba82.tar.xz
(svn r15789) -Codechange: Add DiagdirBetweenTiles() and use it.
Diffstat (limited to 'src/ai/api/ai_marine.cpp')
-rw-r--r--src/ai/api/ai_marine.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/ai/api/ai_marine.cpp b/src/ai/api/ai_marine.cpp
index fb9bba882..fffa1e3a3 100644
--- a/src/ai/api/ai_marine.cpp
+++ b/src/ai/api/ai_marine.cpp
@@ -50,9 +50,8 @@
/* Tiles not neighbouring */
if (::DistanceManhattan(t1, t2) != 1) return false;
- if (t1 > t2) Swap(t1, t2);
- DiagDirection to_other_tile = (TileX(t1) == TileX(t2)) ? DIAGDIR_SE : DIAGDIR_SW;
+ DiagDirection to_other_tile = ::DiagdirBetweenTiles(t1, t2);
/* Determine the reachable tracks from the shared edge */
TrackBits gtts2 = ::TrackStatusToTrackBits(::GetTileTrackStatus(t2, TRANSPORT_WATER, 0, to_other_tile)) & ::DiagdirReachesTracks(to_other_tile);