Move best and worst to the end in the average difficulty sort.

This commit is contained in:
Glenn Maynard
2003-08-12 00:18:33 +00:00
parent 1305172793
commit c7e8af1bc9
2 changed files with 32 additions and 0 deletions
+31
View File
@@ -870,6 +870,36 @@ static bool CompareCoursePointersByTotalDifficulty(const Course* pCourse1, const
return CompareCoursePointersByAutogen( pCourse1, pCourse2 );
}
bool Course::CourseHasBestOrWorst() const
{
for(unsigned i = 0; i < m_entries.size(); i++)
{
switch( m_entries[i].type )
{
case COURSE_ENTRY_BEST:
case COURSE_ENTRY_WORST:
return true;
}
}
return false;
}
static bool MovePlayersBestToEnd( const Course* pCourse1, const Course* pCourse2 )
{
bool C1HasBest = pCourse1->CourseHasBestOrWorst();
bool C2HasBest = pCourse2->CourseHasBestOrWorst();
if( !C1HasBest && !C2HasBest )
return false;
if( C1HasBest && !C2HasBest )
return false;
if( !C1HasBest && C2HasBest )
return true;
return pCourse1->m_sName < pCourse2->m_sName;
}
static bool CompareCoursePointersByRanking(const Course* pCourse1, const Course* pCourse2)
{
int iNum1 = pCourse1->SortOrder_Ranking;
@@ -898,6 +928,7 @@ void SortCoursePointerArrayByRanking( vector<Course*> &apCourses )
void SortCoursePointerArrayByAvgDifficulty( vector<Course*> &apCourses )
{
sort( apCourses.begin(), apCourses.end(), CompareCoursePointersByAvgDifficulty );
stable_sort( apCourses.begin(), apCourses.end(), MovePlayersBestToEnd );
}
void SortCoursePointerArrayByTotalDifficulty( vector<Course*> &apCourses )
+1
View File
@@ -108,6 +108,7 @@ public:
int GetEstimatedNumStages() const { return m_entries.size(); }
bool HasDifficult( StepsType nt ) const;
bool IsPlayableIn( StepsType nt ) const;
bool CourseHasBestOrWorst() const;
RageColor GetColor() const;
Difficulty GetDifficulty( const Info &stage ) const;
void GetMeterRange( const Info &stage, int& iMeterLowOut, int& iMeterHighOut ) const;