* Return the slope of a given tile inside the map. * @param tile Tile to compute slope of * @return Slope of the tile, except for the HALFTILE part, and the z height */
| 53 | * @return Slope of the tile, except for the HALFTILE part, and the z height |
| 54 | */ |
| 55 | std::tuple<Slope, int> GetTileSlopeZ(TileIndex tile) |
| 56 | { |
| 57 | uint x1 = TileX(tile); |
| 58 | uint y1 = TileY(tile); |
| 59 | uint x2 = std::min(x1 + 1, Map::MaxX()); |
| 60 | uint y2 = std::min(y1 + 1, Map::MaxY()); |
| 61 | |
| 62 | int hnorth = TileHeight(tile); // Height of the North corner. |
| 63 | int hwest = TileHeight(TileXY(x2, y1)); // Height of the West corner. |
| 64 | int heast = TileHeight(TileXY(x1, y2)); // Height of the East corner. |
| 65 | int hsouth = TileHeight(TileXY(x2, y2)); // Height of the South corner. |
| 66 | |
| 67 | return GetTileSlopeGivenHeight(hnorth, hwest, heast, hsouth); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Return the slope of a given tile, also for tiles outside the map (virtual "black" tiles). |
no test coverage detected