Merge branch 'master' into jgrpp

# Conflicts:
#	src/fileio.cpp
#	src/group_gui.cpp
#	src/industry.h
#	src/lang/korean.txt
#	src/linkgraph/linkgraphjob.cpp
#	src/linkgraph/linkgraphjob.h
#	src/linkgraph/linkgraphschedule.cpp
#	src/linkgraph/linkgraphschedule.h
#	src/openttd.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/town_cmd.cpp
#	src/vehicle_gui.cpp
#	src/vehicle_gui_base.h
This commit is contained in:
Jonathan G Rennison
2021-01-30 18:27:25 +00:00
102 changed files with 1870 additions and 1765 deletions

View File

@@ -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. */
@@ -732,8 +733,8 @@ static void TileLoopTreesAlps(TileIndex tile)
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)
@@ -759,6 +760,9 @@ static void TileLoop_Trees(TileIndex tile)
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
}
}
if (_settings_game.construction.extra_tree_placement == ETP_NO_GROWTH_NO_SPREAD) return;
if (GetTreeCounter(tile) < 15) {
if (_settings_game.construction.tree_growth_rate > 0) {
/* slow, very slow, extremely slow */
@@ -787,7 +791,7 @@ static void TileLoop_Trees(TileIndex tile)
break;
case 1: // add a tree
if (GetTreeCount(tile) < 4) {
if (GetTreeCount(tile) < 4 && CanPlantExtraTrees(tile)) {
AddTreeCount(tile, 1);
SetTreeGrowth(tile, 0);
break;
@@ -819,13 +823,13 @@ static void TileLoop_Trees(TileIndex tile)
break;
case 6: // final stage of tree destruction
if (GetTreeCount(tile) > 1) {
if (!CanPlantExtraTrees(tile)) {
/* if trees can't spread just plant a new one to prevent deforestation */
SetTreeGrowth(tile, 0);
} else if (GetTreeCount(tile) > 1) {
/* more than one tree, delete it */
AddTreeCount(tile, -1);
SetTreeGrowth(tile, 3);
} else if (!CanPlantExtraTrees(tile)) {
/* if trees can't spread just plant a new one to prevent deforestation */
SetTreeGrowth(tile, 0);
} else {
/* just one tree, change type into MP_CLEAR */
switch (GetTreeGround(tile)) {
@@ -861,8 +865,8 @@ 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;
/* 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;
@@ -877,7 +881,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();