forked from mirror/OpenTTD
Fix: do not hide parameter by local variable with the same name
This commit is contained in:
@@ -467,19 +467,19 @@ CommandCost CmdBuildCanal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
}
|
||||
|
||||
for (; *iter != INVALID_TILE; ++(*iter)) {
|
||||
TileIndex tile = *iter;
|
||||
TileIndex current_tile = *iter;
|
||||
CommandCost ret;
|
||||
|
||||
Slope slope = GetTileSlope(tile);
|
||||
Slope slope = GetTileSlope(current_tile);
|
||||
if (slope != SLOPE_FLAT && (wc != WATER_CLASS_RIVER || !IsInclinedSlope(slope))) {
|
||||
return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED);
|
||||
}
|
||||
|
||||
/* can't make water of water! */
|
||||
if (IsTileType(tile, MP_WATER) && (!IsTileOwner(tile, OWNER_WATER) || wc == WATER_CLASS_SEA)) continue;
|
||||
if (IsTileType(current_tile, MP_WATER) && (!IsTileOwner(current_tile, OWNER_WATER) || wc == WATER_CLASS_SEA)) continue;
|
||||
|
||||
bool water = IsWaterTile(tile);
|
||||
ret = DoCommand(tile, 0, 0, flags | DC_FORCE_CLEAR_TILE, CMD_LANDSCAPE_CLEAR);
|
||||
bool water = IsWaterTile(current_tile);
|
||||
ret = DoCommand(current_tile, 0, 0, flags | DC_FORCE_CLEAR_TILE, CMD_LANDSCAPE_CLEAR);
|
||||
if (ret.Failed()) return ret;
|
||||
|
||||
if (!water) cost.AddCost(ret);
|
||||
@@ -487,31 +487,31 @@ CommandCost CmdBuildCanal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
if (flags & DC_EXEC) {
|
||||
switch (wc) {
|
||||
case WATER_CLASS_RIVER:
|
||||
MakeRiver(tile, Random());
|
||||
MakeRiver(current_tile, Random());
|
||||
if (_game_mode == GM_EDITOR) {
|
||||
TileIndex tile2 = tile;
|
||||
TileIndex tile2 = current_tile;
|
||||
CircularTileSearch(&tile2, RIVER_OFFSET_DESERT_DISTANCE, RiverModifyDesertZone, nullptr);
|
||||
}
|
||||
break;
|
||||
|
||||
case WATER_CLASS_SEA:
|
||||
if (TileHeight(tile) == 0) {
|
||||
MakeSea(tile);
|
||||
if (TileHeight(current_tile) == 0) {
|
||||
MakeSea(current_tile);
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
|
||||
default:
|
||||
MakeCanal(tile, _current_company, Random());
|
||||
MakeCanal(current_tile, _current_company, Random());
|
||||
if (Company::IsValidID(_current_company)) {
|
||||
Company::Get(_current_company)->infrastructure.water++;
|
||||
DirtyCompanyInfrastructureWindows(_current_company);
|
||||
}
|
||||
break;
|
||||
}
|
||||
MarkTileDirtyByTile(tile);
|
||||
MarkCanalsAndRiversAroundDirty(tile);
|
||||
CheckForDockingTile(tile);
|
||||
MarkTileDirtyByTile(current_tile);
|
||||
MarkCanalsAndRiversAroundDirty(current_tile);
|
||||
CheckForDockingTile(current_tile);
|
||||
}
|
||||
|
||||
cost.AddCost(_price[PR_BUILD_CANAL]);
|
||||
@@ -1044,8 +1044,8 @@ static void FloodVehicles(TileIndex tile)
|
||||
|
||||
if (IsAirportTile(tile)) {
|
||||
const Station *st = Station::GetByTile(tile);
|
||||
for (TileIndex tile : st->airport) {
|
||||
if (st->TileBelongsToAirport(tile)) FindVehicleOnPos(tile, &z, &FloodVehicleProc);
|
||||
for (TileIndex airport_tile : st->airport) {
|
||||
if (st->TileBelongsToAirport(airport_tile)) FindVehicleOnPos(airport_tile, &z, &FloodVehicleProc);
|
||||
}
|
||||
|
||||
/* No vehicle could be flooded on this airport anymore */
|
||||
|
Reference in New Issue
Block a user