Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Don't lower tree density if spreading is not enabled #8413

merged 1 commit into from Dec 24, 2020


Copy link

@ldpl ldpl commented Dec 22, 2020

I started this in #8160 but apparently, it wasn't good enough as even though it prevented forests from disappearing completely they still thin out after a while which is undesirable, especially in realistic scenarios with custom tree density.

It may not be the best example (aka worst case) but still enough to illustrate the issue:
After map generation:
Screenshot from 2020-12-22 16-46-34
Current behaviour:
Screenshot from 2020-12-22 15-58-28
With this PR:
Screenshot from 2020-12-22 16-38-51

Savegame used for testing:

@ldpl ldpl marked this pull request as draft Dec 22, 2020
Copy link

@LordAro LordAro commented Dec 22, 2020

LGTM, though there are spacing issues that need fixing ;)

@ldpl ldpl force-pushed the lush-forests branch from 9215690 to 2ddb067 Dec 22, 2020
@ldpl ldpl marked this pull request as ready for review Dec 22, 2020
Copy link
Contributor Author

@ldpl ldpl commented Dec 22, 2020

I'm not quite used to such a fast reaction to PR's yet :p
But should be fine now, I fixed the issue with sparse forests.

@ldpl ldpl force-pushed the lush-forests branch from 2ddb067 to e1620c3 Dec 22, 2020
Copy link

@TrueBrain TrueBrain commented Dec 22, 2020

Can you explain how your fix fixes the problem? Especially the moving of the if block, to me it reads as if that would make no different? Doesn't have to be lengthy, but if you can avoid me becoming a tree-expert, that would be appreciated :)

Copy link
Contributor Author

@ldpl ldpl commented Dec 22, 2020

@TrueBrain in previous order first block deletes old tree if there are > 1 on tile, second replants dead tree. So it deleted them until only 1 was left. Now replanting goes first so if spreading not allowed amount of trees on the tile (aka tree density) doesn't go lower.
It also adds a check before adding a new tree so it doesn't go higher either.

@michicc michicc merged commit 04e5729 into OpenTTD:master Dec 24, 2020
11 checks passed
@ldpl ldpl deleted the lush-forests branch Sep 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants