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.
Similar issue to #5966.
This now provides a way to ask the option for its value instead of relying on a side effect assignment.
At the same time, this is now cached for set-once options, allowing for fast querying.
Furthermore, it gets rid of some really really ugly code throwing around raw pointers and kind of illegally managing memory in favor of shared_ptr's, as there's a good chance that that was part of why the compiler mis-identified the optimization in the first place.
Should fix #6344
This should probably be tested in release mode by someone with an MSVC compiler.
To be frank, this is a hotfix only.
A more permanent refactor of the ingame options will be needed for 25.0 to a) optimize lookup performance, while b) not relying on side-effect access to variables that the compiler can mess with. Options should store their state fully internally, not giving a user access to the data outside of the option object.