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

Function GetTileMaxZ

src/tile_map.cpp:136–149  ·  view source on GitHub ↗

* Get top height of the tile inside the map. * @param t Tile to compute height of * @return Maximum height of the tile */

Source from the content-addressed store, hash-verified

134 * @return Maximum height of the tile
135 */
136int 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}

Callers 15

TerraformTile_IndustryFunction · 0.85
DoBuildLockFunction · 0.85
FloodVehicleProcFunction · 0.85
CheckBuildAbove_WaterFunction · 0.85
ShipTestUpDownOnLockFunction · 0.85
FindSpringFunction · 0.85
RiverMakeWiderFunction · 0.85
GetTileMaxPixelZFunction · 0.85
CmdBuildBridgeFunction · 0.85
DoClearBridgeFunction · 0.85
TileLoop_TunnelBridgeFunction · 0.85

Calls 4

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

Tested by

no test coverage detected