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