diff options
author | rubidium <rubidium@openttd.org> | 2009-12-17 16:59:33 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-12-17 16:59:33 +0000 |
commit | 5e2b7e023875bbf7aed8223bdf7657f579e5bb85 (patch) | |
tree | d1179d8ae0cdfebaf6e21db7e62b37df3f1db41c /src/tree_cmd.cpp | |
parent | b0f1fcbead4c3aa03ab8d0544039fc2de0bc4f5d (diff) | |
download | openttd-5e2b7e023875bbf7aed8223bdf7657f579e5bb85.tar.xz |
(svn r18522) -Feature: add the possibility to not make new tree tiles in-game
Diffstat (limited to 'src/tree_cmd.cpp')
-rw-r--r-- | src/tree_cmd.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index 8802acb46..2cd9c35dc 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -45,6 +45,14 @@ enum TreePlacer { TP_IMPROVED, ///< A 'improved' algorithm }; +/** Where to place trees while in-game? */ +enum ExtraTreePlacement { + ETP_NONE, ///< Place trees on no tiles + ETP_RAINFOREST, ///< Place trees only on rainforest tiles + ETP_ALL, ///< Place trees on all tiles +}; + + /** * Tests if a tile can be converted to MP_TREES * This is true for clear ground without farms or rocks. @@ -662,6 +670,13 @@ static void TileLoop_Trees(TileIndex tile) /* FALL THROUGH */ case 2: { // add a neighbouring tree + /* Don't plant extra trees if that's not allowed. */ + if ((_settings_game.game_creation.landscape == LT_TROPIC && GetTropicZone(tile) == TROPICZONE_RAINFOREST) ? + _settings_game.construction.extra_tree_placement == ETP_NONE : + _settings_game.construction.extra_tree_placement != ETP_ALL) { + break; + } + TreeType treetype = GetTreeType(tile); tile += TileOffsByDir((Direction)(Random() & 7)); @@ -711,6 +726,9 @@ static void TileLoop_Trees(TileIndex tile) void OnTick_Trees() { + /* Don't place trees if that's not allowed */ + if (_settings_game.construction.extra_tree_placement == ETP_NONE) return; + uint32 r; TileIndex tile; TreeType tree; @@ -724,7 +742,7 @@ void OnTick_Trees() } /* byte underflow */ - if (--_trees_tick_ctr != 0) return; + if (--_trees_tick_ctr != 0 || _settings_game.construction.extra_tree_placement != ETP_ALL) return; /* place a tree at a random spot */ r = Random(); |