implement scrap and ship skeleton

This commit is contained in:
2026-04-20 07:32:18 +02:00
parent bf29cc40e3
commit 411be72a5c
14 changed files with 646 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
#include "Simulation.h"
#include "BuildingSystem.h"
#include "ScrapSystem.h"
#include "ShipSystem.h"
Simulation::Simulation(const GameConfig& config, unsigned int seed)
: m_config(config)
@@ -16,6 +18,8 @@ Simulation::Simulation(const GameConfig& config, unsigned int seed)
[this]() { return allocateId(); },
[this](int amount) { m_buildingBlocksStock += amount; },
m_rng);
m_shipSystem = std::make_unique<ShipSystem>(config, [this]() { return allocateId(); });
m_scrapSystem = std::make_unique<ScrapSystem>([this]() { return allocateId(); });
}
Simulation::~Simulation() = default;
@@ -27,6 +31,7 @@ void Simulation::tick()
m_buildingSystem->tickProduction(m_currentTick); // step 4
m_buildingSystem->tickBeltPush(); // step 5
m_beltSystem.tick(); // step 6
m_scrapSystem->tickDespawn(m_currentTick); // step 11
++m_currentTick;
}
@@ -75,6 +80,26 @@ const BeltSystem& Simulation::belts() const
return m_beltSystem;
}
ShipSystem& Simulation::ships()
{
return *m_shipSystem;
}
const ShipSystem& Simulation::ships() const
{
return *m_shipSystem;
}
ScrapSystem& Simulation::scraps()
{
return *m_scrapSystem;
}
const ScrapSystem& Simulation::scraps() const
{
return *m_scrapSystem;
}
EntityId Simulation::allocateId()
{
return m_nextId++;