From 43b9b6385e29ae40b2760bad69ae08b1c3f97e84 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 20 Jul 2004 23:05:49 +0000 Subject: [PATCH] periodically save profiles --- stepmania/src/GameState.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 74bee22722..e2ba18cc10 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -623,6 +623,7 @@ void GameState::FinishStage() // Increment the stage counter. ASSERT( m_iNumStagesOfThisSong >= 1 && m_iNumStagesOfThisSong <= 3 ); + const int iOldStageIndex = m_iCurrentStageIndex; m_iCurrentStageIndex += m_iNumStagesOfThisSong; m_iNumStagesOfThisSong = 0; @@ -644,6 +645,16 @@ void GameState::FinishStage() int iNumHands = (int) g_CurStageStats.radarActual[pn][RADAR_NUM_HANDS]; PROFILEMAN->AddStepTotals( pn, iNumTapsAndHolds, iNumJumps, iNumHolds, iNumMines, iNumHands ); } + + if( PREFSMAN->m_bEventMode ) + { + const int iSaveProfileEvery = 3; + if( iOldStageIndex/iSaveProfileEvery < m_iCurrentStageIndex/iSaveProfileEvery ) + { + LOG->Trace( "Played %i stages; saving profiles ...", iSaveProfileEvery ); + PROFILEMAN->SaveAllProfiles(); + } + } } int GameState::GetStageIndex() const