summaryrefslogtreecommitdiff
path: root/map.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-18 18:41:56 +0000
committertron <tron@openttd.org>2005-01-18 18:41:56 +0000
commit31d6f87d80bb42c1fbb8841071937e6d86fe9e86 (patch)
tree0e41a8961f8378269224ee774e2ebd64fcf9e349 /map.h
parent64b08311b9539e3a805365155c396cec854dd5f5 (diff)
downloadopenttd-31d6f87d80bb42c1fbb8841071937e6d86fe9e86.tar.xz
(svn r1560) Introduce SetTileType() and SetTileHeight()
Replace direct references to _map_type_and_height with these
Diffstat (limited to 'map.h')
-rw-r--r--map.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/map.h b/map.h
index 126bdd0b3..1ff6109e6 100644
--- a/map.h
+++ b/map.h
@@ -79,6 +79,14 @@ static inline uint TileHeight(TileIndex tile)
return _map_type_and_height[tile] & 0xf;
}
+static inline void SetTileHeight(TileIndex tile, uint height)
+{
+ assert(tile < MapSize());
+ assert(height < 16);
+ _map_type_and_height[tile] &= ~0x0F;
+ _map_type_and_height[tile] |= height;
+}
+
static inline uint TilePixelHeight(TileIndex tile)
{
return TileHeight(tile) * 8;
@@ -90,6 +98,13 @@ static inline int TileType(TileIndex tile)
return _map_type_and_height[tile] >> 4;
}
+static inline void SetTileType(TileIndex tile, uint type)
+{
+ assert(tile < MapSize());
+ _map_type_and_height[tile] &= ~0xF0;
+ _map_type_and_height[tile] |= type << 4;
+}
+
static inline bool IsTileType(TileIndex tile, int type)
{
return TileType(tile) == type;