diff --git a/Themes/Til Death/BGAnimations/superscoreboard.lua b/Themes/Til Death/BGAnimations/superscoreboard.lua index c509a6a869..7e427555a2 100644 --- a/Themes/Til Death/BGAnimations/superscoreboard.lua +++ b/Themes/Til Death/BGAnimations/superscoreboard.lua @@ -84,7 +84,6 @@ local function byAchieved(scoregoal) end local filts = {"All Rates", "Current Rate"} -local currentrateonly = false local scoretable local o = Def.ActorFrame{ @@ -227,22 +226,23 @@ local o = Def.ActorFrame{ LoadFont("Common normal") .. { --current rate toggle InitCommand=function(self) - self:xy(c5x - 10, headeroff):zoom(tzoom):halign(1):settext(filts[1]) + self:xy(c5x - 10, headeroff):zoom(tzoom):halign(1) end, HighlightCommand=function(self) highlightIfOver(self) end, + UpdateCommand=function(self) + if DLMAN:GetCurrentRateFilter() then + self:settext(filts[2]) + else + self:settext(filts[1]) + end + end, MouseLeftClickMessageCommand=function(self) if isOver(self) then - scoretable = DLMAN:ToggleRateFilter() + DLMAN:ToggleRateFilter() ind = 0 - currentrateonly = not currentrateonly - if currentrateonly then - self:settext(filts[2]) - else - self:settext(filts[1]) - end - self:GetParent():queuecommand("Update") + self:GetParent():queuecommand("ChartLeaderboardUpdate") end end, }, diff --git a/src/DownloadManager.cpp b/src/DownloadManager.cpp index 86b901f645..352d178038 100644 --- a/src/DownloadManager.cpp +++ b/src/DownloadManager.cpp @@ -1765,15 +1765,6 @@ class LunaDownloadManager : public Luna //p->RequestChartLeaderBoard(SArg(1)); p->MakeAThing(SArg(1)); vector wot; - for (auto& zoop : p->athing) - wot.push_back(&zoop); - LuaHelpers::CreateTableFromArray(wot, L); - return 1; - } - - static int ToggleRateFilter(T* p, lua_State* L) { - p->currentrateonly = !p->currentrateonly; - vector wot; float currentrate = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; for (auto& zoop : p->athing) { if (lround(zoop.GetMusicRate() * 10000.f) != lround(currentrate * 10000.f) && p->currentrateonly) @@ -1784,6 +1775,15 @@ class LunaDownloadManager : public Luna return 1; } + static int ToggleRateFilter(T* p, lua_State* L) { + p->currentrateonly = !p->currentrateonly; + return 1; + } + static int GetCurrentRateFilter(T* p, lua_State* L) { + lua_pushboolean(L, p->currentrateonly); + return 1; + } + LunaDownloadManager() { ADD_METHOD(DownloadCoreBundle); @@ -1805,6 +1805,7 @@ class LunaDownloadManager : public Luna ADD_METHOD(GetRegisterPage); ADD_METHOD(RequestChartLeaderBoard); ADD_METHOD(ToggleRateFilter); + ADD_METHOD(GetCurrentRateFilter); ADD_METHOD(Logout); } }; diff --git a/src/DownloadManager.h b/src/DownloadManager.h index 7d6a82173c..533200ff9f 100644 --- a/src/DownloadManager.h +++ b/src/DownloadManager.h @@ -212,7 +212,7 @@ class DownloadManager void RefreshRegisterPage(); void MakeAThing(string chartkey); vector athing; - bool currentrateonly = 0; + bool currentrateonly = false; void RequestChartLeaderBoard(string chartkey); void RefreshUserData(); void RefreshUserRank();