fix issue where shipyard did not produce anything

This commit is contained in:
2026-04-21 22:17:48 +02:00
parent 2523cd6a1b
commit 393c49e1bb
12 changed files with 393 additions and 16 deletions

View File

@@ -29,6 +29,15 @@ Simulation::Simulation(const GameConfig& config, unsigned int seed)
m_beltSystem,
[this]() { return allocateId(); },
[this](int amount) { m_buildingBlocksStock += amount; },
[this](const std::string& id, QVector2D pos) {
const std::map<std::string, BlueprintState>::const_iterator it =
m_blueprintLevels.find(id);
if (it == m_blueprintLevels.end() || !it->second.unlocked)
{
return;
}
m_shipSystem->spawn(id, it->second.level, pos, /*isEnemy=*/false);
},
m_rng);
m_shipSystem = std::make_unique<ShipSystem>(config, [this]() { return allocateId(); });
m_scrapSystem = std::make_unique<ScrapSystem>([this]() { return allocateId(); });
@@ -70,6 +79,15 @@ void Simulation::reset(unsigned int seed)
m_beltSystem,
[this]() { return allocateId(); },
[this](int amount) { m_buildingBlocksStock += amount; },
[this](const std::string& id, QVector2D pos) {
const std::map<std::string, BlueprintState>::const_iterator it =
m_blueprintLevels.find(id);
if (it == m_blueprintLevels.end() || !it->second.unlocked)
{
return;
}
m_shipSystem->spawn(id, it->second.level, pos, /*isEnemy=*/false);
},
m_rng);
m_shipSystem = std::make_unique<ShipSystem>(m_config, [this]() { return allocateId(); });
m_scrapSystem = std::make_unique<ScrapSystem>([this]() { return allocateId(); });
@@ -105,6 +123,7 @@ void Simulation::tick()
m_buildingSystem->tickConstruction(m_currentTick);
m_buildingSystem->tickBeltPull(); // step 3
m_buildingSystem->tickProduction(m_currentTick); // step 4
m_buildingSystem->tickShipyardProduction(m_currentTick); // step 4b
m_buildingSystem->tickBeltPush(); // step 5
m_beltSystem.tick(); // step 6