show team EHP in balancing target

This commit is contained in:
2026-07-04 07:11:22 +02:00
parent 4d5b218fec
commit d9e7dd0fe8
8 changed files with 100 additions and 2 deletions

View File

@@ -44,7 +44,16 @@ struct ArenaStatus
{
std::string name;
double threatLevel = 0.0; // accumulated threat of the team's configured ships
// Remaining durability of the team's ships and defence stations (HQ
// excluded). currentEhp is summed live; maxEhp is the fixed full-HP
// baseline. See ehpPercentText() for the displayed value.
double currentEhp = 0.0;
double maxEhp = 0.0;
std::vector<Entry> entries; // HQ first, then ships, then stations
// Remaining EHP as a whole-number percentage ("NN%"), or "n/a" when the
// team has no ships or stations (maxEhp == 0).
std::string ehpPercentText() const;
};
TeamStatus teams[2];
@@ -82,6 +91,7 @@ private:
BuildingId allocateBuildingId();
void placeStructures();
void spawnShips();
void computeTeamMaxEhp();
void tick();
void tickDeaths();
void updateStatus();
@@ -115,6 +125,10 @@ private:
// Static accumulated threat per team, computed once from the configured roster.
double m_teamThreat[2] = {0.0, 0.0};
// Full-HP baseline per team (ships + defence stations, HQ excluded), computed
// once after spawning; the EHP-percentage denominator.
double m_teamMaxEhp[2] = {0.0, 0.0};
std::vector<BeamFiredEvent> m_beamFiredEvents;
mutable std::mutex m_statusMutex;