-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Don't crash when forest mapgen requests groundcover from a biome with no groundcover #72918
Don't crash when forest mapgen requests groundcover from a biome with no groundcover #72918
Conversation
So to test the crash, what I did is I moved |
2616d77
to
a5f321c
Compare
a5f321c
to
843d076
Compare
It probably expects the first one in the list to be the oter the others are mimicking somewhere along the line, I didn't really think twice when alphabetising them. |
I got a theory: Cataclysm-DDA/src/regional_settings.cpp Lines 175 to 177 in a1e69f1
|
squint I'll change this to a debugmsg then which explains what needs to happen in the json, and fix the json for innawood. |
The other option is changing it so the forest biome regional setting loading code always prefers to inherit from the forest biome of the name of the region, if its available and in the terrains list (which seems to be always?), otherwise to use the first biome. |
From what I can see, the loading code is kinda sketchy because it treats regional settings and overlays the same. But overlays can skip all the required checks, because they expect a regional setting to already exists to inherit all the required data from. Except they don't in cases like this. So it should be forbidden to just create a new forest_biome object when loading an overlay. |
oic, because |
I had a look yesterday but couldn't determine what the best way to actually make it work sensibly is, sorry for radio silence tho I were having an off day |
843d076
to
9069c27
Compare
9069c27
to
02ac488
Compare
Summary
None
Purpose of change
Fixes #72877, #72872. #72812 exposed that some forest mapgen code assumes adjacent biomes have groundcover. This is not true.
Describe the solution
Patch the code to fallback to regional groundcover like the other fallback cases use, in case the chosen adjacent biome in the feathering algorithm does not have groundcover of its own.
Also, noticed the adjacent biomes array wasn't being fully populated, with the last entry being skipped due to an off by one error in the initialization loop. Fix that too.
Describe alternatives you've considered
Testing
Use one of the repro saves from the issue, it doesn't crash anymore when mapgenning an innawoods cave tile.
Additional context