summaryrefslogtreecommitdiff
path: root/src/map.h
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-05-04 16:27:13 +0000
committerbelugas <belugas@openttd.org>2007-05-04 16:27:13 +0000
commitaff49954bf116162d440c48e29bf35fb116d1dd6 (patch)
treeaa52d3726c6fd14c5ac298000d0dbbfb570fcc93 /src/map.h
parent449e76c05ad6c8502105fe80fd2390cc6944750c (diff)
downloadopenttd-aff49954bf116162d440c48e29bf35fb116d1dd6.tar.xz
(svn r9779) -Feature: Add the possiblity to choose different road patterns for towns to use.
Possible patterns are : No Road (not available in scenario editor) Original (for the nostalgics) Better Roads (same as original, but based on distance of 2 tiles instead of one) 2x2 grids 3x3 grids Patch by skiddl13
Diffstat (limited to 'src/map.h')
-rw-r--r--src/map.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/map.h b/src/map.h
index 5b11e2627..b97eca52a 100644
--- a/src/map.h
+++ b/src/map.h
@@ -209,6 +209,23 @@ static inline TileIndex AddTileIndexDiffCWrap(TileIndex tile, TileIndexDiffC dif
return TileXY(x, y);
}
+/**
+ * Returns the diff between two tiles
+ *
+ * @param tile_a from tile
+ * @param tile_b to tile
+ * @return the difference between tila_a and tile_b
+ */
+static inline TileIndexDiffC TileIndexToTileIndexDiffC(TileIndex tile_a, TileIndex tile_b)
+{
+ TileIndexDiffC difference;
+
+ difference.x = TileX(tile_a) - TileX(tile_b);
+ difference.y = TileY(tile_a) - TileY(tile_b);
+
+ return difference;
+}
+
/* Functions to calculate distances */
uint DistanceManhattan(TileIndex, TileIndex); ///< also known as L1-Norm. Is the shortest distance one could go over diagonal tracks (or roads)
uint DistanceSquare(TileIndex, TileIndex); ///< euclidian- or L2-Norm squared