Don't add up actual scores for Courses that aren't installed or aren't shown.

This commit is contained in:
Chris Danford
2006-03-18 12:05:15 +00:00
parent def70f62a1
commit 48a6f0f963
+24 -44
View File
@@ -387,23 +387,31 @@ float Profile::GetSongsPercentComplete( StepsType st, Difficulty dc ) const
return GetSongsActual(st,dc) / GetSongsPossible(st,dc); return GetSongsActual(st,dc) / GetSongsPossible(st,dc);
} }
static GetHighScoreCourses( vector<Course*> &vpCoursesOut )
{
vpCoursesOut.clear();
vector<Course*> vpCourses;
SONGMAN->GetAllCourses( vpCourses, false );
FOREACH_CONST( Course*, vpCourses, c )
{
// Don't count any course that has any entries that change over time.
if( !(*c)->AllSongsAreFixed() )
continue;
vpCoursesOut.push_back( *c );
}
}
float Profile::GetCoursesPossible( StepsType st, CourseDifficulty cd ) const float Profile::GetCoursesPossible( StepsType st, CourseDifficulty cd ) const
{ {
int iTotalTrails = 0; int iTotalTrails = 0;
// add course high scores vector<Course*> vpCourses;
vector<Course*> vCourses; GetHighScoreCourses( vpCourses );
SONGMAN->GetAllCourses( vCourses, false ); FOREACH_CONST( Course*, vpCourses, c )
for( unsigned i=0; i<vCourses.size(); i++ )
{ {
const Course* pCourse = vCourses[i]; Trail* pTrail = (*c)->GetTrail(st,cd);
// Don't count any course that has any entries that change over time.
if( !pCourse->AllSongsAreFixed() )
continue;
Trail* pTrail = pCourse->GetTrail(st,cd);
if( pTrail == NULL ) if( pTrail == NULL )
continue; continue;
@@ -417,45 +425,17 @@ float Profile::GetCoursesActual( StepsType st, CourseDifficulty cd ) const
{ {
float fTotalPercents = 0; float fTotalPercents = 0;
// add course high scores vector<Course*> vpCourses;
FOREACHM_CONST( CourseID, HighScoresForACourse, m_CourseHighScores, i ) GetHighScoreCourses( vpCourses );
FOREACH_CONST( Course*, vpCourses, c )
{ {
CourseID id = i->first; Trail *pTrail = (*c)->GetTrail( st, cd );
const Course* pCourse = id.ToCourse();
// If the Course isn't loaded on the current machine, then we can't
// get radar values to compute dance points.
if( pCourse == NULL )
continue;
// Don't count any course that has any entries that change over time.
if( !pCourse->AllSongsAreFixed() )
continue;
const HighScoresForACourse &hsfac = i->second;
FOREACHM_CONST( TrailID, HighScoresForATrail, hsfac.m_TrailHighScores, j )
{
const TrailID &id = j->first;
Trail* pTrail = id.ToTrail( pCourse, true );
// If the Steps isn't loaded on the current machine, then we can't
// get radar values to compute dance points.
if( pTrail == NULL ) if( pTrail == NULL )
continue; continue;
if( pTrail->m_StepsType != st ) const HighScoreList& hsl = GetCourseHighScoreList( *c, pTrail );
continue;
if( pTrail->m_CourseDifficulty != cd )
continue;
const HighScoresForATrail& h = j->second;
const HighScoreList& hsl = h.hsl;
fTotalPercents += hsl.GetTopScore().GetPercentDP(); fTotalPercents += hsl.GetTopScore().GetPercentDP();
} }
}
return fTotalPercents; return fTotalPercents;
} }