From e5a3e634d5e48414667e020076f4d8144047e44d Mon Sep 17 00:00:00 2001 From: Andrew Wong Date: Mon, 4 Aug 2003 06:35:54 +0000 Subject: [PATCH] minor optimization: compare if a song is in ranking for UpdateCourseStats if ranking is chosen in prefs --- stepmania/src/Course.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 406df0071c..288f6f4f80 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -922,19 +922,24 @@ void Course::UpdateCourseStats() SortOrder_TotalDifficulty = 999999; // large number return; } - SortOrder_TotalDifficulty += ci[i].pNotes->GetMeter(); } SortOrder_AvgDifficulty = (float)SortOrder_TotalDifficulty/GetEstimatedNumStages(); if (GetEstimatedNumStages() > 7) SortOrder_Ranking = 3; - CStringArray RankingCourses; + // HACK: this function takes a while to execute because of + // the ranking portion at the end. Do so only if it is + // absolutely necessary. + if (PREFSMAN->m_iCourseSortOrder == PrefsManager::COURSE_SORT_RANK) + { + CStringArray RankingCourses; - split( THEME->GetMetric("ScreenRanking","CoursesToShow"),",", RankingCourses); + split( THEME->GetMetric("ScreenRanking","CoursesToShow"),",", RankingCourses); - for(i = 0; i < RankingCourses.size(); i++) - if (!RankingCourses[i].CompareNoCase(this->m_sPath)) - SortOrder_Ranking = 1; + for(i = 0; i < RankingCourses.size(); i++) + if (!RankingCourses[i].CompareNoCase(this->m_sPath)) + SortOrder_Ranking = 1; + } } \ No newline at end of file