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

Function GetViewportY

src/viewport.cpp:1201–1205  ·  view source on GitHub ↗

* Returns the y coordinate in the viewport coordinate system where the given * tile is painted. * @param tile Any tile. * @return The viewport y coordinate where the tile is painted. */

Source from the content-addressed store, hash-verified

1199 * @return The viewport y coordinate where the tile is painted.
1200 */
1201static int GetViewportY(Point tile)
1202{
1203 /* Each increment in X or Y direction moves down by half a tile, i.e. TILE_PIXELS / 2. */
1204 return (tile.y * (int)(TILE_PIXELS / 2) + tile.x * (int)(TILE_PIXELS / 2) - TilePixelHeightOutsideMap(tile.x, tile.y)) << ZOOM_BASE_SHIFT;
1205}
1206
1207/**
1208 * Add the landscape to the viewport, i.e. all ground tiles and buildings.

Callers 1

ViewportAddLandscapeFunction · 0.85

Calls 1

Tested by

no test coverage detected