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

Function GetTilePixelSlopeOutsideMap

src/tile_map.cpp:78–87  ·  view source on GitHub ↗

* Return the slope of a given tile, also for tiles outside the map (virtual "black" tiles). * * @param x X coordinate of the tile to compute slope of, may be outside the map. * @param y Y coordinate of the tile to compute slope of, may be outside the map. * @param h If not \c nullptr, pointer to storage of z height. * @return Slope of the tile, except for the HALFTILE part, and the z height o

Source from the content-addressed store, hash-verified

76 * @return Slope of the tile, except for the HALFTILE part, and the z height of the tile.
77 */
78std::tuple<Slope, int> GetTilePixelSlopeOutsideMap(int x, int y)
79{
80 int hnorth = TileHeightOutsideMap(x, y); // N corner.
81 int hwest = TileHeightOutsideMap(x + 1, y); // W corner.
82 int heast = TileHeightOutsideMap(x, y + 1); // E corner.
83 int hsouth = TileHeightOutsideMap(x + 1, y + 1); // S corner.
84
85 auto [slope, h] = GetTileSlopeGivenHeight(hnorth, hwest, heast, hsouth);
86 return {slope, h * TILE_HEIGHT};
87}
88
89/**
90 * Check if a given tile is flat

Callers 3

IsMapSurroundedByWaterFunction · 0.85
GetSlopePixelZ_VoidFunction · 0.85
ViewportAddLandscapeFunction · 0.85

Calls 2

TileHeightOutsideMapFunction · 0.85
GetTileSlopeGivenHeightFunction · 0.85

Tested by

no test coverage detected