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

Function DrawSelectionSprite

src/viewport.cpp:897–906  ·  view source on GitHub ↗

* Draws sprites between ground sprite and everything above. * * The sprite is either drawn as TileSprite or as ChildSprite of the active foundation. * * @param image the image to draw. * @param pal the provided palette. * @param ti TileInfo Tile that is being drawn * @param z_offset Z offset relative to the groundsprite. Only used for the sprite position, not for sprite sorting. * @param f

Source from the content-addressed store, hash-verified

895 * @param extra_offs_y Pixel Y offset for the sprite position.
896 */
897static void DrawSelectionSprite(SpriteID image, PaletteID pal, const TileInfo *ti, int z_offset, FoundationPart foundation_part, int extra_offs_x = 0, int extra_offs_y = 0)
898{
899 if (_vd.foundation[foundation_part] == -1) {
900 /* draw on real ground */
901 AddTileSpriteToDraw(image, pal, ti->x, ti->y, ti->z + z_offset, nullptr, extra_offs_x, extra_offs_y);
902 } else {
903 /* draw on top of foundation */
904 AddChildSpriteToFoundation(image, pal, nullptr, foundation_part, extra_offs_x, extra_offs_y - z_offset * ZOOM_BASE);
905 }
906}
907
908/**
909 * Draws a selection rectangle on a tile.

Callers 3

DrawTileSelectionRectFunction · 0.85
DrawAutorailSelectionFunction · 0.85
DrawTileSelectionFunction · 0.85

Calls 2

AddTileSpriteToDrawFunction · 0.85

Tested by

no test coverage detected