cleanup
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
// Canonical reference to every targetable entity in the simulation: ships,
|
||||
// scrap drops, and buildings (including HQ and defence stations).
|
||||
// Stable id for factory buildings, construction sites, and belts.
|
||||
// Ships, stations, scrap, and the HQ proxy use entt::entity instead.
|
||||
// Ids are allocated centrally by the Simulation, strictly increasing, never
|
||||
// reused. 0 is reserved as the invalid id.
|
||||
using EntityId = long long;
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "EntityAdmin.h"
|
||||
#include "EntityId.h"
|
||||
#include "MovementIntent.h"
|
||||
#include "Scrap.h"
|
||||
#include "ScrapSystem.h"
|
||||
#include "Ship.h"
|
||||
|
||||
|
||||
@@ -91,7 +91,4 @@ struct Building
|
||||
|
||||
// Module layout for shipyards (REQ-MOD-LAYOUT).
|
||||
std::optional<ShipLayoutConfig> shipLayout;
|
||||
|
||||
// Set only for defence stations; nullopt for all other building types.
|
||||
std::optional<StationWeapon> weapon;
|
||||
};
|
||||
|
||||
@@ -1049,30 +1049,6 @@ bool BuildingSystem::deliverScrapToSalvageBay(EntityId bayId)
|
||||
return true;
|
||||
}
|
||||
|
||||
void BuildingSystem::healBuilding(EntityId id, float amount)
|
||||
{
|
||||
for (Building& b : m_buildings)
|
||||
{
|
||||
if (b.id == id)
|
||||
{
|
||||
b.hp = std::min(b.hp + amount, b.maxHp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BuildingSystem::damageBuilding(EntityId id, float amount)
|
||||
{
|
||||
for (Building& b : m_buildings)
|
||||
{
|
||||
if (b.id == id)
|
||||
{
|
||||
b.hp -= amount;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EntityId BuildingSystem::placeImmediate(BuildingType type,
|
||||
const std::vector<std::string>& surfaceMask,
|
||||
QPoint anchor, Rotation rotation,
|
||||
@@ -1133,18 +1109,6 @@ bool BuildingSystem::removeBuilding(EntityId id)
|
||||
return false;
|
||||
}
|
||||
|
||||
void BuildingSystem::initStationWeapon(EntityId id, const StationWeapon& weapon)
|
||||
{
|
||||
for (Building& b : m_buildings)
|
||||
{
|
||||
if (b.id == id)
|
||||
{
|
||||
b.weapon = weapon;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BuildingSystem::forEachBuilding(std::function<void(Building&)> fn)
|
||||
{
|
||||
for (Building& b : m_buildings)
|
||||
|
||||
@@ -104,12 +104,6 @@ public:
|
||||
// Returns false if bay not found, wrong type, or output buffer is full.
|
||||
bool deliverScrapToSalvageBay(EntityId bayId);
|
||||
|
||||
// Increase a building's HP by amount, clamped to maxHp.
|
||||
void healBuilding(EntityId id, float amount);
|
||||
|
||||
// Reduce a building's HP by amount; hp may go below 0 (step 9 processes deaths).
|
||||
void damageBuilding(EntityId id, float amount);
|
||||
|
||||
// Bypass the construction queue and create a fully-operational Building
|
||||
// immediately. Used for pre-placed structures (HQ, defence stations).
|
||||
// surfaceMask comes from the relevant config struct.
|
||||
@@ -122,10 +116,7 @@ public:
|
||||
// Returns true if found and removed.
|
||||
bool removeBuilding(EntityId id);
|
||||
|
||||
// Set the weapon component on an already-placed defence station.
|
||||
void initStationWeapon(EntityId id, const StationWeapon& weapon);
|
||||
|
||||
// Mutable iteration over all operational buildings (used by CombatSystem).
|
||||
// Mutable iteration over all operational buildings.
|
||||
void forEachBuilding(std::function<void(Building&)> fn);
|
||||
|
||||
private:
|
||||
|
||||
@@ -5,7 +5,6 @@ SET(HDRS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/BeltSystem.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Building.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/BuildingSystem.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Scrap.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Ship.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ShipLayout.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ShipLayoutBlueprint.h
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <QVector2D>
|
||||
|
||||
#include "EntityId.h"
|
||||
#include "Tick.h"
|
||||
|
||||
struct Scrap
|
||||
{
|
||||
EntityId id;
|
||||
QVector2D position;
|
||||
int amount;
|
||||
Tick despawnAt;
|
||||
};
|
||||
Reference in New Issue
Block a user