#pragma once #include #include #include #include #include #include #include "BuildingType.h" #include "EntityId.h" #include "Item.h" #include "ItemType.h" #include "Port.h" #include "Rotation.h" #include "Tick.h" // Per-material input buffer for a production building. struct InputBuffer { std::map counts; // current item counts per material std::map caps; // max items per material (2× per-cycle requirement) }; // Output buffer shared by all output materials for a production building. struct OutputBuffer { std::vector items; int capacity = 0; // 2× per-cycle output; 1× for ReprocessingPlant }; // Active production cycle for a building. struct Production { std::string recipeId; Tick completesAt = 0; std::vector chosenOutputs; // resolved at cycle start (reprocessing rolls here) }; // A building placed on the map that is still under construction. // Occupies tiles but does not produce. struct ConstructionSite { EntityId id = kInvalidEntityId; QPoint anchor; // top-left of body bounding box QSize footprint; std::vector bodyCells; // absolute world tile coordinates Rotation rotation = Rotation::East; BuildingType type = BuildingType::Miner; std::string recipeId; // may be configured before completion Tick completesAt = 0; // 0 = queued but not yet started }; // Weapon state for stationary structures (defence stations). // Distinct from Ship::Weapon; stations have no movement intent. struct StationWeapon { float damage; float range; float fireRateHz; float cooldownTicks; std::optional currentTarget; }; // A fully constructed, operational building. struct Building { EntityId id = kInvalidEntityId; QPoint anchor; // top-left of body bounding box QSize footprint; Rotation rotation = Rotation::East; BuildingType type = BuildingType::Miner; float hp = 0.0f; float maxHp = 0.0f; std::string recipeId; // empty = none selected InputBuffer inputBuffer; OutputBuffer outputBuffer; std::optional production; // Pre-computed from surface mask at placement; in absolute world coordinates. std::vector bodyCells; std::vector outputPorts; std::vector inputPorts; // perimeter tiles (minus output-port tiles), // direction pointing INTO building // Set only for defence stations; nullopt for all other building types. std::optional weapon; };