indicate balancing winner better
This commit is contained in:
@@ -285,5 +285,5 @@ A separate executable target (`balancing`) that links against `lib` but contains
|
||||
### UI
|
||||
|
||||
- REQ-BAL-UI-WINDOW: On startup the tool displays a window containing a dynamically generated vertical list of arena buttons, one per arena defined in `balancing.toml`.
|
||||
- REQ-BAL-UI-BUTTON: Each arena button displays the arena name and two columns (one per team). Each column shows the team name as a header, followed by a list of entries. The HQ is always the first entry in each column. Below the HQ, ship types are listed, followed by defence stations (if any). Each entry uses the format `surviving/total TypeName Llevel` — for example `2/3 Fighter L5` or `1/1 HQ L1`. The surviving count updates live as the simulation progresses.
|
||||
- REQ-BAL-UI-BUTTON: Each arena button displays the arena name and two columns (one per team). Each column shows the team name as a header, followed by a list of entries. The HQ is always the first entry in each column. Below the HQ, ship types are listed, followed by defence stations (if any). Each entry uses the format `surviving/total TypeName Llevel` — for example `2/3 Fighter L5` or `1/1 HQ L1`. The surviving count updates live as the simulation progresses. When the fight ends, the winning team's name header is prefixed with `[WON]`.
|
||||
- REQ-BAL-UI-BUTTON-BORDER: While an arena's simulation is running, the button border is blue. When the fight ends, the border changes to green.
|
||||
|
||||
@@ -62,7 +62,14 @@ void ArenaButton::updateStatus(const ArenaStatus& status)
|
||||
QLabel* header = (ti == 0) ? m_team1Header : m_team2Header;
|
||||
QLabel* content = (ti == 0) ? m_team1Content : m_team2Content;
|
||||
|
||||
header->setText(QString::fromStdString(team.name));
|
||||
if (status.finished && status.winnerTeam == ti)
|
||||
{
|
||||
header->setText("[WON] " + QString::fromStdString(team.name));
|
||||
}
|
||||
else
|
||||
{
|
||||
header->setText(QString::fromStdString(team.name));
|
||||
}
|
||||
|
||||
QString lines;
|
||||
for (const ArenaStatus::Entry& entry : team.entries)
|
||||
|
||||
@@ -28,6 +28,7 @@ ArenaSimulation::ArenaSimulation(const GameConfig& gameConfig,
|
||||
, m_team1HqId(kInvalidEntityId)
|
||||
, m_team2HqId(kInvalidEntityId)
|
||||
, m_finished(false)
|
||||
, m_winnerTeam(-1)
|
||||
, m_stopRequested(false)
|
||||
{
|
||||
m_buildingSystem = std::make_unique<BuildingSystem>(
|
||||
@@ -333,6 +334,7 @@ void ArenaSimulation::tickDeaths()
|
||||
if (team1HqGone || team2HqGone)
|
||||
{
|
||||
m_finished = true;
|
||||
m_winnerTeam = team1HqGone ? 1 : 0;
|
||||
updateStatus();
|
||||
return;
|
||||
}
|
||||
@@ -355,6 +357,7 @@ void ArenaSimulation::tickDeaths()
|
||||
if (!team1HasShips || !team2HasShips)
|
||||
{
|
||||
m_finished = true;
|
||||
m_winnerTeam = team1HasShips ? 0 : 1;
|
||||
updateStatus();
|
||||
}
|
||||
}
|
||||
@@ -363,6 +366,7 @@ void ArenaSimulation::updateStatus()
|
||||
{
|
||||
ArenaStatus newStatus;
|
||||
newStatus.finished = m_finished;
|
||||
newStatus.winnerTeam = m_winnerTeam;
|
||||
|
||||
for (int ti = 0; ti < 2; ++ti)
|
||||
{
|
||||
|
||||
@@ -37,6 +37,7 @@ struct ArenaStatus
|
||||
|
||||
TeamStatus teams[2];
|
||||
bool finished = false;
|
||||
int winnerTeam = -1; // 0 or 1 when finished; -1 while running
|
||||
};
|
||||
|
||||
class ArenaSimulation
|
||||
@@ -77,6 +78,7 @@ private:
|
||||
EntityId m_team2HqId;
|
||||
|
||||
bool m_finished;
|
||||
int m_winnerTeam;
|
||||
std::atomic<bool> m_stopRequested;
|
||||
|
||||
mutable std::mutex m_statusMutex;
|
||||
|
||||
Reference in New Issue
Block a user