diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index 522173c2bd..ca1fee77e4 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -102,6 +102,7 @@ void Profile::InitGeneralData() m_iNumSongsPlayedByDifficulty[i] = 0; for( int i=0; iAppendChild( "NumSingleSongsPlayed", m_iNumSingleSongsPlayed ); + { XNode* pNumStagesPassedByPlayMode = pGeneralDataNode->AppendChild("NumStagesPassedByPlayMode"); FOREACH_PlayMode( pm ) @@ -1053,6 +1056,8 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode ) pNumSongsPlayedByMeter->GetChildValue( ssprintf("Meter%d",i), m_iNumSongsPlayedByMeter[i] ); } + pNode->GetChildValue("NumSingleSongsPlayed", m_iNumSingleSongsPlayed ); + { const XNode* pNumStagesPassedByGrade = pNode->GetChild("NumStagesPassedByGrade"); if( pNumStagesPassedByGrade ) diff --git a/stepmania/src/Profile.h b/stepmania/src/Profile.h index f6af3c3f2d..0bbbfe200a 100644 --- a/stepmania/src/Profile.h +++ b/stepmania/src/Profile.h @@ -122,10 +122,14 @@ public: set m_UnlockedSongs; mutable CString m_sLastPlayedMachineGuid; // mutable because we overwrite this on save, and I don't want to remove const from the whole save chain. -Chris mutable DateTime m_LastPlayedDate; + /* These stats count twice in the machine profile if two players are playing; + * that's the only approach that makes sense for ByDifficulty and ByMeter. */ int m_iNumSongsPlayedByPlayMode[NUM_PLAY_MODES]; map m_iNumSongsPlayedByStyle; int m_iNumSongsPlayedByDifficulty[NUM_DIFFICULTIES]; int m_iNumSongsPlayedByMeter[MAX_METER+1]; + /* This stat counts once per song, even if two players are active. */ + int m_iNumSingleSongsPlayed; int m_iNumStagesPassedByPlayMode[NUM_PLAY_MODES]; int m_iNumStagesPassedByGrade[NUM_GRADES]; diff --git a/stepmania/src/StatsManager.cpp b/stepmania/src/StatsManager.cpp index 79d12e207f..178aab4f60 100644 --- a/stepmania/src/StatsManager.cpp +++ b/stepmania/src/StatsManager.cpp @@ -142,6 +142,7 @@ void StatsManager::CommitStatsToProfiles() pMachineProfile->m_iTotalGameplaySeconds += iGameplaySeconds; pMachineProfile->m_iCurrentCombo = 0; + pMachineProfile->m_iNumSingleSongsPlayed += m_CurStageStats.vpSongs.size(); CHECKPOINT; FOREACH_HumanPlayer( pn ) @@ -156,13 +157,13 @@ void StatsManager::CommitStatsToProfiles() PREFSMAN->m_bComboContinuesBetweenSongs ? m_CurStageStats.m_player[pn].iCurCombo : 0; + pPlayerProfile->m_iNumSingleSongsPlayed += m_CurStageStats.vpSongs.size(); } - const StageStats& ss = m_CurStageStats; - AddPlayerStatsToProfile( pMachineProfile, ss, pn ); + AddPlayerStatsToProfile( pMachineProfile, m_CurStageStats, pn ); if( pPlayerProfile ) - AddPlayerStatsToProfile( pPlayerProfile, ss, pn ); + AddPlayerStatsToProfile( pPlayerProfile, m_CurStageStats, pn ); CHECKPOINT; }