Skip to content

fix(coop): allow personnel hire when SHARED base stores full - #119

Merged
NonPolynomialTim merged 1 commit into
mainfrom
fix/shared-recruit-stores-full
Aug 1, 2026
Merged

fix(coop): allow personnel hire when SHARED base stores full#119
NonPolynomialTim merged 1 commit into
mainfrom
fix/shared-recruit-stores-full

Conversation

@NonPolynomialTim

Copy link
Copy Markdown
Collaborator

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::buyValidate ran base->storesOverfull(storeAdd) unconditionally. Personnel rows (soldier/scientist/engineer) add to quartersAdd, never to storeAdd, so a personnel-only hire has storeAdd == 0. storesOverfull(0.0) returns true whenever the base is already at/over store capacity → the host rejected the hire with STR_NOT_ENOUGH_STORE_SPACE even 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:

if (storeAdd > 0.0 && base->storesOverfull(storeAdd))
    { failReason = "STR_NOT_ENOUGH_STORE_SPACE"; return false; }

Item purchases unchanged (vanilla already caps item buys by store space in the UI, unconditionally). Deliberately did not gate on Options::storageLimitsEnforced (default false) — that would disable item-overfill rejection by default.

Tests

  • New red→green repro 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 three STR_NOT_ENOUGH_STORE_SPACE), passes after.
  • Added read-only usedStores/availableStores to the base_report harness 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

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
NonPolynomialTim enabled auto-merge (squash) August 1, 2026 13:52
@NonPolynomialTim
NonPolynomialTim merged commit 885b06e into main Aug 1, 2026
11 checks passed
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