Fix double-counting of commerce in treasury flows (#864) - #995
Open
Billytifft wants to merge 1 commit into
Open
Billytifft wants to merge 1 commit into
Billytifft wants to merge 1 commit into
Conversation
Inflows() and Outflows() both counted corruption, science and entertainment income. These are allocations of a city's commerce, not treasury gold, so they appeared twice in the domestic advisor's income and expense totals. Netflows() was unaffected because the duplicate terms cancelled out. Make Inflows()/Outflows() gold-only, add CommerceTotal() for the full city commerce figure, and have the domestic advisor show taxes plus wealth production as income from cities while keeping the Civ3 line order for the expense breakdown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes the broken income/expense totals on the Domestic Advisor described in #864.
Problem
PlayerCommerceBreakdown.Inflows()andOutflows()both includedcorrupted,beakers, andhappiness. Those are allocations of a city's commerce, not treasury gold, so they appeared twice: once on the income side and once on the expense side of the advisor's totals.Netflows()happened to be numerically correct because the duplicates cancelled out, so gold-per-turn was never actually wrong.Fix
Inflows()is now gold income only:taxes + taxmenTaxes + fromOtherCivs + interest + wealthProductionOutflows()is now gold expenses only:toOtherCivs + maintenance + unitSupportCommerceTotal()for the full pre-split city commerce figuretaxes + wealthProduction(real gold from cities) instead of the old total-commerceCityInflows(), and the expense lines keep the exact line order Civ3 uses (Science, Entertainment, Corruption, Maintenance, Unit costs, To other civs)Tests
Added
PlayerCommerceBreakdownTestcovering the gold-only inflow/outflow math andCommerceTotal. Full suite passes locally (73 tests, Civ3 install enabled).No behavioral change to gold-per-turn; only the reported breakdown is corrected.