tile.h
changeset 3636 a36cc46e754d
parent 3379 50b253bb9819
child 3773 0019b5f70ea9
equal deleted inserted replaced
3635:26da0c860a64 3636:a36cc46e754d
     3 #ifndef TILE_H
     3 #ifndef TILE_H
     4 #define TILE_H
     4 #define TILE_H
     5 
     5 
     6 #include "macros.h"
     6 #include "macros.h"
     7 #include "map.h"
     7 #include "map.h"
       
     8 #include "slope.h"
     8 
     9 
     9 typedef enum TileTypes {
    10 typedef enum TileTypes {
    10 	MP_CLEAR,
    11 	MP_CLEAR,
    11 	MP_RAILWAY,
    12 	MP_RAILWAY,
    12 	MP_STREET,
    13 	MP_STREET,
    24 	TROPICZONE_INVALID = 0,
    25 	TROPICZONE_INVALID = 0,
    25 	TROPICZONE_DESERT = 1,
    26 	TROPICZONE_DESERT = 1,
    26 	TROPICZONE_RAINFOREST = 2,
    27 	TROPICZONE_RAINFOREST = 2,
    27 } TropicZone;
    28 } TropicZone;
    28 
    29 
    29 uint GetTileh(uint n, uint w, uint e, uint s, uint *h);
    30 Slope GetTileh(uint n, uint w, uint e, uint s, uint *h);
    30 uint GetTileSlope(TileIndex tile, uint *h);
    31 Slope GetTileSlope(TileIndex tile, uint *h);
    31 uint GetTileZ(TileIndex tile);
    32 uint GetTileZ(TileIndex tile);
    32 
    33 
    33 static inline bool CorrectZ(uint tileh)
    34 static inline bool CorrectZ(Slope tileh)
    34 {
    35 {
    35 	/* tile height must be corrected if the north corner is not raised, but
    36 	/* tile height must be corrected if the north corner is not raised, but
    36 	 * any other corner is. These are the cases 1 till 7 */
    37 	 * any other corner is. These are the cases 1 till 7 */
    37 	return IS_INT_INSIDE(tileh, 1, 8);
    38 	return IS_INT_INSIDE(tileh, 1, 8);
    38 }
    39 }
    39 
    40 
    40 static inline uint TileHeight(TileIndex tile)
    41 static inline uint TileHeight(TileIndex tile)
    41 {
    42 {
    42 	assert(tile < MapSize());
    43 	assert(tile < MapSize());
    43 	return GB(_m[tile].type_height, 0, 4);
    44 	return GB(_m[tile].type_height, 0, 4);
    44 }
       
    45 
       
    46 static inline bool IsSteepTileh(uint tileh)
       
    47 {
       
    48 	return (tileh & 0x10);
       
    49 }
    45 }
    50 
    46 
    51 static inline void SetTileHeight(TileIndex tile, uint height)
    47 static inline void SetTileHeight(TileIndex tile, uint height)
    52 {
    48 {
    53 	assert(tile < MapSize());
    49 	assert(tile < MapSize());