Commit stats to profiles before loading ScreenEvaluation.
This commit is contained in:
@@ -204,6 +204,7 @@ void GameState::Reset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_bTemporaryEventMode = false;
|
m_bTemporaryEventMode = false;
|
||||||
|
m_bStatsCommitted = false;
|
||||||
|
|
||||||
LIGHTSMAN->SetLightsMode( LIGHTSMODE_ATTRACT );
|
LIGHTSMAN->SetLightsMode( LIGHTSMODE_ATTRACT );
|
||||||
|
|
||||||
@@ -232,7 +233,12 @@ void GameState::JoinPlayer( PlayerNumber pn )
|
|||||||
*
|
*
|
||||||
* optional: CancelStage() - gameplay aborted (Back pressed), undo BeginStage and back up
|
* 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
|
* FinishStage() - gameplay and evaluation is finished
|
||||||
|
* Clears data which was stored by CommitStageStats.
|
||||||
*
|
*
|
||||||
* EndGame() - the game is finished
|
* EndGame() - the game is finished
|
||||||
*
|
*
|
||||||
@@ -416,6 +422,16 @@ void GameState::CancelStage()
|
|||||||
m_iNumStagesOfThisSong = 0;
|
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
|
/* Called by ScreenSelectMusic (etc). Increment the stage counter if we just played a
|
||||||
* song. Might be called more than once. */
|
* song. Might be called more than once. */
|
||||||
void GameState::FinishStage()
|
void GameState::FinishStage()
|
||||||
@@ -425,6 +441,11 @@ void GameState::FinishStage()
|
|||||||
if( m_iNumStagesOfThisSong == 0 )
|
if( m_iNumStagesOfThisSong == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* If we havn't committed stats yet, do so. */
|
||||||
|
CommitStageStats();
|
||||||
|
|
||||||
|
m_bStatsCommitted = false;
|
||||||
|
|
||||||
// Increment the stage counter.
|
// Increment the stage counter.
|
||||||
ASSERT( m_iNumStagesOfThisSong >= 1 && m_iNumStagesOfThisSong <= 3 );
|
ASSERT( m_iNumStagesOfThisSong >= 1 && m_iNumStagesOfThisSong <= 3 );
|
||||||
const int iOldStageIndex = m_iCurrentStageIndex;
|
const int iOldStageIndex = m_iCurrentStageIndex;
|
||||||
@@ -438,8 +459,6 @@ void GameState::FinishStage()
|
|||||||
if( m_bDemonstrationOrJukebox )
|
if( m_bDemonstrationOrJukebox )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
STATSMAN->CommitStatsToProfiles();
|
|
||||||
|
|
||||||
if( GAMESTATE->GetEventMode() )
|
if( GAMESTATE->GetEventMode() )
|
||||||
{
|
{
|
||||||
const int iSaveProfileEvery = 3;
|
const int iSaveProfileEvery = 3;
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ public:
|
|||||||
int GetStageIndex() const;
|
int GetStageIndex() const;
|
||||||
void BeginStage();
|
void BeginStage();
|
||||||
void CancelStage();
|
void CancelStage();
|
||||||
|
void CommitStageStats();
|
||||||
void FinishStage();
|
void FinishStage();
|
||||||
int GetNumStagesLeft() const;
|
int GetNumStagesLeft() const;
|
||||||
bool IsFinalStage() const;
|
bool IsFinalStage() const;
|
||||||
@@ -187,6 +188,9 @@ public:
|
|||||||
|
|
||||||
void ResetStageStatistics(); // Call this when it's time to play a new stage.
|
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
|
// Options stuff
|
||||||
|
|||||||
@@ -180,6 +180,10 @@ void ScreenEvaluation::Init()
|
|||||||
{
|
{
|
||||||
LOG->Trace( "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();
|
Screen::Init();
|
||||||
|
|
||||||
LIGHTSMAN->SetLightsMode( LIGHTSMODE_MENU );
|
LIGHTSMAN->SetLightsMode( LIGHTSMODE_MENU );
|
||||||
|
|||||||
Reference in New Issue
Block a user