-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CvTraitInfo: tag CityExtraYields is not used correctly #459
Comments
This was definitely working correctly in previous releases and I think it still is in "Large Rivers". My current suspicion: But again: |
I got it. CvPlayer::updateCityExtraYield needs to be called to update the cache. However CvPlayer::processTrait calls CvPlayer::updateYield without using CvPlayer::updateCityExtraYield, hence it doesn't update the cache. The calls looks like an awful waste of CPU cycles. For each yield, which changes, all traits are looped and all plots are recalculated for for each yield. Same is true for extraYieldThreshold. Also if either one of them changes anything, for good measure all plots recalculate all yields once done. Looks like this is vanilla code. I'm going to fix this, but it will be a quick fix, which ignores performance. It's not like it will be worse than the current performance anyway. |
Ok just checked. I was wrong: By the way: Summary: |
…rrectly Vanilla bug. The issue was CvPlayer::processTrait did not update the cache in CvPlayer. Instead it updated the cache in CvPlot, which relies on the CvPlayer cache being set.
I confirm as well. Working nicely. 👍 |
CvTraitInfo's tag CityExtraYields lacks a proper implementation. It seems the bonus is never added, or rather maybe it is, but then the cache isn't updated... not sure. Either way getting a trait through an FF (discovered with Ivan Aleksandrovich Kuskov) doesn't work as expected.
I propose scrapping the implementation and redo it with strict typing in CivEffects. This way anything providing CivEffects can get it.
Perhaps it would be best to introduce some sort of "city promotion". This will create cleaner and reusable code (less risk of bugs) and quite possibly allow more aggressive caching in CvCity, making the game faster. It could also be used for more detailed GUI regarding how colonies are affected.
The text was updated successfully, but these errors were encountered: