move code from the header, fix AddHighScore

This commit is contained in:
Glenn Maynard
2003-10-14 22:42:23 +00:00
parent 387d423084
commit 233d456cea
2 changed files with 38 additions and 30 deletions
+36
View File
@@ -320,3 +320,39 @@ void SortNotesArrayByDifficulty( vector<Steps*> &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() );
}
}
+2 -30
View File
@@ -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<HighScore> vHighScores;
void AddHighScore( MemCardData::HighScore hs, int &iIndexOut )
{
for( int i=0; i<(int)vHighScores.size() && i<NUM_RANKING_LINES; i++ )
{
if( hs > 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()
{