CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.67k stars 4.18k forks source link

Fix `bio_blindfold` not working correctly after a save & load cycle #78035

Closed osuphobia closed 1 day ago

osuphobia commented 2 days ago

Summary

Bugfixes "Fix bio_blindfold not working correctly after a save & load cycle"

Purpose of change

Fix #77522

Describe the solution

https://github.com/CleverRaven/Cataclysm-DDA/blob/3a0d074afb601a3d261a4823bf3611d2c5bd584c/src/character.cpp#L627-L633 Add trait_flag_cache.clear() and bio_flag_cache.clear() here.

Describe alternatives you've considered

Save trait_flag_cache and bio_flag_cache in savedata?

Testing

Compiled and tested locally.

Additional context

I'm not confident with this patch, sight calculation is really a mess.

Night-Pryanik commented 2 days ago

Could you please also check if it fixes #77971 and/or #74994?

osuphobia commented 1 day ago

Could you please also check if it fixes #77971 and/or #74994?

I do not have a proper environment to test it right now, but this patch itself is not likely to solve the issues above. While it's easy to add trait_flag_cache.clear() somewhere to refresh the trait_flag_cache when needed, for the enchantments I have not dug enough to see what to change.

osuphobia commented 16 hours ago

While it works for bio_blindfold, Debug Clairvoyance Super is still not loaded correctly after a save & load cycle. Maybe I should refresh the caches in Character::load? But there are too many redundants in mutation & bionic calculations, it needs to be done in a thorough audit.