diff options
author | tron <tron@openttd.org> | 2006-05-07 07:55:05 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-05-07 07:55:05 +0000 |
commit | ebcf2ee3b143286f184144da1970327c33fc3e1c (patch) | |
tree | f5113d4060c886372d1bca9edc9098d07a6dc3e0 /tile.c | |
parent | ec7e431cf6f0770c4fd47c795fad6b0e8f2c5a45 (diff) | |
download | openttd-ebcf2ee3b143286f184144da1970327c33fc3e1c.tar.xz |
(svn r4765) Add GetTileMaxZ(), which returns the height of the highest corner of a tile, and use it to simplify the code in a few places
Diffstat (limited to 'tile.c')
-rw-r--r-- | tile.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -56,3 +56,20 @@ uint GetTileZ(TileIndex tile) GetTileSlope(tile, &h); return h; } + + +uint GetTileMaxZ(TileIndex t) +{ + uint max; + uint h; + + h = TileHeight(t); + max = h; + h = TileHeight(t + TileDiffXY(1, 0)); + if (h > max) max = h; + h = TileHeight(t + TileDiffXY(0, 1)); + if (h > max) max = h; + h = TileHeight(t + TileDiffXY(1, 1)); + if (h > max) max = h; + return max * 8; +} |