fix(coop): allow personnel hire when SHARED base stores full - #119
Merged
Conversation
SharedEcon::buyValidate rejected any purchase whenever the target base's general stores were at/over capacity, because it ran base->storesOverfull(storeAdd) unconditionally. For a personnel-only hire (soldier/scientist/engineer) storeAdd is 0 -- those rows add to quartersAdd, never to storeAdd -- so storesOverfull(0.0) returned true purely because existing stores were full, blocking the hire with STR_NOT_ENOUGH_STORE_SPACE even when living quarters were free. SHARED-only; the interactive gate (PurchaseState::increaseByValue) and the non-shared OK path already gate personnel by quarters alone. Fix: only run the store check when the order actually adds store volume (storeAdd > 0.0). Item purchases are unchanged (vanilla already caps them by store space in the UI unconditionally); a zero-store hire is no longer gated. Adds a red->green repro (tools/coop_test/test_shared_recruit_stores_full.py) that fills a shared base's stores past capacity with free quarters and hires one of each personnel type, and read-only usedStores/availableStores fields on the base_report harness command for the test's preconditions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
NonPolynomialTim
enabled auto-merge (squash)
August 1, 2026 13:52
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.
Problem
Reported: "if general stores are full you cannot recruit scientists/soldiers/engineers, even if there is space in the living quarters."
SHARED-coop only.
SharedEcon::buyValidateranbase->storesOverfull(storeAdd)unconditionally. Personnel rows (soldier/scientist/engineer) add toquartersAdd, never tostoreAdd, so a personnel-only hire hasstoreAdd == 0.storesOverfull(0.0)returns true whenever the base is already at/over store capacity → the host rejected the hire withSTR_NOT_ENOUGH_STORE_SPACEeven with free living quarters.Not vanilla / not SEPARATE: the interactive gate (
PurchaseState::increaseByValue) and the non-shared OK path already gate personnel by quarters alone. Only the host-side SHARED validator was wrong.Fix
src/CoopMod/SharedEcon.cpp— run the store check only when the order adds store volume:Item purchases unchanged (vanilla already caps item buys by store space in the UI, unconditionally). Deliberately did not gate on
Options::storageLimitsEnforced(defaultfalse) — that would disable item-overfill rejection by default.Tests
tools/coop_test/test_shared_recruit_stores_full.py: fills a shared base's stores past capacity with free quarters, hires one soldier + scientist + engineer, asserts all accepted. Fails before the fix (all threeSTR_NOT_ENOUGH_STORE_SPACE), passes after.usedStores/availableStoresto thebase_reportharness command for the repro's preconditions.Verified locally, all green:
test_shared_recruit_stores_full,test_shared_purchase,test_shared_commerce(world-equality + client zero-disk hold).🤖 Generated with Claude Code