diff options
Diffstat (limited to 'src/tree_cmd.cpp')
-rw-r--r-- | src/tree_cmd.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index c30609e78..e3b036e66 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -13,6 +13,7 @@ #include "clear_map.h" #include "landscape.h" #include "tree_map.h" +#include "layer_func.h" #include "viewport_func.h" #include "command_func.h" #include "town.h" @@ -70,7 +71,8 @@ static bool CanPlantTreesOnTile(TileIndex tile, bool allow_desert) case MP_CLEAR: return !IsBridgeAbove(tile) && !IsClearGround(tile, CLEAR_FIELDS) && GetRawClearGround(tile) != CLEAR_ROCKS && - (allow_desert || !IsClearGround(tile, CLEAR_DESERT)); + (allow_desert || !IsClearGround(tile, CLEAR_DESERT)) + && !IsUnderground(tile); default: return false; } @@ -337,6 +339,10 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 const byte tree_to_plant = GB(p1, 0, 8); // We cannot use Extract as min and max are climate specific. if (p2 >= MapSize()) return CMD_ERROR; + + /* tree only top layer */ + if (IsUnderground(p2)) return CMD_ERROR; + /* Check the tree type within the current climate */ if (tree_to_plant != TREE_INVALID && !IsInsideBS(tree_to_plant, _tree_base_by_landscape[_settings_game.game_creation.landscape], _tree_count_by_landscape[_settings_game.game_creation.landscape])) return CMD_ERROR; |