diff --git a/tile.c b/tile.c index f18932c3f3..5d5056a95d 100644 --- a/tile.c +++ b/tile.c @@ -68,3 +68,19 @@ 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; +} diff --git a/tile.h b/tile.h index 90a2941063..65d2c31f2d 100644 --- a/tile.h +++ b/tile.h @@ -50,6 +50,7 @@ uint GetMapExtraBits(TileIndex tile); uint GetTileh(uint n, uint w, uint e, uint s, uint *h); uint GetTileSlope(TileIndex tile, uint *h); uint GetTileZ(TileIndex tile); +uint GetTileMaxZ(TileIndex tile); static inline bool CorrectZ(uint tileh) { diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c index aba652c0c7..d8ee7d9277 100644 --- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -1208,23 +1208,6 @@ static inline DiagDirection GetBridgeRampDirection(TileIndex t) {return (DiagDir static inline bool IsTransportUnderBridge(TileIndex t) {return HASBIT(_m[t].m5, 5);} static inline uint GetBridgeAxis(TileIndex t) {return GB(_m[t].m5, 0, 1);} -static 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; -} - - static uint GetSlopeZ_TunnelBridge(const TileInfo* ti) { TileIndex tile = ti->tile;