float Profile::GetCoursesActual( StepsType st, CourseDifficulty cd ) const { float fTotalPercents = 0; // add course high scores for( std::map<CourseID,HighScoresForACourse>::const_iterator i = m_CourseHighScores.begin(); i != m_CourseHighScores.end(); i++ ) { CourseID id = i->first; 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; for( std::map<TrailID,HighScoresForATrail>::const_iterator j = hsfac.m_TrailHighScores.begin(); j != hsfac.m_TrailHighScores.end(); ++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 ) continue; if( pTrail->m_StepsType != st ) continue; if( pTrail->m_CourseDifficulty != cd ) continue; const HighScoresForATrail& h = j->second; const HighScoreList& hs = h.hs; fTotalPercents += hs.GetTopScore().fPercentDP; } } return fTotalPercents; }
void ScreenOptionsManageCourses::BeginScreen() { vector<const Style*> vpStyles; GAMEMAN->GetStylesForGame( GAMESTATE->m_pCurGame, vpStyles ); const Style *pStyle = vpStyles[0]; GAMESTATE->SetCurrentStyle( pStyle, PLAYER_INVALID ); if( GAMESTATE->m_stEdit == StepsType_Invalid || GAMESTATE->m_cdEdit == Difficulty_Invalid ) { SetNextCombination(); } // Remember the current course. All Course pointers will be invalidated when // we load the machine profile below. CourseID cidLast; cidLast.FromCourse( GAMESTATE->m_pCurCourse ); vector<OptionRowHandler*> vHands; int iIndex = 0; { vHands.push_back( OptionRowHandlerUtil::MakeNull() ); OptionRowDefinition &def = vHands.back()->m_Def; def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW; def.m_bOneChoiceForAllPlayers = true; def.m_sName = "Create New Course"; def.m_sExplanationName = "Create New Course"; def.m_vsChoices.clear(); def.m_vsChoices.push_back( "" ); iIndex++; } m_vpCourses.clear(); // XXX: Why are we flushing here? FILEMAN->FlushDirCache(); PROFILEMAN->LoadMachineProfileEdits(); switch( EDIT_MODE.GetValue() ) { DEFAULT_FAIL( EDIT_MODE.GetValue() ); case EditMode_Home: EditCourseUtil::GetAllEditCourses( m_vpCourses ); break; case EditMode_Practice: case EditMode_Full: SONGMAN->GetAllCourses( m_vpCourses, false ); break; } for (auto *p: m_vpCourses) { vHands.push_back( OptionRowHandlerUtil::MakeNull() ); OptionRowDefinition &def = vHands.back()->m_Def; def.m_sName = p->GetDisplayFullTitle(); def.m_bAllowThemeTitle = false; // not themable def.m_sExplanationName = "Select Course"; def.m_vsChoices.clear(); def.m_vsChoices.push_back( "" ); def.m_bAllowThemeItems = false; // already themed iIndex++; } ScreenOptions::InitMenu( vHands ); ScreenOptions::BeginScreen(); // select the last chosen course GAMESTATE->m_pCurCourse.Set( cidLast.ToCourse() ); if( GAMESTATE->m_pCurCourse ) { EditCourseUtil::UpdateAndSetTrail(); vector<Course*>::const_iterator iter = find( m_vpCourses.begin(), m_vpCourses.end(), GAMESTATE->m_pCurCourse ); if( iter != m_vpCourses.end() ) { iIndex = iter - m_vpCourses.begin(); this->MoveRowAbsolute( GAMESTATE->GetMasterPlayerNumber(), 1 + iIndex ); } } AfterChangeRow( GAMESTATE->GetMasterPlayerNumber() ); }