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

Function TileLoopClearDesert

src/clear_cmd.cpp:234–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232}
233
234static void TileLoopClearDesert(TileIndex tile)
235{
236 /* Current desert level - 0 if it is not desert */
237 uint current = 0;
238 if (IsClearGround(tile, CLEAR_DESERT)) current = GetClearDensity(tile);
239
240 /* Expected desert level - 0 if it shouldn't be desert */
241 uint expected = 0;
242 if (GetTropicZone(tile) == TROPICZONE_DESERT) {
243 expected = NeighbourIsNormal(tile) ? 1 : 3;
244 }
245
246 if (current == expected) return;
247
248 if (expected == 0) {
249 SetClearGroundDensity(tile, CLEAR_GRASS, 3);
250 } else {
251 /* Transition from clear to desert is not smooth (after clearing desert tile) */
252 SetClearGroundDensity(tile, CLEAR_DESERT, expected);
253 }
254
255 MarkTileDirtyByTile(tile);
256}
257
258static void TileLoop_Clear(TileIndex tile)
259{

Callers 1

TileLoop_ClearFunction · 0.85

Calls 6

IsClearGroundFunction · 0.85
GetClearDensityFunction · 0.85
GetTropicZoneFunction · 0.85
NeighbourIsNormalFunction · 0.85
SetClearGroundDensityFunction · 0.85
MarkTileDirtyByTileFunction · 0.70

Tested by

no test coverage detected