Fix an active item cache bug that occurred upon map shift #36026
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.
Summary
SUMMARY: Bugfixes "Fix an active item cache bug that occurred upon map shift"
Purpose of change
The cache of submaps with active items was being cleared too liberally in
map::shift
. Two "edges" were always being cleared (e.g. both north and east edges), even if the shift was occurring only in one direction (e.g. south, but not west or east). This means that sometimes, loaded submaps on the edge of the reality bubble with active items were being dropped from the cache, making the game "forget" about their items.Partially fixes #32936
Partially fixes #33187
There are/were other things causing the same bug, but this was certainly a major contributing factor.
Describe the solution
Simply check that we are shifting away from an edge before dropping that edge's submaps from the cache.
Describe alternatives you've considered
Testing
@kevingranade confirmed that he had a reproduction case that this change successfully fixed.
Additional context
I fixed a blocker, wooo!
Actually this was mostly kevin's and ralree's work, I just swooped in at the last minute and stole all the credit 😁