change more qsorts to sort

This commit is contained in:
Glenn Maynard
2002-10-24 08:17:09 +00:00
parent ce38b44c59
commit 738617a01b
7 changed files with 37 additions and 88 deletions
+4 -14
View File
@@ -260,23 +260,13 @@ void Course::GetSongOptions( SongOptions* pSO_out )
// Sorting stuff
//
int CompareCoursePointersByDifficulty(const void *arg1, const void *arg2)
static int CompareCoursePointersByDifficulty(const Course* pCourse1, const Course* pCourse2)
{
Course* pCourse1 = *(Course**)arg1;
Course* pCourse2 = *(Course**)arg2;
float fScore1 = (float)pCourse1->m_iStages;
float fScore2 = (float)pCourse2->m_iStages;
if( fScore1 < fScore2 )
return -1;
else if( fScore1 == fScore2 )
return 0;
else
return 1;
return pCourse1->m_iStages < pCourse2->m_iStages;
}
void SortCoursePointerArrayByDifficulty( CArray<Course*,Course*> &apCourses )
{
qsort( apCourses.GetData(), apCourses.GetSize(), sizeof(Course*), CompareCoursePointersByDifficulty );
sort( apCourses.GetData(), apCourses.GetData()+apCourses.GetSize(),
CompareCoursePointersByDifficulty );
}