make construction its own system (extracted from BuildingSystem)

This commit is contained in:
2026-08-05 06:57:12 +02:00
parent fd85e8e10a
commit 1f4503176b
9 changed files with 196 additions and 148 deletions

View File

@@ -15,6 +15,7 @@
#include "BeltSystem.h"
#include "Building.h"
#include "BuildingSystem.h"
#include "ConstructionSystem.h"
#include "FactoryState.h"
#include "BuildingType.h"
#include "ConfigLoader.h"
@@ -63,6 +64,7 @@ struct Fixture
std::mt19937 rng;
EntityAdmin admin;
BuildingSystem buildings;
ConstructionSystem construction;
ShipSystem ships;
AiSystem ai;
SalvagerSystem salvager;
@@ -85,6 +87,7 @@ struct Fixture
[](const std::string&, QVector2D, const std::optional<ShipLayoutConfig>&) {},
[](const std::string&) -> bool { return true; },
rng)
, construction(cfg)
, ships(cfg, admin)
, ai(cfg)
, salvager(admin)
@@ -957,7 +960,7 @@ TEST_CASE("BehaviorSystem: full-cargo salvage ship moves toward SalvageBay", "[b
Tick t = 0;
for (int i = 0; i < 500; ++i)
{
f.buildings.tickConstruction(f.state, t++);
f.construction.tick(f.state, f.belts, t++);
if (findBuilding(f.state, bayId) != nullptr)
{
break;
@@ -992,7 +995,7 @@ TEST_CASE("SalvagerSystem: full-cargo ship at its SalvageBay hands over cargo",
Tick t = 0;
for (int i = 0; i < 500; ++i)
{
f.buildings.tickConstruction(f.state, t++);
f.construction.tick(f.state, f.belts, t++);
if (findBuilding(f.state, bayId) != nullptr) { break; }
}
const Building* bay = findBuilding(f.state, bayId);