diff --git a/src/Etterna/Actor/Menus/MusicWheel.cpp b/src/Etterna/Actor/Menus/MusicWheel.cpp index 96ffe30307..8dbd660588 100644 --- a/src/Etterna/Actor/Menus/MusicWheel.cpp +++ b/src/Etterna/Actor/Menus/MusicWheel.cpp @@ -18,7 +18,8 @@ #include "Etterna/Singletons/SongManager.h" #include "Etterna/Models/Songs/SongUtil.h" #include "Etterna/Models/StepsAndStyles/Style.h" -#include "Etterna/Singletons/ThemeManager.h" +#include "Etterna/Singletons/ThemeManager.h" +#include "Etterna/Singletons/ScoreManager.h" #include "Etterna/Globals/rngthing.h" #include @@ -947,6 +948,7 @@ MusicWheel::BuildWheelItemDatas( allSongsFiltered = arraySongs; allSongsByGroupFiltered[so].clear(); + packProgressByGroup[so].clear(); // make WheelItemDatas with sections @@ -1056,6 +1058,24 @@ MusicWheel::BuildWheelItemDatas( } } } + } + // calculate the pack progress numbers for the sortorder + if (PREFSMAN->m_bPackProgressInWheel) { + auto allsongs = allSongsByGroupFiltered.at(so); + for (auto& groupname_songlist_pair : allsongs) { + int num_played_songs = 0; + for (auto& s : groupname_songlist_pair.second) { + for (auto& chart : s->GetChartsOfCurrentGameMode()) { + if (SCOREMAN->KeyHasScores(chart->GetChartKey())) { + num_played_songs++; + break; + } + } + } + packProgressByGroup.at(so)[groupname_songlist_pair.first] = + num_played_songs; + } + } } } diff --git a/src/Etterna/Actor/Menus/MusicWheel.h b/src/Etterna/Actor/Menus/MusicWheel.h index f1afdb711f..a027773d20 100644 --- a/src/Etterna/Actor/Menus/MusicWheel.h +++ b/src/Etterna/Actor/Menus/MusicWheel.h @@ -68,7 +68,11 @@ class MusicWheel : public WheelBase std::vector allSongsFiltered; // all songs by sort order by group also filtered std::vector>> - allSongsByGroupFiltered{ NUM_SortOrder }; + allSongsByGroupFiltered{ NUM_SortOrder }; + // song grade progress by group + std::vector> packProgressByGroup{ + NUM_SortOrder + }; auto SelectSongOrCourse() -> bool; void SelectSongAfterSearch(); diff --git a/src/Etterna/Actor/Menus/MusicWheelItem.cpp b/src/Etterna/Actor/Menus/MusicWheelItem.cpp index 76a152fda7..21108eb84a 100644 --- a/src/Etterna/Actor/Menus/MusicWheelItem.cpp +++ b/src/Etterna/Actor/Menus/MusicWheelItem.cpp @@ -201,19 +201,10 @@ MusicWheelItem::LoadFromWheelItemData(const WheelItemBaseData* pData, type = MusicWheelItemType_SectionCollapsed; } - auto all_songs_by_group = wheel->allSongsByGroupFiltered.at(GAMESTATE->m_SortOrder); - auto songs_in_group = all_songs_by_group.find(pWID->m_sText); - if (PREFSMAN->m_bPackProgressInWheel && songs_in_group != all_songs_by_group.end()) { - int num_played_songs = 0; - - for (auto song : songs_in_group->second) { - for (auto chart : song->GetChartsOfCurrentGameMode()) { - if (SCOREMAN->KeyHasScores(chart->GetChartKey())) { - num_played_songs++; - break; - } - } - } + auto plays_by_group = wheel->packProgressByGroup.at(GAMESTATE->m_SortOrder); + auto plays_in_group = plays_by_group.find(pWID->m_sText); + if (PREFSMAN->m_bPackProgressInWheel && plays_in_group != plays_by_group.end()) { + int num_played_songs = plays_in_group->second; RageColor color; if (num_played_songs == pWID->m_iSectionCount) {