From 1796957258dc74ee6ebb4e274ff3a54633a3b290 Mon Sep 17 00:00:00 2001 From: patch-import Date: Mon, 21 Sep 2015 19:02:27 +0100 Subject: [PATCH] Everest patch: Fix plant random trees planting cacti above the snowline. Fix from HackaLittleBit http://www.tt-forums.net/viewtopic.php?p=1156793#p1156793 --- src/tree_cmd.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index d73db5b2ca..07153b62ef 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -489,7 +489,17 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 if (flags & DC_EXEC) { if (treetype == TREE_INVALID) { treetype = GetRandomTreeType(tile, GB(Random(), 24, 8)); - if (treetype == TREE_INVALID) treetype = TREE_CACTUS; + if (treetype == TREE_INVALID) { + if (_settings_game.construction.trees_around_snow_line_enabled && _settings_game.game_creation.landscape == LT_ARCTIC) { + if (GetTileZ(tile) <= (int)_settings_game.game_creation.snow_line_height) { + treetype = (TreeType)(GB(Random(), 24, 8) * TREE_COUNT_TEMPERATE / 256 + TREE_TEMPERATE); + } else { + treetype = (TreeType)(GB(Random(), 24, 8) * TREE_COUNT_SUB_ARCTIC / 256 + TREE_SUB_ARCTIC); + } + } else { + treetype = TREE_CACTUS; + } + } } /* Plant full grown trees in scenario editor */