summaryrefslogtreecommitdiff
path: root/src/tree_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tree_cmd.cpp')
-rw-r--r--src/tree_cmd.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index 9798c2bb5..baf149f5f 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -392,11 +392,11 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
int limit = (c == nullptr ? INT32_MAX : GB(c->tree_limit, 16, 16));
TileArea ta(tile, p2);
- for (TileIndex tile : ta) {
- switch (GetTileType(tile)) {
+ for (TileIndex current_tile : ta) {
+ switch (GetTileType(current_tile)) {
case MP_TREES:
/* no more space for trees? */
- if (GetTreeCount(tile) == 4) {
+ if (GetTreeCount(current_tile) == 4) {
msg = STR_ERROR_TREE_ALREADY_HERE;
continue;
}
@@ -408,8 +408,8 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
}
if (flags & DC_EXEC) {
- AddTreeCount(tile, 1);
- MarkTileDirtyByTile(tile);
+ AddTreeCount(current_tile, 1);
+ MarkTileDirtyByTile(current_tile);
if (c != nullptr) c->tree_limit -= 1 << 16;
}
/* 2x as expensive to add more trees to an existing tile */
@@ -417,14 +417,14 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
break;
case MP_WATER:
- if (!IsCoast(tile) || IsSlopeWithOneCornerRaised(GetTileSlope(tile))) {
+ if (!IsCoast(current_tile) || IsSlopeWithOneCornerRaised(GetTileSlope(current_tile))) {
msg = STR_ERROR_CAN_T_BUILD_ON_WATER;
continue;
}
FALLTHROUGH;
case MP_CLEAR: {
- if (IsBridgeAbove(tile)) {
+ if (IsBridgeAbove(current_tile)) {
msg = STR_ERROR_SITE_UNSUITABLE;
continue;
}
@@ -433,11 +433,11 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
/* Be a bit picky about which trees go where. */
if (_settings_game.game_creation.landscape == LT_TROPIC && treetype != TREE_INVALID && (
/* No cacti outside the desert */
- (treetype == TREE_CACTUS && GetTropicZone(tile) != TROPICZONE_DESERT) ||
+ (treetype == TREE_CACTUS && GetTropicZone(current_tile) != TROPICZONE_DESERT) ||
/* No rain forest trees outside the rain forest, except in the editor mode where it makes those tiles rain forest tile */
- (IsInsideMM(treetype, TREE_RAINFOREST, TREE_CACTUS) && GetTropicZone(tile) != TROPICZONE_RAINFOREST && _game_mode != GM_EDITOR) ||
+ (IsInsideMM(treetype, TREE_RAINFOREST, TREE_CACTUS) && GetTropicZone(current_tile) != TROPICZONE_RAINFOREST && _game_mode != GM_EDITOR) ||
/* And no subtropical trees in the desert/rain forest */
- (IsInsideMM(treetype, TREE_SUB_TROPICAL, TREE_TOYLAND) && GetTropicZone(tile) != TROPICZONE_NORMAL))) {
+ (IsInsideMM(treetype, TREE_SUB_TROPICAL, TREE_TOYLAND) && GetTropicZone(current_tile) != TROPICZONE_NORMAL))) {
msg = STR_ERROR_TREE_WRONG_TERRAIN_FOR_TREE_TYPE;
continue;
}
@@ -453,7 +453,7 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
switch (GetRawClearGround(tile)) {
case CLEAR_FIELDS:
case CLEAR_ROCKS: {
- 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;
cost.AddCost(ret);
break;
@@ -464,24 +464,24 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
}
if (_game_mode != GM_EDITOR && Company::IsValidID(_current_company)) {
- Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
+ Town *t = ClosestTownFromTile(current_tile, _settings_game.economy.dist_local_authority);
if (t != nullptr) ChangeTownRating(t, RATING_TREE_UP_STEP, RATING_TREE_MAXIMUM, flags);
}
if (flags & DC_EXEC) {
if (treetype == TREE_INVALID) {
- treetype = GetRandomTreeType(tile, GB(Random(), 24, 8));
+ treetype = GetRandomTreeType(current_tile, GB(Random(), 24, 8));
if (treetype == TREE_INVALID) treetype = TREE_CACTUS;
}
/* Plant full grown trees in scenario editor */
- PlantTreesOnTile(tile, treetype, 0, _game_mode == GM_EDITOR ? 3 : 0);
- MarkTileDirtyByTile(tile);
+ PlantTreesOnTile(current_tile, treetype, 0, _game_mode == GM_EDITOR ? 3 : 0);
+ MarkTileDirtyByTile(current_tile);
if (c != nullptr) c->tree_limit -= 1 << 16;
/* When planting rainforest-trees, set tropiczone to rainforest in editor. */
if (_game_mode == GM_EDITOR && IsInsideMM(treetype, TREE_RAINFOREST, TREE_CACTUS)) {
- SetTropicZone(tile, TROPICZONE_RAINFOREST);
+ SetTropicZone(current_tile, TROPICZONE_RAINFOREST);
}
}
cost.AddCost(_price[PR_BUILD_TREES]);