(svn r1713) Split off several functions which query/set information about a single tile from map.h and put them into a seperate file tile.h

This commit is contained in:
tron
2005-01-29 12:19:05 +00:00
parent 3b6901f7fd
commit 5885b31bb4
32 changed files with 73 additions and 38 deletions

43
tile.h Normal file
View File

@@ -0,0 +1,43 @@
#ifndef TILE_H
#define TILE_H
#include "map.h"
static inline uint TileHeight(TileIndex tile)
{
assert(tile < MapSize());
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;
}
static inline int TileType(TileIndex tile)
{
assert(tile < MapSize());
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;
}
#endif