From aba80edfe10e44194ad14aca2c7488906d437e17 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Sun, 7 Jan 2018 02:54:34 -0300 Subject: [PATCH] Display best grade of all for songs without current style steps in autosetstyle --- src/MusicWheelItem.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/MusicWheelItem.cpp b/src/MusicWheelItem.cpp index db37392b6c..9b62dfd5fe 100644 --- a/src/MusicWheelItem.cpp +++ b/src/MusicWheelItem.cpp @@ -334,9 +334,11 @@ void MusicWheelItem::RefreshGrades() Difficulty dcBest = Difficulty_Invalid; if (PROFILEMAN->IsPersistentProfile(ps) && dc != Difficulty_Invalid) { if (pWID->m_pSong) { + bool hasCurrentStyleSteps = false; FOREACH_ENUM_N(Difficulty, 6, i) { Steps* pSteps = SongUtil::GetStepsByDifficulty(pWID->m_pSong, st, i); if (pSteps != NULL) { + hasCurrentStyleSteps = true; Grade dcg = SCOREMAN->GetBestGradeFor(pSteps->GetChartKey()); if (gradeBest >= dcg) { dcBest = i; @@ -344,6 +346,20 @@ void MusicWheelItem::RefreshGrades() } } } + //If no grade was found for the current style/stepstype + if (!hasCurrentStyleSteps) { + //Get the best grade among all steps + auto& allSteps = pWID->m_pSong->GetAllSteps(); + for (auto& stepsPtr : allSteps) { + if (stepsPtr->m_StepsType == st) //Skip already checked steps of type st + continue; + Grade dcg = SCOREMAN->GetBestGradeFor(stepsPtr->GetChartKey()); + if (gradeBest >= dcg) { + dcBest = stepsPtr->GetDifficulty(); + gradeBest = dcg; + } + } + } } }