Fix manual tree planting in artic climate in perfect tree placement mode
This commit is contained in:
@@ -564,24 +564,11 @@ CommandCost CmdPlantTree(TileIndex end_tile, DoCommandFlag flags, uint32 p1, uin
|
|||||||
TileIndex tile = *iter;
|
TileIndex tile = *iter;
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_TREES: {
|
case MP_TREES: {
|
||||||
bool grow_existing_tree_instead = false;
|
|
||||||
|
|
||||||
/* no more space for trees? */
|
/* no more space for trees? */
|
||||||
if (_settings_game.game_creation.tree_placer == TP_PERFECT) {
|
|
||||||
if (GetTreeCount(tile) >= 4 || ((GetTreeType(tile) != TREE_CACTUS) && ((int)GetTreeCount(tile) >= MaxTreeCount(tile)))) {
|
|
||||||
if (GetTreeGrowth(tile) < 3) {
|
|
||||||
grow_existing_tree_instead = true;
|
|
||||||
} else {
|
|
||||||
msg = STR_ERROR_TREE_ALREADY_HERE;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (GetTreeCount(tile) == 4) {
|
if (GetTreeCount(tile) == 4) {
|
||||||
msg = STR_ERROR_TREE_ALREADY_HERE;
|
msg = STR_ERROR_TREE_ALREADY_HERE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Test tree limit. */
|
/* Test tree limit. */
|
||||||
if (--limit < 1) {
|
if (--limit < 1) {
|
||||||
@@ -590,11 +577,7 @@ CommandCost CmdPlantTree(TileIndex end_tile, DoCommandFlag flags, uint32 p1, uin
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
if (grow_existing_tree_instead) {
|
|
||||||
SetTreeGrowth(tile, 3);
|
|
||||||
} else {
|
|
||||||
AddTreeCount(tile, 1);
|
AddTreeCount(tile, 1);
|
||||||
}
|
|
||||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE_NON_VEG);
|
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE_NON_VEG);
|
||||||
if (c != nullptr) c->tree_limit -= 1 << 16;
|
if (c != nullptr) c->tree_limit -= 1 << 16;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user