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

Function DrawTile_Clear

src/clear_cmd.cpp:116–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116static void DrawTile_Clear(TileInfo *ti)
117{
118 ClearGround real_ground = GetClearGround(ti->tile);
119 ClearGround ground = IsSnowTile(ti->tile) ? CLEAR_SNOW : real_ground;
120
121 switch (ground) {
122 case CLEAR_GRASS:
123 DrawClearLandTile(ti, GetClearDensity(ti->tile));
124 break;
125
126 case CLEAR_ROUGH:
127 DrawHillyLandTile(ti);
128 break;
129
130 case CLEAR_ROCKS:
131 DrawGroundSprite((HasGrfMiscBit(GrfMiscBit::SecondRockyTileSet) && (TileHash(ti->x, ti->y) & 1) ? SPR_FLAT_ROCKY_LAND_2 : SPR_FLAT_ROCKY_LAND_1) + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
132 break;
133
134 case CLEAR_FIELDS:
135 DrawGroundSprite(_clear_land_sprites_farmland[GetFieldType(ti->tile)] + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
136 DrawClearLandFence(ti);
137 break;
138
139 case CLEAR_SNOW: {
140 uint8_t density = GetClearDensity(ti->tile);
141 DrawGroundSprite(_clear_land_sprites_snow_desert[density] + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
142 if (real_ground == CLEAR_ROCKS) {
143 /* There 4 levels of snowy overlay rocks, each with 19 sprites. */
144 ++density;
145 DrawGroundSprite(SPR_OVERLAY_ROCKS_BASE + (density * 19) + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
146 }
147 break;
148 }
149
150 case CLEAR_DESERT:
151 DrawGroundSprite(_clear_land_sprites_snow_desert[GetClearDensity(ti->tile)] + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
152 break;
153 }
154
155 DrawBridgeMiddle(ti, {});
156}
157
158static int GetSlopePixelZ_Clear(TileIndex tile, uint x, uint y, bool)
159{

Callers

nothing calls this directly

Calls 12

GetClearGroundFunction · 0.85
IsSnowTileFunction · 0.85
DrawClearLandTileFunction · 0.85
GetClearDensityFunction · 0.85
DrawHillyLandTileFunction · 0.85
DrawGroundSpriteFunction · 0.85
HasGrfMiscBitFunction · 0.85
TileHashFunction · 0.85
SlopeToSpriteOffsetFunction · 0.85
GetFieldTypeFunction · 0.85
DrawClearLandFenceFunction · 0.85
DrawBridgeMiddleFunction · 0.85

Tested by

no test coverage detected