indicate balancing winner better
This commit is contained in:
@@ -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