summaryrefslogtreecommitdiff
path: root/src/map_func.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-01-04 18:30:10 +0000
committerrubidium <rubidium@openttd.org>2010-01-04 18:30:10 +0000
commit3e131e2fece740591d9187e19789a34b36c763fa (patch)
treeeff6d495176fe6d806e6990f5faa5c7ecb5a05e1 /src/map_func.h
parent87466a4ed091035b758ef981e6600e2b03cbfe30 (diff)
downloadopenttd-3e131e2fece740591d9187e19789a34b36c763fa.tar.xz
(svn r18718) -Codechange: make a wrapper macro for looping TileAreas
Diffstat (limited to 'src/map_func.h')
-rw-r--r--src/map_func.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/map_func.h b/src/map_func.h
index 806220ccc..5acabc11d 100644
--- a/src/map_func.h
+++ b/src/map_func.h
@@ -348,6 +348,16 @@ uint DistanceFromEdge(TileIndex); ///< shortest distance from any edge of the ma
for (uint cur_w = (w); cur_w > 0; --cur_w, var++)
/**
+ * A loop which iterates over the tiles of a TileArea
+ *
+ * This macro starts 2 nested loops which iterates over a square of tiles.
+ *
+ * @param var The name of the variable which contains the current tile
+ * @param ta The tile area to search over
+ */
+#define TILE_AREA_LOOP(var, ta) TILE_LOOP(var, ta.w, ta.h, ta.tile)
+
+/**
* Convert a DiagDirection to a TileIndexDiff
*
* @param dir The DiagDirection