From 57d2c07c27c4bddb2c7a9595f33a6f4f4e9a0bae Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 20 Jul 2003 08:50:19 +0000 Subject: [PATCH] add SortCoursePointerArrayByType --- stepmania/src/Course.cpp | 11 +++++++++++ stepmania/src/Course.h | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index a76def6c59..af26551407 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -809,6 +809,17 @@ void SortCoursePointerArrayByDifficulty( vector &apCourses ) sort( apCourses.begin(), apCourses.end(), CompareCoursePointersByDifficulty ); } +static bool CompareCoursePointersByType(const Course* pCourse1, const Course* pCourse2) +{ + return pCourse1->GetPlayMode() < pCourse2->GetPlayMode(); +} + + +void SortCoursePointerArrayByType( vector &apCourses ) +{ + stable_sort( apCourses.begin(), apCourses.end(), CompareCoursePointersByType ); +} + bool Course::HasBanner() const { return m_sBannerPath != "" && IsAFile(m_sBannerPath); diff --git a/stepmania/src/Course.h b/stepmania/src/Course.h index 77e02f1dd5..86aeec5500 100644 --- a/stepmania/src/Course.h +++ b/stepmania/src/Course.h @@ -116,6 +116,6 @@ private: void SortCoursePointerArrayByDifficulty( vector &apCourses ); - +void SortCoursePointerArrayByType( vector &apCourses ); #endif