Skip to content

Commit

Permalink
Added the difficulty value to the setgrades message for the pertinent…
Browse files Browse the repository at this point in the history
… high score
  • Loading branch information
Sam Feeney committed Sep 5, 2016
1 parent 366bdf5 commit 362bb59
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions src/MusicWheelItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,40 +345,48 @@ void MusicWheelItem::RefreshGrades()

Profile *pProfile = PROFILEMAN->GetProfile(ps);

HighScoreList *pHSL = NULL;
/* quick hack to make the highest grade for any difficulty show up,
/* Quick hack to make the highest grade for any difficulty show up,
should make optional later, also should make it descend through the
difficulties and stop once a valid grade has been hit - Mina*/
Grade agP;

HighScoreList *pHSL = NULL;
HighScoreList *BestpHSL = NULL;
Difficulty dcBest = Difficulty_Invalid;
if( PROFILEMAN->IsPersistentProfile(ps) && dc != Difficulty_Invalid )
{
if (pWID->m_pSong)
{
FOREACH_ENUM(Difficulty, i) {
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);
Grade ag = pHSL->HighGrade;
agP = min(ag,agP);

if (BestpHSL == NULL)
BestpHSL = pHSL;

if (static_cast<int>(BestpHSL->HighGrade) >= static_cast<int>(pHSL->HighGrade)) {
dcBest = i;
BestpHSL = pHSL;
}
}
}
}


else if( pWID->m_pCourse )
{
const Trail *pTrail = pWID->m_pCourse->GetTrail( st, dc );
if( pTrail != NULL )
pHSL = &pProfile->GetCourseHighScoreList( pWID->m_pCourse, pTrail );
BestpHSL = &pProfile->GetCourseHighScoreList( pWID->m_pCourse, pTrail );
}
}

Message msg( "SetGrade" );
msg.SetParam( "PlayerNumber", p );
if( pHSL )
if( BestpHSL )
{
msg.SetParam( "Grade", agP );
msg.SetParam( "NumTimesPlayed", pHSL->GetNumTimesPlayed() );
msg.SetParam( "Grade", BestpHSL->HighGrade);
msg.SetParam( "Difficulty", DifficultyToString(dcBest));
msg.SetParam( "NumTimesPlayed", BestpHSL->GetNumTimesPlayed() );
}
m_pGradeDisplay[p]->HandleMessage( msg );
}
Expand Down

0 comments on commit 362bb59

Please sign in to comment.