move FactoryState ownership out of BuildingSystem to Simulation

This commit is contained in:
2026-08-05 06:43:52 +02:00
parent 0edea5d961
commit 46932e4abf
10 changed files with 97 additions and 43 deletions

View File

@@ -47,6 +47,7 @@ class BuildingSystem
{
public:
BuildingSystem(const GameConfig& config,
FactoryState& state,
BeltSystem& belts,
std::function<BuildingId()> allocateBuildingId,
std::function<void(int)> addBuildingBlocks,
@@ -285,6 +286,11 @@ private:
QPoint anchor) const;
const GameConfig& m_config;
// The factory's world data — buildings, queued work, tile ownership. Owned by
// Simulation, not by this system (see FactoryState.h).
FactoryState& m_state;
BeltSystem& m_belts;
std::function<BuildingId()> m_allocateBuildingId;
std::function<void(int)> m_addBuildingBlocks;
@@ -293,9 +299,4 @@ private:
std::function<bool(const std::string&)> m_isItemUnlocked;
std::mt19937& m_rng;
int m_asteroidWidth_tiles;
// The factory's world data — buildings, queued work, tile ownership. Held here
// for now; the intent is for Simulation to own it and pass it into the tick
// methods, leaving this system stateless over it (see FactoryState.h).
FactoryState m_state;
};