put the block stock where the blocks are

The global building block stock lived on Simulation while being factory data
through and through: placement spends it, deconstruction refunds it, and blocks
delivered to the HQ by belt add to it. Every system that credited it therefore
held a std::function back into Simulation to do so -- BuildingSystem and
DeconstructionSystem each carried one, and the arena and three test fixtures had
to pass a stub.

It moves into FactoryState, seeded by makeFactoryState from
world.starting_building_blocks, and both callbacks are gone: the HQ's belt intake
and the deconstruction refund now credit the state they are already holding.

BuildingSystem::deconstruct stops returning a refund for its caller to remember
to credit. It had grown asymmetric -- the queued path credits itself through
DeconstructionSystem while the instant path handed a number back -- so it now
credits the site's full cost directly and returns void.

Checksum order is untouched: Simulation still folds the stock at exactly the
point it always did, reading it from the state. The arena no longer discards
refunds into a no-op sink; nothing there reads the stock either way.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ne3mejABZoLWKLh8fgpM3x
This commit is contained in:
2026-08-19 17:23:46 +02:00
parent a783e57731
commit 780d5e5052
11 changed files with 114 additions and 119 deletions

View File

@@ -52,7 +52,6 @@ ArenaSimulation::ArenaSimulation(const GameConfig& gameConfig,
m_gameConfig,
m_beltSystem,
[this]() { return allocateBuildingId(); },
[](int) {},
[](const std::string&, QVector2D, const std::optional<ShipLayoutConfig>&) {},
[](const std::string&) -> bool { return true; },
m_rng);