Skip to content

Commit

Permalink
-finally- display grades using keyed scores without lagging into obli…
Browse files Browse the repository at this point in the history
…vion
  • Loading branch information
MinaciousGrace committed Apr 30, 2017
1 parent c9e4e1f commit e7348fe
Showing 1 changed file with 17 additions and 26 deletions.
43 changes: 17 additions & 26 deletions src/MusicWheelItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ void MusicWheelItem::RefreshGrades()

HighScoreList *pHSL = NULL;
HighScoreList *BestpHSL = NULL;
Grade gradeBest = Grade_Invalid;
Difficulty dcBest = Difficulty_Invalid;
if (uaintnonastypadplayerdog) {
if (PROFILEMAN->IsPersistentProfile(ps) && dc != Difficulty_Invalid)
Expand All @@ -362,25 +363,16 @@ void MusicWheelItem::RefreshGrades()
FOREACH_ENUM_N(Difficulty, 6, i) {
Steps* pSteps = SongUtil::GetStepsByDifficulty(pWID->m_pSong, st, i);
if (pSteps != NULL) {
pHSL = &pProfile->GetStepsHighScoreList(pWID->m_pSong, pSteps);

if (BestpHSL == NULL)
BestpHSL = pHSL;

if (static_cast<int>(BestpHSL->HighGrade) >= static_cast<int>(pHSL->HighGrade)) {
dcBest = i;
BestpHSL = pHSL;
auto& hsv = pProfile->GetScoresByKey(pSteps->ChartKey);
FOREACH(HighScore, hsv, hs) {
if (gradeBest >= hs->GetWifeGrade()) {
dcBest = i;
gradeBest = hs->GetWifeGrade();
}
}
}
}
}

else if (pWID->m_pCourse)
{
const Trail *pTrail = pWID->m_pCourse->GetTrail(st, dc);
if (pTrail != NULL)
BestpHSL = &pProfile->GetCourseHighScoreList(pWID->m_pCourse, pTrail);
}
}
} else {
dcBest = dc;
Expand All @@ -392,27 +384,26 @@ void MusicWheelItem::RefreshGrades()
if (pSteps != nullptr)
BestpHSL = &pProfile->GetStepsHighScoreList(pWID->m_pSong, pSteps);
}
else if (pWID->m_pCourse)
{
const Trail *pTrail = pWID->m_pCourse->GetTrail(st, dc);
if (pTrail != nullptr)
BestpHSL = &pProfile->GetCourseHighScoreList(pWID->m_pCourse, pTrail);
}
}
}


// still needs cleaning up -mina
Message msg( "SetGrade" );
msg.SetParam( "PlayerNumber", p );
if( BestpHSL )
if(gradeBest != Grade_Invalid || BestpHSL)
{
if(pWID->m_pSong->IsFavorited())
msg.SetParam( "Favorited", 1);
if (pWID->m_pSong->HasGoal())
msg.SetParam("HasGoal", 1);
msg.SetParam( "Grade", BestpHSL->HighGrade);
msg.SetParam( "HasGoal", 1);
if (BestpHSL)
msg.SetParam("Grade", BestpHSL->HighGrade);
else
msg.SetParam("Grade", gradeBest);

msg.SetParam( "Difficulty", DifficultyToString(dcBest));
msg.SetParam( "NumTimesPlayed", BestpHSL->GetNumTimesPlayed() );
if (BestpHSL)
msg.SetParam( "NumTimesPlayed", BestpHSL->GetNumTimesPlayed());
}
m_pGradeDisplay[p]->HandleMessage( msg );
}
Expand Down

0 comments on commit e7348fe

Please sign in to comment.