Fix: do not hide parameter by local variable with the same name
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user