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 -15
View File
@@ -34,26 +34,15 @@ const float FADE_SECONDS = 1.0f;
#define RECT_BACKGROUND CRect(LEFT_EDGE,TOP_EDGE,RIGHT_EDGE,BOTTOM_EDGE)
int CompareBGSegments(const void *arg1, const void *arg2)
int CompareBGSegments(const BGSegment &seg1, const BGSegment &seg2)
{
// arg1 and arg2 are of type Step**
BGSegment* seg1 = (BGSegment*)arg1;
BGSegment* seg2 = (BGSegment*)arg2;
float score1 = seg1->m_fStartBeat;
float score2 = seg2->m_fStartBeat;
if( score1 == score2 )
return 0;
else if( score1 < score2 )
return -1;
else
return 1;
return seg1.m_fStartBeat < seg2.m_fStartBeat;
}
void SortBGSegmentArray( CArray<BGSegment,BGSegment&> &arrayBGSegments )
{
qsort( arrayBGSegments.GetData(), arrayBGSegments.GetSize(), sizeof(BGSegment), CompareBGSegments );
sort( arrayBGSegments.GetData(), arrayBGSegments.GetData()+arrayBGSegments.GetSize(),
CompareBGSegments );
}