diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 1db7df28f7..b65d3a0503 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -383,6 +383,23 @@ void Course::AutogenNonstopFromGroup( CString sGroupName, vector &apSongs m_entries.pop_back(); } +void Course::MemCardData::AddHighScore( HighScore hs, int &iIndexOut ) +{ + int i; + for( i=0; i<(int)vHighScores.size(); i++ ) + { + if( hs > vHighScores[i] ) + break; + } + if( i < NUM_RANKING_LINES ) + { + vHighScores.insert( vHighScores.begin()+i, hs ); + iIndexOut = i; + if( vHighScores.size() > NUM_RANKING_LINES ) + vHighScores.erase( vHighScores.begin()+NUM_RANKING_LINES, vHighScores.end() ); + } +} + /* * Difficult courses do the following: * diff --git a/stepmania/src/Course.h b/stepmania/src/Course.h index 92c3075dd1..80ebe7f707 100644 --- a/stepmania/src/Course.h +++ b/stepmania/src/Course.h @@ -152,27 +152,14 @@ public: fSurviveTime = 0; } - bool operator>( const HighScore& other ) + bool operator>( const HighScore& other ) const { return iScore > other.iScore; } }; vector vHighScores; - void AddHighScore( HighScore hs, int &iIndexOut ) - { - for( int i=0; i<(int)vHighScores.size() && i vHighScores[i] ) - { - vHighScores.insert( vHighScores.begin()+i, hs ); - iIndexOut = i; - break; - } - } - if( vHighScores.size() > NUM_RANKING_LINES ) - vHighScores.erase( vHighScores.begin()+NUM_RANKING_LINES, vHighScores.end() ); - } + void AddHighScore( HighScore hs, int &iIndexOut ); HighScore GetTopScore() { diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 10cd84e089..7dd631002e 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -97,6 +97,23 @@ SongManager::~SongManager() FreeSongs(); } +void SongManager::CategoryData::AddHighScore( HighScore hs, int &iIndexOut ) +{ + int i; + for( i=0; i<(int)vHighScores.size(); i++ ) + { + if( hs > vHighScores[i] ) + break; + } + if( i < NUM_RANKING_LINES ) + { + vHighScores.insert( vHighScores.begin()+i, hs ); + iIndexOut = i; + if( vHighScores.size() > NUM_RANKING_LINES ) + vHighScores.erase( vHighScores.begin()+NUM_RANKING_LINES, vHighScores.end() ); + } +} + void SongManager::Reload() { diff --git a/stepmania/src/SongManager.h b/stepmania/src/SongManager.h index 363b167a7e..d6b60beb15 100644 --- a/stepmania/src/SongManager.h +++ b/stepmania/src/SongManager.h @@ -101,27 +101,14 @@ public: iScore = 0; } - bool operator>( const HighScore& other ) + bool operator>( const HighScore& other ) const { return iScore > other.iScore; } }; vector vHighScores; - void AddHighScore( HighScore hs, int &iIndexOut ) - { - for( int i=0; i<(int)vHighScores.size() && i vHighScores[i] ) - { - vHighScores.insert( vHighScores.begin()+i, hs ); - iIndexOut = i; - break; - } - } - if( vHighScores.size() > NUM_RANKING_LINES ) - vHighScores.erase( vHighScores.begin()+NUM_RANKING_LINES, vHighScores.end() ); - } + void AddHighScore( HighScore hs, int &iIndexOut ); } m_CategoryDatas[NUM_STEPS_TYPES][NUM_RANKING_CATEGORIES];