Skip to content

Keep restricted soldiers in military buildings#1930

Open
DevOpsOfChaos wants to merge 1 commit intoReturn-To-The-Roots:masterfrom
DevOpsOfChaos:sidequest/restricted-soldiers-stay-when-no-warehouse
Open

Keep restricted soldiers in military buildings#1930
DevOpsOfChaos wants to merge 1 commit intoReturn-To-The-Roots:masterfrom
DevOpsOfChaos:sidequest/restricted-soldiers-stay-when-no-warehouse

Conversation

@DevOpsOfChaos
Copy link
Copy Markdown

Summary

  • avoid sending soldiers home from military buildings when no connected warehouse accepts their rank
  • check return-home availability per soldier rank before removing surplus troops
  • add regression coverage for restricted generals staying in their military building

Root cause

When a military building had surplus troops due to military settings, RegulateTroops() only checked whether any warehouse was reachable. It did not check whether that warehouse accepted the rank of the soldier being sent home.

If that rank was restricted in all connected warehouses, the soldier could leave the building, fail to find a valid warehouse, start wandering, and eventually die.

Validation

  • Built Test_integration locally with Visual Studio 2022 / Debug
  • Ran Test_integration.exe --run_test=AttackSuite/RestrictedSoldiersStayWhenNoWarehouseAcceptsRank --report_level=short
  • Ran Test_integration.exe --run_test=AttackSuite --report_level=short

Fixes #1560

@Flamefire
Copy link
Copy Markdown
Member

Similar/extension to #1932
Will discuss there first

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.

Restricted soldiers leave barracks and become homeless

2 participants