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

Function GetTileHeightBelowAircraft

src/aircraft_cmd.cpp:709–714  ·  view source on GitHub ↗

* Get the tile height below the aircraft. * This function is needed because aircraft can leave the mapborders. * * @param v The vehicle to get the height for. * @return The height in pixels from 'z_pos' 0. */

Source from the content-addressed store, hash-verified

707 * @return The height in pixels from 'z_pos' 0.
708 */
709int GetTileHeightBelowAircraft(const Vehicle *v)
710{
711 int safe_x = Clamp(v->x_pos, 0, Map::MaxX() * TILE_SIZE);
712 int safe_y = Clamp(v->y_pos, 0, Map::MaxY() * TILE_SIZE);
713 return TileHeight(TileVirtXY(safe_x, safe_y)) * TILE_HEIGHT;
714}
715
716/**
717 * Get the 'flight level' bounds, in pixels from 'z_pos' 0 for a particular

Callers 2

Calls 3

ClampFunction · 0.85
TileHeightFunction · 0.85
TileVirtXYFunction · 0.85

Tested by

no test coverage detected