diff --git a/stepmania/src/MusicWheelItem.cpp b/stepmania/src/MusicWheelItem.cpp index 8880bc815a..f5d4ed3c54 100644 --- a/stepmania/src/MusicWheelItem.cpp +++ b/stepmania/src/MusicWheelItem.cpp @@ -272,7 +272,8 @@ void MusicWheelItem::LoadFromWheelItemData( const WheelItemBaseData *pWIBD, int this->HandleMessage( msg ); } } - +#include "Style.h" +#include "Profile.h" void MusicWheelItem::RefreshGrades() { if( data == NULL ) @@ -301,14 +302,34 @@ void MusicWheelItem::RefreshGrades() continue; m_pGradeDisplay[p]->SetVisible( true ); - Grade g; - if( data->m_pSong ) - g = PROFILEMAN->GetGradeForSteps( data->m_pSong, GAMESTATE->GetCurrentStyle(), ps, dc ); - else - g = PROFILEMAN->GetGradeForTrail( data->m_pCourse, GAMESTATE->GetCurrentStyle(), ps, dc ); + + + Profile *pProfile = PROFILEMAN->GetProfile(ps); + + HighScoreList *pHSL = NULL; + if( PROFILEMAN->IsPersistentProfile(ps) ) + { + if( data->m_pSong ) + { + const Steps* pSteps = SongUtil::GetStepsByDifficulty( data->m_pSong, GAMESTATE->GetCurrentStyle()->m_StepsType, dc ); + if( pSteps != NULL ) + pHSL = &pProfile->GetStepsHighScoreList(data->m_pSong, pSteps); + } + else if( data->m_pCourse ) + { + const Trail *pTrail = data->m_pCourse->GetTrail( GAMESTATE->GetCurrentStyle()->m_StepsType, dc ); + if( pTrail != NULL ) + pHSL = &pProfile->GetCourseHighScoreList( data->m_pCourse, pTrail ); + } + } + Message msg( "SetGrade" ); msg.SetParam( "PlayerNumber", p ); - msg.SetParam( "Grade", g ); + if( pHSL ) + { + msg.SetParam( "Grade", pHSL->HighGrade ); + msg.SetParam( "NumTimesPlayed", pHSL->GetNumTimesPlayed() ); + } m_pGradeDisplay[p]->HandleMessage( msg ); } } diff --git a/stepmania/src/ProfileManager.cpp b/stepmania/src/ProfileManager.cpp index 192e301787..710aa8abaf 100644 --- a/stepmania/src/ProfileManager.cpp +++ b/stepmania/src/ProfileManager.cpp @@ -678,24 +678,6 @@ void ProfileManager::IncrementStepsPlayCount( const Song* pSong, const Steps* pS GetMachineProfile()->IncrementStepsPlayCount( pSong, pSteps ); } -Grade ProfileManager::GetGradeForSteps( const Song *pSong, const Style *st, ProfileSlot slot, Difficulty dc ) const -{ - const Steps* pSteps = SongUtil::GetStepsByDifficulty( pSong, st->m_StepsType, dc ); - - if( pSteps == NULL || !IsPersistentProfile(slot) ) - return Grade_NoData; - return GetProfile(slot)->GetStepsHighScoreList(pSong, pSteps).HighGrade; -} - -Grade ProfileManager::GetGradeForTrail( const Course *pCourse, const Style *st, ProfileSlot slot, Difficulty dc ) const -{ - const Trail *pTrail = pCourse->GetTrail( st->m_StepsType, dc ); - - if( pTrail == NULL || !IsPersistentProfile(slot) ) - return Grade_NoData; - return GetProfile( slot )->GetCourseHighScoreList( pCourse, pTrail ).HighGrade; -} - // // Course stats // diff --git a/stepmania/src/ProfileManager.h b/stepmania/src/ProfileManager.h index 2680a570c2..211d770528 100644 --- a/stepmania/src/ProfileManager.h +++ b/stepmania/src/ProfileManager.h @@ -94,14 +94,13 @@ public: bool IsSongNew( const Song* pSong ) const { return GetSongNumTimesPlayed(pSong,ProfileSlot_Machine)==0; } void AddStepsScore( const Song* pSong, const Steps* pSteps , PlayerNumber pn, const HighScore &hs, int &iPersonalIndexOut, int &iMachineIndexOut ); void IncrementStepsPlayCount( const Song* pSong, const Steps* pSteps, PlayerNumber pn ); - Grade GetGradeForSteps( const Song *s, const Style *st, ProfileSlot slot, Difficulty dc ) const; // // Course stats // void AddCourseScore( const Course* pCourse, const Trail* pTrail, PlayerNumber pn, const HighScore &hs, int &iPersonalIndexOut, int &iMachineIndexOut ); void IncrementCoursePlayCount( const Course* pCourse, const Trail* pTrail, PlayerNumber pn ); - Grade GetGradeForTrail( const Course *pCourse, const Style *st, ProfileSlot slot, Difficulty dc ) const; + // // Category stats //