MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetTileSlopeZ

Function GetTileSlopeZ

src/tile_map.cpp:55–68  ·  view source on GitHub ↗

* 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 */

Source from the content-addressed store, hash-verified

53 * @return Slope of the tile, except for the HALFTILE part, and the z height
54 */
55std::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).

Callers 15

MakeWaterKeepingClassFunction · 0.85
GetFoundationSlopeFunction · 0.85
RiverFlowsDownFunction · 0.85
GetTileSlopeFunction · 0.85
GetTilePixelSlopeFunction · 0.85
TileLoop_TrackFunction · 0.85
TerraformTile_TrackFunction · 0.85
CmdBuildBridgeFunction · 0.85
CmdBuildTunnelFunction · 0.85
GetOtherAqueductEndFunction · 0.85

Calls 5

TileXFunction · 0.85
TileYFunction · 0.85
TileHeightFunction · 0.85
TileXYFunction · 0.85
GetTileSlopeGivenHeightFunction · 0.85

Tested by

no test coverage detected