feat: special negative-conditional cache for two properties that are very important for princess calculations #6463
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.
this property only caches
false
, any other value and it will have to recalculate itself every time until it turns to false. So, for the most part, it is going to be fast.Also, it looks like it has no side-effects on other places since other places rely on the unit during gameplay, or loading it directly from a file.
There is also a reset builtin the property to make sure it is renewed every turn, so if it does not have the property it will calculate it at least once.
It still needs some more information on the API of the methods to explain why and how, and better testing from my part, comparing with and without the variable enabled.