summaryrefslogtreecommitdiff
path: root/map.c
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2005-09-09 23:14:38 +0000
committermatthijs <matthijs@openttd.org>2005-09-09 23:14:38 +0000
commitcd54bf48d1b78ad51a5bf91d96e41d6b8cd8513b (patch)
tree2f3cffa2f8a0c0f0c06f6a3666f430e20d0c6957 /map.c
parenta744b15907b55c56569f9028ada63d5b04ef6229 (diff)
downloadopenttd-cd54bf48d1b78ad51a5bf91d96e41d6b8cd8513b.tar.xz
(svn r2929) * Move DistanceTrack from map.c to npf.c and rename to NPFDistanceTrack.
* Make NPFDistanceTrack return the distance multiplied by NPF_TILE_LENGTH to prevent rounding This should make ship and train pathfinding more accurate and faster. * Update IsEndOfLine to prevent trains from trying to go off a slope onto a tunnel entrance.
Diffstat (limited to 'map.c')
-rw-r--r--map.c15
1 files changed, 0 insertions, 15 deletions
diff --git a/map.c b/map.c
index 166119772..5d7ff2b80 100644
--- a/map.c
+++ b/map.c
@@ -155,21 +155,6 @@ uint DistanceMaxPlusManhattan(TileIndex t0, TileIndex t1)
return dx > dy ? 2 * dx + dy : 2 * dy + dx;
}
-uint DistanceTrack(TileIndex t0, TileIndex t1)
-{
- const uint dx = abs(TileX(t0) - TileX(t1));
- const uint dy = abs(TileY(t0) - TileY(t1));
-
- const uint straightTracks = 2 * min(dx, dy); /* The number of straight (not full length) tracks */
- /* OPTIMISATION:
- * Original: diagTracks = max(dx, dy) - min(dx,dy);
- * Proof:
- * (dx-dy) - straightTracks == (min + max) - straightTracks = min + // max - 2 * min = max - min */
- const uint diagTracks = dx + dy - straightTracks; /* The number of diagonal (full tile length) tracks. */
-
- return diagTracks + straightTracks * STRAIGHT_TRACK_LENGTH;
-}
-
uint DistanceFromEdge(TileIndex tile)
{
const uint xl = TileX(tile);