summaryrefslogtreecommitdiff
path: root/src/town_cmd.cpp
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-05-26 20:51:17 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-05-27 18:30:56 +0200
commitb791ffc6de6dcc33739bb36bec4824dc44417961 (patch)
tree0f3c42eee61630369a59623b36e0920fcecb9235 /src/town_cmd.cpp
parenteaa3df1e8e3c9c6f6a22e95d0d4ed8ff251d4af9 (diff)
downloadopenttd-b791ffc6de6dcc33739bb36bec4824dc44417961.tar.xz
Fix: do not hide parameter by local variable with the same name
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r--src/town_cmd.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 033d04248..177b507e4 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -2988,27 +2988,27 @@ CommandCost CmdDeleteTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
* these do not directly have an owner so we need to check adjacent
* tiles. This won't work correctly in the same loop if the adjacent
* tile was already deleted earlier in the loop. */
- for (TileIndex tile = 0; tile < MapSize(); ++tile) {
- if (IsTileType(tile, MP_TUNNELBRIDGE) && TestTownOwnsBridge(tile, t)) {
- CommandCost ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
+ for (TileIndex current_tile = 0; current_tile < MapSize(); ++current_tile) {
+ if (IsTileType(current_tile, MP_TUNNELBRIDGE) && TestTownOwnsBridge(current_tile, t)) {
+ CommandCost ret = DoCommand(current_tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
if (ret.Failed()) return ret;
}
}
/* Check all remaining tiles for town ownership. */
- for (TileIndex tile = 0; tile < MapSize(); ++tile) {
+ for (TileIndex current_tile = 0; current_tile < MapSize(); ++current_tile) {
bool try_clear = false;
- switch (GetTileType(tile)) {
+ switch (GetTileType(current_tile)) {
case MP_ROAD:
- try_clear = HasTownOwnedRoad(tile) && GetTownIndex(tile) == t->index;
+ try_clear = HasTownOwnedRoad(current_tile) && GetTownIndex(current_tile) == t->index;
break;
case MP_HOUSE:
- try_clear = GetTownIndex(tile) == t->index;
+ try_clear = GetTownIndex(current_tile) == t->index;
break;
case MP_INDUSTRY:
- try_clear = Industry::GetByTile(tile)->town == t;
+ try_clear = Industry::GetByTile(current_tile)->town == t;
break;
case MP_OBJECT:
@@ -3016,7 +3016,7 @@ CommandCost CmdDeleteTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
/* No towns will be left, remove it! */
try_clear = true;
} else {
- Object *o = Object::GetByTile(tile);
+ Object *o = Object::GetByTile(current_tile);
if (o->town == t) {
if (o->type == OBJECT_STATUE) {
/* Statue... always remove. */
@@ -3033,7 +3033,7 @@ CommandCost CmdDeleteTown(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
break;
}
if (try_clear) {
- CommandCost ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
+ CommandCost ret = DoCommand(current_tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
if (ret.Failed()) return ret;
}
}