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

Function DrawTrackFence

src/rail_cmd.cpp:1938–1945  ·  view source on GitHub ↗

* Draw a track fence. * @param ti Tile drawing information. * @param base_image First fence sprite. * @param num_sprites Number of fence sprites. * @param rfo Fence to draw. */

Source from the content-addressed store, hash-verified

1936 * @param rfo Fence to draw.
1937 */
1938static void DrawTrackFence(const TileInfo *ti, const PalSpriteID &psid, uint num_sprites, RailFenceOffset rfo)
1939{
1940 int z = ti->z;
1941 if (_fence_offsets[rfo].height_ref != CORNER_INVALID) {
1942 z += GetSlopePixelZInCorner(RemoveHalftileSlope(ti->tileh), _fence_offsets[rfo].height_ref);
1943 }
1944 AddSortableSpriteToDraw(psid.sprite + (rfo % num_sprites), psid.pal, ti->x, ti->y, z, _fence_offsets[rfo]);
1945}
1946
1947/**
1948 * Draw fence at NW border matching the tile slope.

Callers 5

DrawTrackFence_NWFunction · 0.85
DrawTrackFence_SEFunction · 0.85
DrawTrackFence_NEFunction · 0.85
DrawTrackFence_SWFunction · 0.85
DrawTrackDetailsFunction · 0.85

Calls 3

GetSlopePixelZInCornerFunction · 0.85
RemoveHalftileSlopeFunction · 0.85
AddSortableSpriteToDrawFunction · 0.70

Tested by

no test coverage detected