diff --git a/stepmania/src/Steps.cpp b/stepmania/src/Steps.cpp index 317757593b..b9f63298e5 100644 --- a/stepmania/src/Steps.cpp +++ b/stepmania/src/Steps.cpp @@ -320,3 +320,39 @@ void SortNotesArrayByDifficulty( vector &arraySteps ) stable_sort( arraySteps.begin(), arraySteps.end(), CompareNotesPointersByMeter ); stable_sort( arraySteps.begin(), arraySteps.end(), CompareNotesPointersByDifficulty ); } + + + +bool Steps::MemCardData::HighScore::operator>( const Steps::MemCardData::HighScore& other ) const +{ + return fScore > other.fScore; + /* Make sure we treat AAAA as higher than AAA, even though the score + * is the same. + * + * XXX: Isn't it possible to beat the grade but not beat the score, since + * grading and scores are on completely different systems? Should we be + * checking for these completely separately? */ + // if( vsScore > this->fScore ) + // return true; + // if( vsScore < this->fScore ) + // return false; + // return vsGrade > this->grade; +} + +void Steps::MemCardData::AddHighScore( Steps::MemCardData::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() ); + } +} diff --git a/stepmania/src/Steps.h b/stepmania/src/Steps.h index 6329f5798b..870bec26b5 100644 --- a/stepmania/src/Steps.h +++ b/stepmania/src/Steps.h @@ -74,39 +74,11 @@ public: fScore = 0; } - bool operator>( const HighScore& other ) - { - return fScore > other.fScore; - /* Make sure we treat AAAA as higher than AAA, even though the score - * is the same. - * - * XXX: Isn't it possible to beat the grade but not beat the score, since - * grading and scores are on completely different systems? Should we be - * checking for these completely separately? */ - // if( vsScore > this->fScore ) - // return true; - // if( vsScore < this->fScore ) - // return false; - // return vsGrade > this->grade; - } - + bool operator>( const HighScore& other ) const; }; vector vHighScores; - void AddHighScore( MemCardData::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( MemCardData::HighScore hs, int &iIndexOut ); HighScore GetTopScore() {