diff options
author | rubidium <rubidium@openttd.org> | 2011-11-04 10:20:24 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2011-11-04 10:20:24 +0000 |
commit | a36551dbb4a6aa8a10e99df8331ac4ecb8586270 (patch) | |
tree | f63714ceff46343e77309a9084758de39ca52b9b /src/tile_map.h | |
parent | 7757a2ed406996be35c7179185f2e4e7cba37e12 (diff) | |
download | openttd-a36551dbb4a6aa8a10e99df8331ac4ecb8586270.tar.xz |
(svn r23092) -Codechange: create a non-pixel version of some of the Get*PixelZ functions, and let Get*PixelZ wrap around the new function (multiplying the Z by TILE_HEIGHT) just like TileHeight and TilePixelHeight
Diffstat (limited to 'src/tile_map.h')
-rw-r--r-- | src/tile_map.h | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/src/tile_map.h b/src/tile_map.h index fc7c01f84..76a3fd75c 100644 --- a/src/tile_map.h +++ b/src/tile_map.h @@ -226,9 +226,42 @@ static inline void SetAnimationFrame(TileIndex t, byte frame) _me[t].m7 = frame; } -Slope GetTilePixelSlope(TileIndex tile, uint *h); -uint GetTilePixelZ(TileIndex tile); -uint GetTileMaxPixelZ(TileIndex tile); +Slope GetTileSlope(TileIndex tile, uint *h = NULL); +uint GetTileZ(TileIndex tile); +uint GetTileMaxZ(TileIndex tile); + +/** + * Return the slope of a given tile + * @param tile Tile to compute slope of + * @param h If not \c NULL, pointer to storage of z height + * @return Slope of the tile, except for the HALFTILE part + */ +static inline Slope GetTilePixelSlope(TileIndex tile, uint *h) +{ + Slope s = GetTileSlope(tile, h); + if (h != NULL) *h *= TILE_HEIGHT; + return s; +} + +/** + * Get bottom height of the tile + * @param tile Tile to compute height of + * @return Minimum height of the tile + */ +static inline uint GetTilePixelZ(TileIndex tile) +{ + return GetTileZ(tile) * TILE_HEIGHT; +} + +/** + * Get top height of the tile + * @param t Tile to compute height of + * @return Maximum height of the tile + */ +static inline uint GetTileMaxPixelZ(TileIndex tile) +{ + return GetTileMaxZ(tile) * TILE_HEIGHT; +} /** |