int Profile::GetCourseNumTimesPlayed( const Course* pCourse ) const { CourseID courseID; courseID.FromCourse( pCourse ); return GetCourseNumTimesPlayed( courseID ); }
HighScoreList& Profile::GetCourseHighScoreList( const Course* pCourse, const Trail* pTrail ) { CourseID courseID; courseID.FromCourse( pCourse ); TrailID trailID; trailID.FromTrail( pTrail ); HighScoresForACourse &hsCourse = m_CourseHighScores[courseID]; // operator[] inserts into map HighScoresForATrail &hsTrail = hsCourse.m_TrailHighScores[trailID]; // operator[] inserts into map return hsTrail.hs; }
XNode* MakeRecentScoreNode( const StageStats &ss, Trail *pTrail, const PlayerStageStats &pss, MultiPlayer mp ) { XNode* pNode = nullptr; if( GAMESTATE->IsCourseMode() ) { pNode = new XNode( "HighScoreForACourseAndTrail" ); CourseID courseID; courseID.FromCourse(GAMESTATE->m_pCurCourse ); pNode->AppendChild( courseID.CreateNode() ); TrailID trailID; trailID.FromTrail( pTrail ); pNode->AppendChild( trailID.CreateNode() ); } else { pNode = new XNode( "HighScoreForASongAndSteps" ); SongID songID; songID.FromSong( ss.m_vpPossibleSongs[0] ); pNode->AppendChild( songID.CreateNode() ); StepsID stepsID; stepsID.FromSteps( pss.m_vpPossibleSteps[0] ); pNode->AppendChild( stepsID.CreateNode() ); } XNode* pHighScore = pss.m_HighScore.CreateNode(); pHighScore->AppendChild("Pad", mp); pHighScore->AppendChild("StageGuid", GAMESTATE->m_sStageGUID); pHighScore->AppendChild("Guid", CryptManager::GenerateRandomUUID()); pNode->AppendChild( pHighScore ); return pNode; }
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() ); }