| 256 | } |
| 257 | |
| 258 | static void TileLoop_Clear(TileIndex tile) |
| 259 | { |
| 260 | AmbientSoundEffect(tile); |
| 261 | |
| 262 | switch (_settings_game.game_creation.landscape) { |
| 263 | case LandscapeType::Tropic: TileLoopClearDesert(tile); break; |
| 264 | case LandscapeType::Arctic: TileLoopClearAlps(tile); break; |
| 265 | default: break; |
| 266 | } |
| 267 | |
| 268 | if (IsSnowTile(tile)) return; |
| 269 | |
| 270 | switch (GetClearGround(tile)) { |
| 271 | case CLEAR_GRASS: |
| 272 | if (GetClearDensity(tile) == 3) return; |
| 273 | |
| 274 | if (_game_mode != GM_EDITOR) { |
| 275 | if (GetClearCounter(tile) < 7) { |
| 276 | AddClearCounter(tile, 1); |
| 277 | return; |
| 278 | } else { |
| 279 | SetClearCounter(tile, 0); |
| 280 | AddClearDensity(tile, 1); |
| 281 | } |
| 282 | } else { |
| 283 | SetClearGroundDensity(tile, GB(Random(), 0, 8) > 21 ? CLEAR_GRASS : CLEAR_ROUGH, 3); |
| 284 | } |
| 285 | break; |
| 286 | |
| 287 | case CLEAR_FIELDS: |
| 288 | UpdateFences(tile); |
| 289 | |
| 290 | if (_game_mode == GM_EDITOR) return; |
| 291 | |
| 292 | if (GetClearCounter(tile) < 7) { |
| 293 | AddClearCounter(tile, 1); |
| 294 | return; |
| 295 | } else { |
| 296 | SetClearCounter(tile, 0); |
| 297 | } |
| 298 | |
| 299 | if (GetIndustryIndexOfField(tile) == IndustryID::Invalid() && GetFieldType(tile) >= 7) { |
| 300 | /* This farmfield is no longer farmfield, so make it grass again */ |
| 301 | MakeClear(tile, CLEAR_GRASS, 2); |
| 302 | } else { |
| 303 | uint field_type = GetFieldType(tile); |
| 304 | field_type = (field_type < 8) ? field_type + 1 : 0; |
| 305 | SetFieldType(tile, field_type); |
| 306 | } |
| 307 | break; |
| 308 | |
| 309 | default: |
| 310 | return; |
| 311 | } |
| 312 | |
| 313 | MarkTileDirtyByTile(tile); |
| 314 | } |
| 315 |
nothing calls this directly
no test coverage detected