summaryrefslogtreecommitdiff
path: root/map.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-31 07:23:15 +0000
committertron <tron@openttd.org>2005-01-31 07:23:15 +0000
commit7bbcf5875c2fc6a8fa80e417d65e1094947d78b8 (patch)
treec97da17a330889a788b8654dddbc7507d01b3b38 /map.h
parente1c19367f0cebbe90596319e9f82d959fa54621c (diff)
downloadopenttd-7bbcf5875c2fc6a8fa80e417d65e1094947d78b8.tar.xz
(svn r1749) Move the functions which calculate distances to map.[ch] and give the more meaningful names
Diffstat (limited to 'map.h')
-rw-r--r--map.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/map.h b/map.h
index d5628fe45..605b89495 100644
--- a/map.h
+++ b/map.h
@@ -72,6 +72,14 @@ static inline TileIndexDiff ToTileIndexDiff(TileIndexDiffC tidc)
#define TILE_ADDXY(tile, x, y) TILE_ADD(tile, TILE_XY(x, y))
+// Functions to calculate distances
+uint DistanceManhattan(TileIndex, TileIndex); // also known as L1-Norm
+uint DistanceSquare(TileIndex, TileIndex); // euclidian- or L2-Norm squared
+uint DistanceMax(TileIndex, TileIndex); // also known as L-Infinity-Norm
+uint DistanceMaxPlusManhattan(TileIndex, TileIndex); // Max + Manhattan
+uint DistanceFromEdge(TileIndex); // shortest distance from any edge of the map
+
+
static inline TileIndexDiff TileOffsByDir(uint dir)
{
extern const TileIndexDiffC _tileoffs_by_dir[4];