Skip to content

Commit bc5458e

Browse files
committed
fix: lp boards appearing when they shouldnt be
1 parent 1e6ea10 commit bc5458e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/Features/AutoSubmit.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ static void startSearching(std::string mapName) {
301301
auto lp_json = AutoSubmit::GetLeastPortals(lp_map_id);
302302

303303
g_portals.clear();
304+
g_lp = false;
304305
for (const auto &score : lp_json) {
305306
g_lp = true;
306307

src/Modules/Client.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -910,9 +910,9 @@ DETOUR(Client::SetPanelStats) {
910910
bool showLp = sar.game->Is(SourceGame_Portal2) && AutoSubmit::IsLpAvailable();
911911

912912
/* set time/portals button visible (only in p2 though) */
913-
if (showLp) {
913+
if (showLp)
914914
Memory::VMT<void(__rescall *)(void *, bool)>(m_pLeaderboardListButton, Offsets::Panel_SetVisible)(m_pLeaderboardListButton, true); // Panel::SetVisible
915-
} else
915+
else
916916
m_CurrentLeaderboardType = 1;
917917

918918
/* set boards visible */
@@ -943,7 +943,6 @@ DETOUR(Client::SetPanelStats) {
943943
g_allocatedAvatars.clear();
944944

945945
/* add scores */
946-
// TODO: maybe integrate LP boards too in the future?
947946
if (m_CurrentLeaderboardType == 1 /* times */) {
948947
const auto &times = AutoSubmit::GetTimes();
949948

@@ -953,12 +952,12 @@ DETOUR(Client::SetPanelStats) {
953952
client->AddAvatarPanelItem(m_pLeaderboard, m_pStatList, &time, time.score, 1, -1, i, m_nStatHeight, -1, 0);
954953
}
955954
} else /* portals */ {
956-
const auto &times = AutoSubmit::GetPortals();
955+
const auto &scores = AutoSubmit::GetPortals();
957956

958-
for (size_t i = 0; i < times.size(); ++i) {
959-
const auto &time = times[i];
957+
for (size_t i = 0; i < scores.size(); ++i) {
958+
const auto &score = scores[i];
960959

961-
client->AddAvatarPanelItem(m_pLeaderboard, m_pStatList, &time, time.score, 0, -1, i, m_nStatHeight, -1, 0);
960+
client->AddAvatarPanelItem(m_pLeaderboard, m_pStatList, &score, score.score, 0, -1, i, m_nStatHeight, -1, 0);
962961
}
963962
}
964963

0 commit comments

Comments
 (0)