|
|
|
@ -174,9 +174,6 @@ static void PlaceTree(TileIndex tile, uint32 r)
|
|
|
|
|
if (ground != TREE_GROUND_SNOW_DESERT && ground != TREE_GROUND_ROUGH_SNOW && ground != TREE_GROUND_SHORE) {
|
|
|
|
|
SetTreeGroundDensity(tile, (TreeGround)GB(r, 28, 1), 3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set the counter to a random start value */
|
|
|
|
|
SetTreeCounter(tile, (TreeGround)GB(r, 24, 4));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -710,10 +707,14 @@ static void TileLoop_Trees(TileIndex tile)
|
|
|
|
|
|
|
|
|
|
AmbientSoundEffect(tile);
|
|
|
|
|
|
|
|
|
|
uint treeCounter = GetTreeCounter(tile);
|
|
|
|
|
/* _tick_counter is incremented by 256 between each call, so ignore lower 8 bits.
|
|
|
|
|
* Also, we use a simple hash to spread the updates evenly over the map.
|
|
|
|
|
* 11 and 9 are just some co-prime numbers for better spread.
|
|
|
|
|
*/
|
|
|
|
|
uint32 cycle = 11 * TileX(tile) + 9 * TileY(tile) + (_tick_counter >> 8);
|
|
|
|
|
|
|
|
|
|
/* Handle growth of grass (under trees/on MP_TREES tiles) at every 8th processings, like it's done for grass on MP_CLEAR tiles. */
|
|
|
|
|
if ((treeCounter & 7) == 7 && GetTreeGround(tile) == TREE_GROUND_GRASS) {
|
|
|
|
|
if ((cycle & 7) == 7 && GetTreeGround(tile) == TREE_GROUND_GRASS) {
|
|
|
|
|
uint density = GetTreeDensity(tile);
|
|
|
|
|
if (density < 3) {
|
|
|
|
|
SetTreeGroundDensity(tile, TREE_GROUND_GRASS, density + 1);
|
|
|
|
@ -723,11 +724,7 @@ static void TileLoop_Trees(TileIndex tile)
|
|
|
|
|
|
|
|
|
|
if (_settings_game.construction.extra_tree_placement == ETP_NO_GROWTH_NO_SPREAD) return;
|
|
|
|
|
|
|
|
|
|
if (GetTreeCounter(tile) < 15) {
|
|
|
|
|
AddTreeCounter(tile, 1);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
SetTreeCounter(tile, 0);
|
|
|
|
|
if ((cycle & 15) != 15) return;
|
|
|
|
|
|
|
|
|
|
switch (GetTreeGrowth(tile)) {
|
|
|
|
|
case 3: // regular sized tree
|
|
|
|
|