Skip to content

Preserve citizen nationality when citizens are reassigned - #1140

Open
zack-the-coding-actuary wants to merge 1 commit into
C7-Game:Developmentfrom
zack-the-coding-actuary:preserve_nationalities
Open

zack-the-coding-actuary wants to merge 1 commit into
C7-Game:Developmentfrom
zack-the-coding-actuary:preserve_nationalities

Conversation

@zack-the-coding-actuary

Copy link
Copy Markdown
Contributor

Another minor change here. There were two places in the code where citizens get tiles reassigned by internal AI logic and all citizens' nationalities were disposed of, defaulting to the city owner's nationality. This fix just preserves nationalities across citizen reassignment shuffles and standardizes the reshuffle logic into one helper. Tests included!

  • Capture each resident's nationality before RemoveAllCitizens() and reapply it when the residents are rebuilt, so foreign citizens no longer become the owner's nationality
  • Add PlayerAI.ReassignCitizens(gameData, city) as the single remove-and-rebuild implementation, shared by the city screen's city-center click and the AI's FixRemainingUnhappyCities
  • Make FixRemainingUnhappyCities internal so tests can call it
  • Add PlayerAITest covering single-city reassignment and multi-city AI reassignment, both verified to fail when nationality is reset to the owner's civ

- Capture each resident's nationality before RemoveAllCitizens() and reapply it when the residents are rebuilt, so foreign citizens no longer become the owner's nationality
- Add PlayerAI.ReassignCitizens(gameData, city) as the single remove-and-rebuild implementation, shared by the city screen's city-center click and the AI's FixRemainingUnhappyCities
- Make FixRemainingUnhappyCities internal so tests can call it
- Add PlayerAITest covering single-city reassignment and multi-city AI reassignment, both verified to fail when nationality is reset to the owner's civ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant