Fix selected item name not being visible in some menus #78398
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
Bugfixes "Fix currently selected item not being visible in some menus"
Purpose of change
Fix this:
Fixes #77368
Fixes #77503
Describe the solution
Cache entries' context less agressively - only when it is first read (i.e. when the menu is being rendered), and not immedaitely on construction (when it is still being prepared).
See
Cataclysm-DDA/src/item_action.cpp
Lines 354 to 355 in cfe9f6c
Describe alternatives you've considered
Use getter/setter for setting
.txt
/.ctxt
which would invalidate the cache at even more appropriate times. But that would mean working with getters/setters...Testing
Additional context
Originally broken by #76346 . Current PR does not reintroduce the problems #76346 was solving.
Astyle adds an extra indentation level to the whole of
struct uilist_entry {
now that I've marked the cached fields as private. I don't know if I should let them be public (to negate the diff) or if the indent is fine. Lemme know if i should change this.