Changeset - r24491:cc4c5b4cc2fc
[Not reviewed]
master
0 3 0
Pavel Stupnikov - 4 years ago 2020-12-24 23:36:54
dp@dpointer.org
Feature: Add an option to disable tree growth completely (#8415)
3 files changed with 18 insertions and 13 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -1620,9 +1620,10 @@ STR_CONFIG_SETTING_TOWN_CARGOGENMODE_BIT
 

	
 
STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT                         :In game placement of trees: {STRING2}
 
STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_HELPTEXT                :Control random appearance of trees during the game. This might affect industries which rely on tree growth, for example lumber mills
 
STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_NONE                    :None {RED}(breaks lumber mill)
 
STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_RAINFOREST              :Only in rain forests
 
STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_ALL                     :Everywhere
 
STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_NO_SPREAD               :Grow but don't spread {RED}(breaks lumber mill)
 
STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_SPREAD_RAINFOREST       :Grow but only spread in rain forests
 
STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_SPREAD_ALL              :Grow and spread everywhere
 
STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_NO_GROWTH_NO_SPREAD     :Don't grow, don't spread {RED}(breaks lumber mill)
 

	
 
STR_CONFIG_SETTING_TOOLBAR_POS                                  :Position of main toolbar: {STRING2}
 
STR_CONFIG_SETTING_TOOLBAR_POS_HELPTEXT                         :Horizontal position of the main toolbar at the top of the screen
src/table/settings.ini
Show inline comments
 
@@ -2391,10 +2391,10 @@ from     = SLV_132
 
guiflags = SGF_MULTISTRING
 
def      = 2
 
min      = 0
 
max      = 2
 
max      = 3
 
str      = STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT
 
strhelp  = STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_HELPTEXT
 
strval   = STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_NONE
 
strval   = STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_NO_SPREAD
 
cat      = SC_BASIC
 

	
 
[SDT_VAR]
src/tree_cmd.cpp
Show inline comments
 
@@ -42,9 +42,10 @@ enum TreePlacer {
 

	
 
/** 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
 
	ETP_NO_SPREAD,           ///< Grow trees on tiles that have them but don't spread to new ones
 
	ETP_SPREAD_RAINFOREST,   ///< Grow trees on tiles that have them, only spread to new ones in rainforests
 
	ETP_SPREAD_ALL,          ///< Grow trees and spread them without restrictions
 
	ETP_NO_GROWTH_NO_SPREAD, ///< Don't grow trees and don't spread them at all
 
};
 

	
 
/** Determines when to consider building more trees. */
 
@@ -635,8 +636,8 @@ static void TileLoopTreesAlps(TileIndex 
 
static bool CanPlantExtraTrees(TileIndex tile)
 
{
 
	return ((_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);
 
		(_settings_game.construction.extra_tree_placement == ETP_SPREAD_ALL || _settings_game.construction.extra_tree_placement == ETP_SPREAD_RAINFOREST) :
 
		_settings_game.construction.extra_tree_placement == ETP_SPREAD_ALL);
 
}
 

	
 
static void TileLoop_Trees(TileIndex tile)
 
@@ -662,6 +663,9 @@ static void TileLoop_Trees(TileIndex til
 
			MarkTileDirtyByTile(tile);
 
		}
 
	}
 

	
 
	if (_settings_game.construction.extra_tree_placement == ETP_NO_GROWTH_NO_SPREAD) return;
 

	
 
	if (GetTreeCounter(tile) < 15) {
 
		AddTreeCounter(tile, 1);
 
		return;
 
@@ -755,8 +759,8 @@ static void TileLoop_Trees(TileIndex til
 

	
 
void OnTick_Trees()
 
{
 
	/* Don't place trees if that's not allowed */
 
	if (_settings_game.construction.extra_tree_placement == ETP_NONE) return;
 
	/* Don't spread trees if that's not allowed */
 
	if (_settings_game.construction.extra_tree_placement == ETP_NO_SPREAD || _settings_game.construction.extra_tree_placement == ETP_NO_GROWTH_NO_SPREAD) return;
 

	
 
	uint32 r;
 
	TileIndex tile;
 
@@ -771,7 +775,7 @@ void OnTick_Trees()
 
	}
 

	
 
	/* byte underflow */
 
	if (--_trees_tick_ctr != 0 || _settings_game.construction.extra_tree_placement != ETP_ALL) return;
 
	if (--_trees_tick_ctr != 0 || _settings_game.construction.extra_tree_placement == ETP_SPREAD_RAINFOREST) return;
 

	
 
	/* place a tree at a random spot */
 
	r = Random();
0 comments (0 inline, 0 general)