fix course sort crashes
This commit is contained in:
@@ -1008,9 +1008,9 @@ void Course::UpdateCourseStats( StepsType st )
|
||||
return;
|
||||
}
|
||||
|
||||
Trail* pTrail = GetTrail( st, DIFFICULTY_MEDIUM );
|
||||
const Trail* pTrail = GetTrail( st, DIFFICULTY_MEDIUM );
|
||||
|
||||
m_SortOrder_TotalDifficulty += pTrail->GetTotalMeter();
|
||||
m_SortOrder_TotalDifficulty += pTrail != NULL? pTrail->GetTotalMeter():0;
|
||||
|
||||
// OPTIMIZATION: Ranking info isn't dependant on style, so
|
||||
// call it sparingly. Its handled on startup and when
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user