Skip to content

Commit e5d7d68

Browse files
committed
markedVS: fix dumb mistakes and something scopeguards
1 parent f8e0834 commit e5d7d68

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tf2_bot_detector/UI/MainWindow.Scoreboard.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,17 +1075,17 @@ void MainWindow::OnDrawTeamStats()
10751075
if (statsArray[0].m_MarkedCount > 0)
10761076
{
10771077
// change colors for cooresponding teams
1078-
markedFG = ImGuiDesktop::ScopeGuards::StyleColor(ImGuiCol_PlotHistogram, friendlyBG);
1078+
ImGuiDesktop::ScopeGuards::StyleColor teamMarkedFG(ImGuiCol_PlotHistogram, friendlyBG);
10791079

10801080
const auto teamUnmarked = statsArray[0].m_PlayerCount - statsArray[0].m_MarkedCount;
1081-
const auto teamUnmarkedActive = statsArray[1].m_PlayerCountActive - statsArray[1].m_MarkedCountActive;
1082-
const float teamMarkedRate = statsArray[0].m_MarkedCount / static_cast<float>(statsArray[0].m_PlayerCount);
1081+
const auto teamUnmarkedActive = statsArray[0].m_PlayerCountActive - statsArray[0].m_MarkedCountActive;
1082+
const float teamMarkedRate = teamUnmarked / static_cast<float>(statsArray[0].m_PlayerCount);
10831083

10841084
mh::fmtstr<128> teamMessage;
10851085

10861086
if (statsArray[0].m_MarkedCount != statsArray[0].m_MarkedCountActive)
10871087
{
1088-
teamMessage.fmt("MarkedVS (Team): {} ({}) vs {} ({})", teamUnmarked, teamUnmarkedActive, statsArray[1].m_MarkedCount, statsArray[1].m_MarkedCountActive);
1088+
teamMessage.fmt("MarkedVS (Team): {} ({}) vs {} ({})", teamUnmarked, teamUnmarkedActive, statsArray[0].m_MarkedCount, statsArray[0].m_MarkedCountActive);
10891089
}
10901090
else
10911091
{
@@ -1097,16 +1097,16 @@ void MainWindow::OnDrawTeamStats()
10971097

10981098
if (statsArray[1].m_MarkedCount > 0)
10991099
{
1100-
// change colors for cooresponding teams
1101-
markedFG = ImGuiDesktop::ScopeGuards::StyleColor(ImGuiCol_PlotHistogram, enemyBG);
1100+
// change colors for cooresponding teams
1101+
ImGuiDesktop::ScopeGuards::StyleColor enemyMarkedFG(ImGuiCol_PlotHistogram, enemyBG);
11021102

11031103
const auto enemyUnmarked = statsArray[1].m_PlayerCount - statsArray[1].m_MarkedCount;
11041104
const auto enemyUnmarkedActive = statsArray[1].m_PlayerCountActive - statsArray[1].m_MarkedCountActive;
1105-
float enemyMarkedRate = statsArray[1].m_MarkedCount / static_cast<float>(statsArray[1].m_PlayerCount);
1105+
float enemyMarkedRate = enemyUnmarked / static_cast<float>(statsArray[1].m_PlayerCount);
11061106

11071107
mh::fmtstr<128> enemyMessage;
11081108

1109-
if (statsArray[0].m_MarkedCount != statsArray[1].m_MarkedCountActive)
1109+
if (statsArray[1].m_MarkedCount != statsArray[1].m_MarkedCountActive)
11101110
{
11111111
enemyMessage.fmt("MarkedVS (Enemy): {} ({}) vs {} ({})", enemyUnmarked, enemyUnmarkedActive, statsArray[1].m_MarkedCount, statsArray[1].m_MarkedCountActive);
11121112
}

0 commit comments

Comments
 (0)