You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: clear guild trade after losing a capital - #200
ProvinceManager skipped guilds without a capital before clearing their per-province trade and production, so a guild that lost its capital kept its old trade power and income in the saved economy.
Full, quiet (preview) and single-guild recalculation now reach the existing cleanup when capital = -1. Quiet recalculation keeps saved trade breakdowns; a saved recalculation clears them.
Tests
Three new regression tests in ProvinceManagerHubTransportTest failed on the old source and pass with this change.
ProvinceEconomyCoverageTest now checks the cleaned landless entries, recalculated prosperity and zero saved income.
mvn clean verify: 8,485 tests, no failures, errors or skips; coverage checks pass.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
📝 Summary
Summary by CodeRabbit
Bug Fixes
Guild trade data is now recalculated correctly even when a guild has no capital.
Losing a guild capital now clears outdated trade and production data.
Province recalculations now reset stale income information when a guild becomes landless.
Quiet recalculations preserve the existing income breakdown while removing invalid province data; full recalculations also clear related trade power and income values.
Province recalculation now processes guilds without capitals, allowing stale trade and production data to be cleared. Production recalculation remains capital-dependent. Tests cover single-guild, quiet, and full recalculation, plus disabled-income behaviour.
Changes: Province recalculation
Layer / File(s)
Summary
Recalculate guilds without capitals src/main/java/net/tfminecraft/simplefactions/managers/ProvinceManager.java, src/test/java/net/tfminecraft/simplefactions/managers/ProvinceEconomyCoverageTest.java, src/test/java/net/tfminecraft/simplefactions/managers/ProvinceManagerHubTransportTest.java
Full, quiet, and single-guild recalculation now process guilds without capitals. Tests verify changes to stored trade, production, province data, and income.
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
size:XS0-9 effective changed lines (tests excluded in mixed PRs).
1 participant
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
ProvinceManagerskipped guilds without a capital before clearing their per-province trade and production, so a guild that lost its capital kept its old trade power and income in the saved economy.Full, quiet (preview) and single-guild recalculation now reach the existing cleanup when
capital = -1. Quiet recalculation keeps saved trade breakdowns; a saved recalculation clears them.Tests
ProvinceManagerHubTransportTestfailed on the old source and pass with this change.ProvinceEconomyCoverageTestnow checks the cleaned landless entries, recalculated prosperity and zero saved income.mvn clean verify: 8,485 tests, no failures, errors or skips; coverage checks pass.🤖 Generated with Claude Code