1
0
Fork 0

Codechange: Early-continue instead of nested ifs.

pull/13515/head
Peter Nelson 2025-02-15 11:32:49 +00:00
parent e74b4aa521
commit abcbabe8c4
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
1 changed files with 5 additions and 5 deletions

View File

@ -306,11 +306,11 @@ static void PlaceTreeGroups(uint num_groups)
int y = GB(r, 8, 5) - GROVE_RADIUS;
TileIndex cur_tile = TileAddWrap(center_tile, x, y);
if (cur_tile != INVALID_TILE && CanPlantTreesOnTile(cur_tile, true)) {
if(IsPointInStarShapedPolygon(x, y, grove)) {
PlaceTree(cur_tile, r);
}
}
if (cur_tile == INVALID_TILE) continue;
if (!CanPlantTreesOnTile(cur_tile, true)) continue;
if (!IsPointInStarShapedPolygon(x, y, grove)) continue;
PlaceTree(cur_tile, r);
}
} while (--num_groups);