forked from mirror/OpenTTD
(svn r1560) Introduce SetTileType() and SetTileHeight()
Replace direct references to _map_type_and_height with these
This commit is contained in:
15
map.h
15
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;
|
||||
|
Reference in New Issue
Block a user