diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index c28fbf6f9c..8b41065d0a 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -91,6 +91,10 @@ static bool IsNearbyForest(TileIndex tile) { uint planted_tile_count = 0; + // An already planted tilte can always be planted again + if (IsTileType(tile, MP_TREES)) return true; + + // Count the trees arround the clear tile to determine if it's near a forest for (int x = -2; x <= 2; x++) { for (int y = -2; y <= 2; y++) { TileIndex vincity = TileAddWrap(tile, x, y); @@ -281,9 +285,7 @@ void PlaceTreesRandomly() if (CanPlantTreesOnTile(tile, true)) { PlaceTree(tile, r); - if (_settings_game.game_creation.tree_placer != TP_IMPROVED) { - continue; - } + if (_settings_game.game_creation.tree_placer != TP_IMPROVED) continue; /* Place a number of trees based on the tile height. * This gives a cool effect of multiple trees close together. @@ -807,6 +809,12 @@ static void TileLoop_Trees(TileIndex tile) AddTreeCount(tile, -1); SetTreeGrowth(tile, 3); } else { + // Backups the type of tree if using improved trees + TreeType treetype; + if (_settings_game.game_creation.tree_placer == TP_IMPROVED && IsTileType(tile, MP_TREES)) { + treetype = GetTreeType(tile); + } + /* just one tree, change type into MP_CLEAR */ switch (GetTreeGround(tile)) { case TREE_GROUND_SHORE: MakeShore(tile); break; @@ -828,6 +836,11 @@ static void TileLoop_Trees(TileIndex tile) } break; } + + // When using improved trees, when a "alone" tree is dead, a new one is planted immediately + if (_settings_game.game_creation.tree_placer == TP_IMPROVED && !IsNearbyForest(tile)) { + PlantTreesOnTile(tile, treetype, 0, 0); + } } break;