Overhaul map memory cache for tiles. #36392
Merged
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: None
Purpose of change
Fixes #36367
The cache in front of map memory never worked correctly, but due to another error that was fixed in #36338 this error was hidden. Essentially tiles, unlike curses, draws one map element at a time, and the cache for map memory was therefore being invoked multiple times. As a result of the cache being fixed, the first map element drawn would "win" instead of the final rendered tile being stored.
Describe the solution
Refrain from toggling the cache in the individual draw methods and instead only toggle it once all of the draw methods have been invoked.
Describe alternatives you've considered
In #36381 the whole map memory system is being overhauled, but I don't want to do something so invasive before 0.E.
Testing
Wander around and observe that furniture, vehicle parts and traps are drawn in map memory in addition to terrain.