diff options
author | Erich Eckner <git@eckner.net> | 2018-10-30 11:13:12 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2022-01-16 21:58:15 +0100 |
commit | 0c5ba5b7bf9a9dfa78c026f4da656940a460f47d (patch) | |
tree | d2a44494bbd70425b8f9e0e22b8c4e4dd8223001 /src/tree_cmd.cpp | |
parent | 523901887827768d6bff347ddb57787b295cc9e1 (diff) | |
download | openttd-0c5ba5b7bf9a9dfa78c026f4da656940a460f47d.tar.xz |
underground patch applied
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 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; |