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