tron@1209: #ifndef TILE_H tron@1209: #define TILE_H tron@926: tron@1209: #include "map.h" tron@1035: tron@1214: typedef enum TileType { tron@1214: MP_CLEAR, tron@1214: MP_RAILWAY, tron@1214: MP_STREET, tron@1214: MP_HOUSE, tron@1214: MP_TREES, tron@1214: MP_STATION, tron@1214: MP_WATER, tron@1214: MP_VOID, // invisible tiles at the SW and SE border tron@1214: MP_INDUSTRY, tron@1214: MP_TUNNELBRIDGE, tron@1214: MP_UNMOVABLE tron@1214: } TileType; tron@1214: tron@1211: void SetMapExtraBits(TileIndex tile, byte flags); tron@1211: uint GetMapExtraBits(TileIndex tile); tron@1211: tron@1044: static inline uint TileHeight(TileIndex tile) tron@1044: { tron@1044: assert(tile < MapSize()); tron@1044: return _map_type_and_height[tile] & 0xf; tron@1044: } tron@1044: tron@1059: static inline void SetTileHeight(TileIndex tile, uint height) tron@1059: { tron@1059: assert(tile < MapSize()); tron@1059: assert(height < 16); tron@1059: _map_type_and_height[tile] &= ~0x0F; tron@1059: _map_type_and_height[tile] |= height; tron@1059: } tron@1059: tron@1041: static inline uint TilePixelHeight(TileIndex tile) tron@1035: { tron@1044: return TileHeight(tile) * 8; tron@1035: } tron@1035: tron@1214: static inline TileType GetTileType(TileIndex tile) tron@1035: { tron@1035: assert(tile < MapSize()); tron@1035: return _map_type_and_height[tile] >> 4; tron@1035: } tron@1035: tron@1214: static inline void SetTileType(TileIndex tile, TileType type) tron@1059: { tron@1059: assert(tile < MapSize()); tron@1059: _map_type_and_height[tile] &= ~0xF0; tron@1059: _map_type_and_height[tile] |= type << 4; tron@1059: } tron@1059: tron@1214: static inline bool IsTileType(TileIndex tile, TileType type) tron@1035: { tron@1214: return GetTileType(tile) == type; tron@1035: } tron@1035: tron@679: #endif