Commit stats to profiles before loading ScreenEvaluation.

This commit is contained in:
Glenn Maynard
2005-02-23 19:18:11 +00:00
parent 42c5e2b3f9
commit b46daecd2f
3 changed files with 29 additions and 2 deletions
+21 -2
View File
@@ -204,6 +204,7 @@ void GameState::Reset()
}
m_bTemporaryEventMode = false;
m_bStatsCommitted = false;
LIGHTSMAN->SetLightsMode( LIGHTSMODE_ATTRACT );
@@ -232,7 +233,12 @@ void GameState::JoinPlayer( PlayerNumber pn )
*
* optional: CancelStage() - gameplay aborted (Back pressed), undo BeginStage and back up
*
* CommitStageStats() - gameplay is finished
* Saves STATSMAN->m_CurStageStats to the profiles, so profile information
* is up-to-date for Evaluation.
*
* FinishStage() - gameplay and evaluation is finished
* Clears data which was stored by CommitStageStats.
*
* EndGame() - the game is finished
*
@@ -416,6 +422,16 @@ void GameState::CancelStage()
m_iNumStagesOfThisSong = 0;
}
void GameState::CommitStageStats()
{
/* Don't commit stats twice. */
if( m_bStatsCommitted || m_bDemonstrationOrJukebox )
return;
m_bStatsCommitted = true;
STATSMAN->CommitStatsToProfiles();
}
/* Called by ScreenSelectMusic (etc). Increment the stage counter if we just played a
* song. Might be called more than once. */
void GameState::FinishStage()
@@ -425,6 +441,11 @@ void GameState::FinishStage()
if( m_iNumStagesOfThisSong == 0 )
return;
/* If we havn't committed stats yet, do so. */
CommitStageStats();
m_bStatsCommitted = false;
// Increment the stage counter.
ASSERT( m_iNumStagesOfThisSong >= 1 && m_iNumStagesOfThisSong <= 3 );
const int iOldStageIndex = m_iCurrentStageIndex;
@@ -438,8 +459,6 @@ void GameState::FinishStage()
if( m_bDemonstrationOrJukebox )
return;
STATSMAN->CommitStatsToProfiles();
if( GAMESTATE->GetEventMode() )
{
const int iSaveProfileEvery = 3;
+4
View File
@@ -110,6 +110,7 @@ public:
int GetStageIndex() const;
void BeginStage();
void CancelStage();
void CommitStageStats();
void FinishStage();
int GetNumStagesLeft() const;
bool IsFinalStage() const;
@@ -187,6 +188,9 @@ public:
void ResetStageStatistics(); // Call this when it's time to play a new stage.
// True if CommitStageStats() has been called and FinishStage() hasn't.
bool m_bStatsCommitted;
//
// Options stuff
+4
View File
@@ -180,6 +180,10 @@ void ScreenEvaluation::Init()
{
LOG->Trace( "ScreenEvaluation::Init()" );
/* Commit stats to the profile, so any profile stats displayed on this screen
* include the last game. */
GAMESTATE->CommitStageStats();
Screen::Init();
LIGHTSMAN->SetLightsMode( LIGHTSMODE_MENU );