* Get top height of the tile inside the map. * @param t Tile to compute height of * @return Maximum height of the tile */
| 134 | * @return Maximum height of the tile |
| 135 | */ |
| 136 | int GetTileMaxZ(TileIndex t) |
| 137 | { |
| 138 | uint x1 = TileX(t); |
| 139 | uint y1 = TileY(t); |
| 140 | uint x2 = std::min(x1 + 1, Map::MaxX()); |
| 141 | uint y2 = std::min(y1 + 1, Map::MaxY()); |
| 142 | |
| 143 | return std::max({ |
| 144 | TileHeight(t), // N corner |
| 145 | TileHeight(TileXY(x2, y1)), // W corner |
| 146 | TileHeight(TileXY(x1, y2)), // E corner |
| 147 | TileHeight(TileXY(x2, y2)), // S corner |
| 148 | }); |
| 149 | } |
no test coverage detected