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

Function AddChildSpriteToFoundation

src/viewport.cpp:532–541  ·  view source on GitHub ↗

* Adds a child sprite to the active foundation. * * The pixel offset of the sprite relative to the ParentSprite is the sum of the offset passed to OffsetGroundSprite() and extra_offs_?. * * @param image the image to draw. * @param pal the provided palette. * @param sub Only draw a part of the sprite. * @param foundation_part Foundation part. * @param extra_offs_x Pixel X offset for the spr

Source from the content-addressed store, hash-verified

530 * @param extra_offs_y Pixel Y offset for the sprite position.
531 */
532static void AddChildSpriteToFoundation(SpriteID image, PaletteID pal, const SubSprite *sub, FoundationPart foundation_part, int extra_offs_x, int extra_offs_y)
533{
534 assert(IsInsideMM(foundation_part, 0, FOUNDATION_PART_END));
535 assert(_vd.foundation[foundation_part] != -1);
536 Point offs = _vd.foundation_offset[foundation_part];
537
538 /* Change the active ChildSprite list to the one of the foundation */
539 AutoRestoreBackup backup(_vd.last_child, _vd.last_foundation_child[foundation_part]);
540 AddChildSpriteScreen(image, pal, offs.x + extra_offs_x, offs.y + extra_offs_y, false, sub, false, false);
541}
542
543/**
544 * Draws a ground sprite at a specific world-coordinate relative to the current tile.

Callers 2

DrawGroundSpriteAtFunction · 0.85
DrawSelectionSpriteFunction · 0.85

Calls 2

IsInsideMMFunction · 0.85
AddChildSpriteScreenFunction · 0.85

Tested by

no test coverage detected