remove unused building HP
This commit is contained in:
@@ -145,7 +145,7 @@ void ArenaView::paintGL()
|
|||||||
|
|
||||||
drawTiles(painter);
|
drawTiles(painter);
|
||||||
drawBuildings(painter);
|
drawBuildings(painter);
|
||||||
//drawStations(painter);
|
drawStations(painter);
|
||||||
drawScrap(painter);
|
drawScrap(painter);
|
||||||
drawShips(painter);
|
drawShips(painter);
|
||||||
drawBeams(painter);
|
drawBeams(painter);
|
||||||
|
|||||||
@@ -75,8 +75,6 @@ struct Building
|
|||||||
QSize footprint;
|
QSize footprint;
|
||||||
Rotation rotation = Rotation::East;
|
Rotation rotation = Rotation::East;
|
||||||
BuildingType type = BuildingType::Miner;
|
BuildingType type = BuildingType::Miner;
|
||||||
float hp = 0.0f;
|
|
||||||
float maxHp = 0.0f;
|
|
||||||
std::string recipeId; // empty = none selected
|
std::string recipeId; // empty = none selected
|
||||||
|
|
||||||
InputBuffer inputBuffer;
|
InputBuffer inputBuffer;
|
||||||
|
|||||||
@@ -445,8 +445,6 @@ void BuildingSystem::tickConstruction(Tick currentTick)
|
|||||||
building.footprint = front.footprint;
|
building.footprint = front.footprint;
|
||||||
building.rotation = front.rotation;
|
building.rotation = front.rotation;
|
||||||
building.type = front.type;
|
building.type = front.type;
|
||||||
building.hp = 100.0f;
|
|
||||||
building.maxHp = 100.0f;
|
|
||||||
building.recipeId = front.recipeId;
|
building.recipeId = front.recipeId;
|
||||||
building.shipLayout = front.shipLayout;
|
building.shipLayout = front.shipLayout;
|
||||||
|
|
||||||
@@ -1049,8 +1047,7 @@ bool BuildingSystem::deliverScrapToSalvageBay(EntityId bayId)
|
|||||||
|
|
||||||
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)
|
||||||
float hp, float maxHp)
|
|
||||||
{
|
{
|
||||||
const EntityId id = m_allocateId();
|
const EntityId id = m_allocateId();
|
||||||
const ParsedSurfaceMask mask = parseSurfaceMask(surfaceMask, rotation);
|
const ParsedSurfaceMask mask = parseSurfaceMask(surfaceMask, rotation);
|
||||||
@@ -1061,8 +1058,6 @@ EntityId BuildingSystem::placeImmediate(BuildingType type,
|
|||||||
building.footprint = mask.footprint;
|
building.footprint = mask.footprint;
|
||||||
building.rotation = rotation;
|
building.rotation = rotation;
|
||||||
building.type = type;
|
building.type = type;
|
||||||
building.hp = hp;
|
|
||||||
building.maxHp = maxHp;
|
|
||||||
|
|
||||||
for (const QPoint& cell : mask.bodyCells)
|
for (const QPoint& cell : mask.bodyCells)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -109,8 +109,7 @@ public:
|
|||||||
// surfaceMask comes from the relevant config struct.
|
// surfaceMask comes from the relevant config struct.
|
||||||
EntityId placeImmediate(BuildingType type,
|
EntityId placeImmediate(BuildingType type,
|
||||||
const std::vector<std::string>& surfaceMask,
|
const std::vector<std::string>& surfaceMask,
|
||||||
QPoint anchor, Rotation rotation,
|
QPoint anchor, Rotation rotation);
|
||||||
float hp, float maxHp);
|
|
||||||
|
|
||||||
// Remove an operational building by id without refund (used for deaths).
|
// Remove an operational building by id without refund (used for deaths).
|
||||||
// Returns true if found and removed.
|
// Returns true if found and removed.
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ void Simulation::placeInitialStructures()
|
|||||||
BuildingType::Hq,
|
BuildingType::Hq,
|
||||||
m_config.stations.hq.surfaceMask,
|
m_config.stations.hq.surfaceMask,
|
||||||
QPoint(hqAnchorX, hqAnchorY),
|
QPoint(hqAnchorX, hqAnchorY),
|
||||||
Rotation::East, hqHp, hqHp);
|
Rotation::East);
|
||||||
|
|
||||||
const QVector2D hqCenter(
|
const QVector2D hqCenter(
|
||||||
hqAnchorX + hqParsed.footprint.width() / 2.0f,
|
hqAnchorX + hqParsed.footprint.width() / 2.0f,
|
||||||
|
|||||||
@@ -51,8 +51,7 @@ static EntityId placeShipyard(Simulation& sim, const BuildingDef& yardDef)
|
|||||||
BuildingType::Shipyard,
|
BuildingType::Shipyard,
|
||||||
yardDef.surfaceMask,
|
yardDef.surfaceMask,
|
||||||
QPoint(0, 0),
|
QPoint(0, 0),
|
||||||
Rotation::East,
|
Rotation::East);
|
||||||
100.0f, 100.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fillMaterials(Simulation& sim, EntityId yardId,
|
static void fillMaterials(Simulation& sim, EntityId yardId,
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ static EntityId placeShipyard(Simulation& sim, const BuildingDef& yardDef)
|
|||||||
BuildingType::Shipyard,
|
BuildingType::Shipyard,
|
||||||
yardDef.surfaceMask,
|
yardDef.surfaceMask,
|
||||||
QPoint(0, 0),
|
QPoint(0, 0),
|
||||||
Rotation::East,
|
Rotation::East);
|
||||||
100.0f, 100.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int countShips(Simulation& sim)
|
static int countShips(Simulation& sim)
|
||||||
|
|||||||
@@ -132,15 +132,12 @@ TEST_CASE("WaveSystem: HQ has correct initial HP from config", "[wave]")
|
|||||||
static_cast<float>(sim.config().stations.hq.hpFormula.evaluate(0.0));
|
static_cast<float>(sim.config().stations.hq.hpFormula.evaluate(0.0));
|
||||||
bool found = false;
|
bool found = false;
|
||||||
float actualHp = 0.0f;
|
float actualHp = 0.0f;
|
||||||
for (const Building& b : sim.buildings().allBuildings())
|
sim.admin().forEach<HqProxy, Health>(
|
||||||
{
|
[&](entt::entity /*e*/, const HqProxy& /*hq*/, const Health& h)
|
||||||
if (b.type == BuildingType::Hq)
|
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
actualHp = b.hp;
|
actualHp = h.hp;
|
||||||
break;
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
REQUIRE(found);
|
REQUIRE(found);
|
||||||
REQUIRE(actualHp == Approx(expectedHp));
|
REQUIRE(actualHp == Approx(expectedHp));
|
||||||
|
|||||||
Reference in New Issue
Block a user