fix course sort crashes

This commit is contained in:
Glenn Maynard
2004-06-20 16:54:51 +00:00
parent f15212a563
commit 7634898375
2 changed files with 4 additions and 5 deletions
+2 -3
View File
@@ -149,9 +149,8 @@ void CourseUtil::SortCoursePointerArrayByAvgDifficulty( vector<Course*> &apCours
course_sort_val.clear();
for(unsigned i = 0; i < apCourses.size(); ++i)
{
Trail* pTrail = apCourses[i]->GetTrail( GAMESTATE->GetCurrentStyleDef()->m_StepsType );
ASSERT( pTrail ); /* don't give unplayable courses! */
course_sort_val[apCourses[i]] = (float) pTrail->GetMeter();
const Trail* pTrail = apCourses[i]->GetTrail( GAMESTATE->GetCurrentStyleDef()->m_StepsType );
course_sort_val[apCourses[i]] = pTrail != NULL? (float) pTrail->GetMeter(): 0.0f;
}
sort( apCourses.begin(), apCourses.end(), CompareCoursePointersByTitle );
stable_sort( apCourses.begin(), apCourses.end(), CompareCoursePointersBySortValueAscending );