From ebcf2ee3b143286f184144da1970327c33fc3e1c Mon Sep 17 00:00:00 2001 From: tron Date: Sun, 7 May 2006 07:55:05 +0000 Subject: (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 --- tile.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tile.c') diff --git a/tile.c b/tile.c index 36df4c542..98fb5f0bd 100644 --- a/tile.c +++ b/tile.c @@ -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; +} -- cgit v1.2.3-54-g00ecf