HighScoreList& Profile::GetStepsHighScoreList( const Song* pSong, const Steps* pSteps ) { SongID songID; songID.FromSong( pSong ); StepsID stepsID; stepsID.FromSteps( pSteps ); HighScoresForASong &hsSong = m_SongHighScores[songID]; // operator[] inserts into map HighScoresForASteps &hsSteps = hsSong.m_StepsHighScores[stepsID]; // operator[] inserts into map return hsSteps.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 Steps::Decompress() const { if( m_bNoteDataIsFilled ) return; // already decompressed if( parent ) { // get autogen m_pNoteData NoteData notedata; parent->GetNoteData( notedata ); m_bNoteDataIsFilled = true; int iNewTracks = GAMEMAN->GetStepsTypeInfo(m_StepsType).iNumTracks; if( this->m_StepsType == StepsType_lights_cabinet ) { NoteDataUtil::LoadTransformedLights( notedata, *m_pNoteData, iNewTracks ); } else { NoteDataUtil::LoadTransformedSlidingWindow( notedata, *m_pNoteData, iNewTracks ); NoteDataUtil::RemoveStretch( *m_pNoteData, m_StepsType ); } return; } if( !m_sFilename.empty() && m_sNoteDataCompressed.empty() ) { /* We have data on disk and not in memory. Load it. */ Song s; if( !SMLoader::LoadFromSMFile(m_sFilename, s, true) ) { LOG->Warn( "Couldn't load \"%s\"", m_sFilename.c_str() ); return; } /* Find the steps. */ StepsID ID; ID.FromSteps( this ); /* We're using a StepsID to search in a different copy of a Song than * the one it was created with. Clear the cache before doing this, * or search results will come from cache and point to the original * copy. */ CachedObject<Steps>::ClearCacheAll(); Steps *pSteps = ID.ToSteps( &s, true ); if( pSteps == NULL ) { LOG->Warn( "Couldn't find %s in \"%s\"", ID.ToString().c_str(), m_sFilename.c_str() ); return; } pSteps->GetSMNoteData( m_sNoteDataCompressed ); } if( m_sNoteDataCompressed.empty() ) { /* there is no data, do nothing */ } else { // load from compressed bool bComposite = GAMEMAN->GetStepsTypeInfo(m_StepsType).m_StepsTypeCategory == StepsTypeCategory_Routine; m_bNoteDataIsFilled = true; m_pNoteData->SetNumTracks( GAMEMAN->GetStepsTypeInfo(m_StepsType).iNumTracks ); NoteDataUtil::LoadFromSMNoteDataString( *m_pNoteData, m_sNoteDataCompressed, bComposite ); } }