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

Function DrawTileLayout

src/newgrf_object.cpp:447–465  ·  view source on GitHub ↗

* Draw an group of sprites on the map. * @param ti Information about the tile to draw on. * @param dts The sprite layout to draw. * @param spec Object spec to draw. */

Source from the content-addressed store, hash-verified

445 * @param spec Object spec to draw.
446 */
447static void DrawTileLayout(const TileInfo *ti, const DrawTileSpriteSpan &dts, const ObjectSpec *spec)
448{
449 PaletteID palette = (spec->flags.Test(ObjectFlag::Uses2CC) ? SPR_2CCMAP_BASE : PALETTE_RECOLOUR_START) + Object::GetByTile(ti->tile)->colour;
450
451 SpriteID image = dts.ground.sprite;
452 PaletteID pal = dts.ground.pal;
453
454 if (GB(image, 0, SPRITE_WIDTH) != 0) {
455 /* If the ground sprite is the default flat water sprite, draw also canal/river borders
456 * Do not do this if the tile's WaterClass is 'land'. */
457 if ((image == SPR_FLAT_WATER_TILE || spec->flags.Test(ObjectFlag::DrawWater)) && IsTileOnWater(ti->tile)) {
458 DrawWaterClassGround(ti);
459 } else {
460 DrawGroundSprite(image, GroundSpritePaletteTransform(image, pal, palette));
461 }
462 }
463
464 DrawNewGRFTileSeq(ti, &dts, TO_STRUCTURES, 0, palette);
465}
466
467/**
468 * Draw an object on the map.

Callers 1

DrawNewObjectTileFunction · 0.70

Calls 7

GBFunction · 0.85
IsTileOnWaterFunction · 0.85
DrawWaterClassGroundFunction · 0.85
DrawGroundSpriteFunction · 0.85
DrawNewGRFTileSeqFunction · 0.85
TestMethod · 0.80

Tested by

no test coverage detected