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.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index c98758062..bd112f31b 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -11,6 +11,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"
@@ -74,7 +75,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;
}
@@ -392,6 +394,10 @@ CommandCost CmdPlantTree(DoCommandFlag flags, TileIndex tile, TileIndex start_ti
CommandCost cost(EXPENSES_OTHER);
if (start_tile >= MapSize()) return CMD_ERROR;
+
+ /* tree only top layer */
+ if (IsUnderground(start_tile)) 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;