mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-19 04:29:09 +00:00
Codefix: early continue, avoid sideeffects
Co-authored-by: Peter Nelson <peter@fuzzle.org>
This commit is contained in:
@@ -98,12 +98,9 @@ static bool IsNearbyForest(TileIndex tile)
|
||||
|
||||
/* Count the trees around the clear tile to determine if it's near a forest */
|
||||
for (TileIndex t : TileArea(tile).Expand(FOREST_SEARCH_RADIUS)) {
|
||||
if (IsTileType(t, MP_TREES)) {
|
||||
if (++planted_tile_count >= FOREST_THRESHOLD)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!IsTileType(t, MP_TREES)) continue;
|
||||
++planted_tile_count;
|
||||
if (planted_tile_count >= FOREST_THRESHOLD) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user