implement building system

This commit is contained in:
2026-04-19 20:50:42 +02:00
parent c70b5c8f08
commit bf29cc40e3
19 changed files with 1818 additions and 7 deletions

View File

@@ -1,21 +1,25 @@
#pragma once
#include <memory>
#include <random>
#include <vector>
#include "BeltSystem.h"
#include "BlueprintDropEvent.h"
#include "EntityId.h"
#include "FireEvent.h"
#include "BlueprintDropEvent.h"
#include "GameConfig.h"
#include "Tick.h"
class BuildingSystem;
class Simulation
{
public:
explicit Simulation(const GameConfig& config, unsigned int seed = 0);
~Simulation();
// Advances the simulation by one tick. Tick order per architecture.md §Tick Order.
// Currently a stub; subsystems are plugged in across Steps 3-7.
void tick();
// Returns all fire events accumulated since the last drain, clearing the
@@ -26,6 +30,12 @@ public:
std::vector<BlueprintDropEvent> drainBlueprintDropEvents();
Tick currentTick() const;
int buildingBlocksStock() const;
BuildingSystem& buildings();
const BuildingSystem& buildings() const;
BeltSystem& belts();
const BeltSystem& belts() const;
private:
EntityId allocateId(); // Strictly increasing; never returns kInvalidEntityId.
@@ -33,9 +43,13 @@ private:
const GameConfig& m_config;
std::mt19937 m_rng;
Tick m_currentTick;
EntityId m_nextId; // starts at 1; 0 is kInvalidEntityId.
Tick m_currentTick;
EntityId m_nextId;
int m_buildingBlocksStock;
std::vector<FireEvent> m_fireEvents;
BeltSystem m_beltSystem;
std::unique_ptr<BuildingSystem> m_buildingSystem;
std::vector<FireEvent> m_fireEvents;
std::vector<BlueprintDropEvent> m_blueprintDropEvents;
};