Fix for temperature related: chargen crash (in labs) and ice lab food decay bug #24555
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Partial fix for #24547 (segfaults)
Resolves #24288 (proper fix - hopefully)
Resolves #24205
Hopefully I got this right this time.
Problems are related to temperature calculations that were using map variable, that did not exist on character generation. Luckily I found that
game
hasbool new_game
that can be used to determine if 'g->m' is valid and can be safely called for it's variables. So whilenew_game == true
temperature calculations can simply turn a blind eye to map temperatures overlay for a brief moment before the true play starts. This should simultaneously resolve problems with segfaults at chargen and safely introduce queries forg->m.temperature
to properly extract and use local temperature overlays like one used inice_lab
.I have compiled and tested this by trying different chargens and new games, and also tested if food decays properly on 1-st level of ice lab (in compare to outside surroundings) and everything if fine (have it mind that it only partially fixes #24547 ), but @ZhilkinSerg I have a humble request - please test this, because my previous attempts were not successful, and I want to be 200% sure this works. Thanks in advance.