summaryrefslogtreecommitdiff
path: root/map.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-16 11:24:58 +0000
committertron <tron@openttd.org>2005-01-16 11:24:58 +0000
commitae796740aab0ee480759d2015014b29e2a7aedb4 (patch)
treebc9e7bccf2119556badf2efe43aca901dfc0a76e /map.h
parentd2643dc483abbd086441b126912f466127253b06 (diff)
downloadopenttd-ae796740aab0ee480759d2015014b29e2a7aedb4.tar.xz
(svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
Diffstat (limited to 'map.h')
-rw-r--r--map.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/map.h b/map.h
index 489cb025c..bed014bfa 100644
--- a/map.h
+++ b/map.h
@@ -72,4 +72,22 @@ static inline TileIndexDiff TileOffsByDir(uint dir)
return ToTileIndexDiff(_tileoffs_by_dir[dir]);
}
+
+static inline uint TileHeight(TileIndex tile)
+{
+ assert(tile < MapSize());
+ return (_map_type_and_height[tile] & 0xf) * 8;
+}
+
+static inline int TileType(TileIndex tile)
+{
+ assert(tile < MapSize());
+ return _map_type_and_height[tile] >> 4;
+}
+
+static inline bool IsTileType(TileIndex tile, int type)
+{
+ return TileType(tile) == type;
+}
+
#endif