Codechange: replace for loops with endof with range-based for loops

This commit is contained in:
Rubidium
2024-04-07 22:18:39 +02:00
committed by rubidium42
parent 095bdf32fe
commit 4e6d4fcf32
6 changed files with 26 additions and 29 deletions

View File

@@ -136,8 +136,6 @@ static std::tuple<CommandCost, TileIndex> TerraformTileHeight(TerraformerState *
/* Recurse to neighboured corners if height difference is larger than 1 */
{
const TileIndexDiffC *ttm;
TileIndex orig_tile = tile;
static const TileIndexDiffC _terraform_tilepos[] = {
{ 1, 0}, // move to tile in SE
@@ -146,8 +144,8 @@ static std::tuple<CommandCost, TileIndex> TerraformTileHeight(TerraformerState *
{ 0, -2} // undo last move, and move to tile in NE
};
for (ttm = _terraform_tilepos; ttm != endof(_terraform_tilepos); ttm++) {
tile += ToTileIndexDiff(*ttm);
for (const auto &ttm : _terraform_tilepos) {
tile += ToTileIndexDiff(ttm);
if (tile >= Map::Size()) continue;
/* Make sure we don't wrap around the map */