(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

This commit is contained in:
tron
2006-05-07 07:55:05 +00:00
parent ec7e431cf6
commit ebcf2ee3b1
6 changed files with 26 additions and 20 deletions

17
tile.c
View File

@@ -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;
}