don't save awards in Profile. This info isn't used anywhere and won't be anytime soon.
This commit is contained in:
@@ -135,20 +135,6 @@ void Profile::InitCalorieData()
|
|||||||
m_mapDayToCaloriesBurned.clear();
|
m_mapDayToCaloriesBurned.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profile::InitAwards()
|
|
||||||
{
|
|
||||||
FOREACH_StepsType( st )
|
|
||||||
{
|
|
||||||
FOREACH_Difficulty( dc )
|
|
||||||
FOREACH_PerDifficultyAward( pda )
|
|
||||||
m_PerDifficultyAwards[st][dc][pda].Unset();
|
|
||||||
}
|
|
||||||
FOREACH_PeakComboAward( pca )
|
|
||||||
{
|
|
||||||
m_PeakComboAwards[pca].Unset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Profile::InitRecentSongScores()
|
void Profile::InitRecentSongScores()
|
||||||
{
|
{
|
||||||
m_vRecentStepsScores.clear();
|
m_vRecentStepsScores.clear();
|
||||||
@@ -632,7 +618,6 @@ bool Profile::LoadAllFromDir( CString sDir, bool bRequireSignature )
|
|||||||
LOAD_NODE( CategoryScores );
|
LOAD_NODE( CategoryScores );
|
||||||
LOAD_NODE( ScreenshotData );
|
LOAD_NODE( ScreenshotData );
|
||||||
LOAD_NODE( CalorieData );
|
LOAD_NODE( CalorieData );
|
||||||
LOAD_NODE( Awards );
|
|
||||||
LOAD_NODE( RecentSongScores );
|
LOAD_NODE( RecentSongScores );
|
||||||
LOAD_NODE( RecentCourseScores );
|
LOAD_NODE( RecentCourseScores );
|
||||||
}
|
}
|
||||||
@@ -660,7 +645,6 @@ bool Profile::SaveAllToDir( CString sDir, bool bSignData ) const
|
|||||||
xml.AppendChild( SaveCategoryScoresCreateNode() );
|
xml.AppendChild( SaveCategoryScoresCreateNode() );
|
||||||
xml.AppendChild( SaveScreenshotDataCreateNode() );
|
xml.AppendChild( SaveScreenshotDataCreateNode() );
|
||||||
xml.AppendChild( SaveCalorieDataCreateNode() );
|
xml.AppendChild( SaveCalorieDataCreateNode() );
|
||||||
xml.AppendChild( SaveAwardsCreateNode() );
|
|
||||||
xml.AppendChild( SaveRecentSongScoresCreateNode() );
|
xml.AppendChild( SaveRecentSongScoresCreateNode() );
|
||||||
xml.AppendChild( SaveRecentCourseScoresCreateNode() );
|
xml.AppendChild( SaveRecentCourseScoresCreateNode() );
|
||||||
|
|
||||||
@@ -1335,158 +1319,6 @@ float Profile::GetCaloriesBurnedForDay( DateTime day ) const
|
|||||||
return i->second;
|
return i->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
XNode* Profile::AwardRecord::CreateNode() const
|
|
||||||
{
|
|
||||||
XNode* pNode = new XNode;
|
|
||||||
pNode->name = "AwardRecord";
|
|
||||||
|
|
||||||
pNode->AppendChild( "FirstTime", int(first) );
|
|
||||||
pNode->AppendChild( "LastTime", int(last) );
|
|
||||||
pNode->AppendChild( "Count", iCount );
|
|
||||||
|
|
||||||
return pNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Profile::AwardRecord::LoadFromNode( const XNode* pNode )
|
|
||||||
{
|
|
||||||
Unset();
|
|
||||||
|
|
||||||
ASSERT( pNode->name == "AwardRecord" );
|
|
||||||
pNode->GetChildValue( "FirstTime", (int&)first ); // time_t is a signed long in Win32. Is this OK on other platforms?
|
|
||||||
pNode->GetChildValue( "LastTime", (int&)last );
|
|
||||||
pNode->GetChildValue( "Count", iCount );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Profile::LoadAwardsFromNode( const XNode* pNode )
|
|
||||||
{
|
|
||||||
CHECKPOINT;
|
|
||||||
|
|
||||||
ASSERT( pNode->name == "Awards" );
|
|
||||||
for( XNodes::const_iterator pAward = pNode->childs.begin();
|
|
||||||
pAward != pNode->childs.end();
|
|
||||||
pAward++ )
|
|
||||||
{
|
|
||||||
if( (*pAward)->name == "PerDifficultyAward" )
|
|
||||||
{
|
|
||||||
CString sStepsType;
|
|
||||||
if( !(*pAward)->GetAttrValue( "StepsType", sStepsType ) )
|
|
||||||
WARN_AND_CONTINUE;
|
|
||||||
StepsType st = GameManager::StringToStepsType( sStepsType );
|
|
||||||
if( st == STEPS_TYPE_INVALID )
|
|
||||||
WARN_AND_CONTINUE;
|
|
||||||
|
|
||||||
CString sDifficulty;
|
|
||||||
if( !(*pAward)->GetAttrValue( "Difficulty", sDifficulty ) )
|
|
||||||
WARN_AND_CONTINUE;
|
|
||||||
Difficulty dc = StringToDifficulty( sDifficulty );
|
|
||||||
if( dc == DIFFICULTY_INVALID )
|
|
||||||
WARN_AND_CONTINUE;
|
|
||||||
|
|
||||||
CString sPerDifficultyAward;
|
|
||||||
if( !(*pAward)->GetAttrValue( "PerDifficultyAward", sPerDifficultyAward ) )
|
|
||||||
WARN_AND_CONTINUE;
|
|
||||||
PerDifficultyAward pda = StringToPerDifficultyAward( sPerDifficultyAward );
|
|
||||||
if( pda == PER_DIFFICULTY_AWARD_INVALID )
|
|
||||||
WARN_AND_CONTINUE;
|
|
||||||
|
|
||||||
AwardRecord &ar = m_PerDifficultyAwards[st][dc][pda];
|
|
||||||
|
|
||||||
XNode* pAwardRecord = (*pAward)->GetChild("AwardRecord");
|
|
||||||
if( pAwardRecord == NULL )
|
|
||||||
WARN_AND_CONTINUE;
|
|
||||||
|
|
||||||
ar.LoadFromNode( pAwardRecord );
|
|
||||||
}
|
|
||||||
else if( (*pAward)->name == "PeakComboAward" )
|
|
||||||
{
|
|
||||||
CString sPeakComboAward;
|
|
||||||
if( !(*pAward)->GetAttrValue( "PeakComboAward", sPeakComboAward ) )
|
|
||||||
WARN_AND_CONTINUE;
|
|
||||||
PeakComboAward pca = StringToPeakComboAward( sPeakComboAward );
|
|
||||||
if( pca == PEAK_COMBO_AWARD_INVALID )
|
|
||||||
WARN_AND_CONTINUE;
|
|
||||||
|
|
||||||
AwardRecord &ar = m_PeakComboAwards[pca];
|
|
||||||
|
|
||||||
XNode* pAwardRecord = (*pAward)->GetChild("AwardRecord");
|
|
||||||
if( pAwardRecord == NULL )
|
|
||||||
WARN_AND_CONTINUE;
|
|
||||||
|
|
||||||
ar.LoadFromNode( pAwardRecord );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
WARN_AND_CONTINUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
XNode* Profile::SaveAwardsCreateNode() const
|
|
||||||
{
|
|
||||||
CHECKPOINT;
|
|
||||||
|
|
||||||
const Profile* pProfile = this;
|
|
||||||
ASSERT( pProfile );
|
|
||||||
|
|
||||||
XNode* pNode = new XNode;
|
|
||||||
pNode->name = "Awards";
|
|
||||||
|
|
||||||
FOREACH_StepsType( st )
|
|
||||||
{
|
|
||||||
FOREACH_Difficulty( dc )
|
|
||||||
{
|
|
||||||
FOREACH_PerDifficultyAward( pda )
|
|
||||||
{
|
|
||||||
const AwardRecord &ar = m_PerDifficultyAwards[st][dc][pda];
|
|
||||||
if( !ar.IsSet() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
XNode* pAward = pNode->AppendChild( "PerDifficultyAward" );
|
|
||||||
|
|
||||||
pAward->AppendAttr( "StepsType", GameManager::StepsTypeToString(st) );
|
|
||||||
pAward->AppendAttr( "Difficulty", DifficultyToString(dc) );
|
|
||||||
pAward->AppendAttr( "PerDifficultyAward", PerDifficultyAwardToString(pda) );
|
|
||||||
|
|
||||||
pAward->AppendChild( ar.CreateNode() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FOREACH_PeakComboAward( pca )
|
|
||||||
{
|
|
||||||
const AwardRecord &ar = m_PeakComboAwards[pca];
|
|
||||||
if( !ar.IsSet() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
XNode* pAward = pNode->AppendChild( "PeakComboAward" );
|
|
||||||
|
|
||||||
pAward->AppendAttr( "PeakComboAward", PeakComboAwardToString(pca) );
|
|
||||||
|
|
||||||
pAward->AppendChild( ar.CreateNode() );
|
|
||||||
}
|
|
||||||
|
|
||||||
return pNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Profile::AddPerDifficultyAward( StepsType st, Difficulty dc, PerDifficultyAward pda )
|
|
||||||
{
|
|
||||||
m_PerDifficultyAwards[st][dc][pda].Set( time(NULL) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Profile::AddPeakComboAward( PeakComboAward pca )
|
|
||||||
{
|
|
||||||
m_PeakComboAwards[pca].Set( time(NULL) );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Profile::HasPerDifficultyAward( StepsType st, Difficulty dc, PerDifficultyAward pda )
|
|
||||||
{
|
|
||||||
return m_PerDifficultyAwards[st][dc][pda].IsSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Profile::HasPeakComboAward( PeakComboAward pca )
|
|
||||||
{
|
|
||||||
return m_PeakComboAwards[pca].IsSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
XNode* Profile::HighScoreForASongAndSteps::CreateNode() const
|
XNode* Profile::HighScoreForASongAndSteps::CreateNode() const
|
||||||
{
|
{
|
||||||
XNode* pNode = new XNode;
|
XNode* pNode = new XNode;
|
||||||
|
|||||||
@@ -191,30 +191,6 @@ public:
|
|||||||
map<DateTime,float> m_mapDayToCaloriesBurned;
|
map<DateTime,float> m_mapDayToCaloriesBurned;
|
||||||
float GetCaloriesBurnedForDay( DateTime day ) const;
|
float GetCaloriesBurnedForDay( DateTime day ) const;
|
||||||
|
|
||||||
//
|
|
||||||
// Awards
|
|
||||||
//
|
|
||||||
struct AwardRecord
|
|
||||||
{
|
|
||||||
time_t first;
|
|
||||||
time_t last;
|
|
||||||
int iCount; // num times achieved
|
|
||||||
|
|
||||||
AwardRecord() { Unset(); }
|
|
||||||
|
|
||||||
bool IsSet() const { return iCount>0; }
|
|
||||||
void Set(time_t t) { if (iCount==0) first = t; last = t; iCount++; }
|
|
||||||
void Unset() { iCount = 0; first = -1; last = -1; }
|
|
||||||
|
|
||||||
XNode* CreateNode() const;
|
|
||||||
void LoadFromNode( const XNode* pNode );
|
|
||||||
};
|
|
||||||
AwardRecord m_PerDifficultyAwards[NUM_STEPS_TYPES][NUM_DIFFICULTIES][NUM_PER_DIFFICULTY_AWARDS];
|
|
||||||
AwardRecord m_PeakComboAwards[NUM_PEAK_COMBO_AWARDS];
|
|
||||||
void AddPerDifficultyAward( StepsType st, Difficulty dc, PerDifficultyAward pda );
|
|
||||||
void AddPeakComboAward( PeakComboAward pca );
|
|
||||||
bool HasPerDifficultyAward( StepsType st, Difficulty dc, PerDifficultyAward pda );
|
|
||||||
bool HasPeakComboAward( PeakComboAward pca );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// RecentSongScores
|
// RecentSongScores
|
||||||
@@ -264,7 +240,6 @@ public:
|
|||||||
InitCategoryScores();
|
InitCategoryScores();
|
||||||
InitScreenshotData();
|
InitScreenshotData();
|
||||||
InitCalorieData();
|
InitCalorieData();
|
||||||
InitAwards();
|
|
||||||
InitRecentSongScores();
|
InitRecentSongScores();
|
||||||
InitRecentCourseScores();
|
InitRecentCourseScores();
|
||||||
}
|
}
|
||||||
@@ -275,7 +250,6 @@ public:
|
|||||||
void InitCategoryScores();
|
void InitCategoryScores();
|
||||||
void InitScreenshotData();
|
void InitScreenshotData();
|
||||||
void InitCalorieData();
|
void InitCalorieData();
|
||||||
void InitAwards();
|
|
||||||
void InitRecentSongScores();
|
void InitRecentSongScores();
|
||||||
void InitRecentCourseScores();
|
void InitRecentCourseScores();
|
||||||
|
|
||||||
@@ -292,7 +266,6 @@ public:
|
|||||||
void LoadCategoryScoresFromNode( const XNode* pNode );
|
void LoadCategoryScoresFromNode( const XNode* pNode );
|
||||||
void LoadScreenshotDataFromNode( const XNode* pNode );
|
void LoadScreenshotDataFromNode( const XNode* pNode );
|
||||||
void LoadCalorieDataFromNode( const XNode* pNode );
|
void LoadCalorieDataFromNode( const XNode* pNode );
|
||||||
void LoadAwardsFromNode( const XNode* pNode );
|
|
||||||
void LoadRecentSongScoresFromNode( const XNode* pNode );
|
void LoadRecentSongScoresFromNode( const XNode* pNode );
|
||||||
void LoadRecentCourseScoresFromNode( const XNode* pNode );
|
void LoadRecentCourseScoresFromNode( const XNode* pNode );
|
||||||
|
|
||||||
@@ -303,7 +276,6 @@ public:
|
|||||||
XNode* SaveCategoryScoresCreateNode() const;
|
XNode* SaveCategoryScoresCreateNode() const;
|
||||||
XNode* SaveScreenshotDataCreateNode() const;
|
XNode* SaveScreenshotDataCreateNode() const;
|
||||||
XNode* SaveCalorieDataCreateNode() const;
|
XNode* SaveCalorieDataCreateNode() const;
|
||||||
XNode* SaveAwardsCreateNode() const;
|
|
||||||
XNode* SaveRecentSongScoresCreateNode() const;
|
XNode* SaveRecentSongScoresCreateNode() const;
|
||||||
XNode* SaveRecentCourseScoresCreateNode() const;
|
XNode* SaveRecentCourseScoresCreateNode() const;
|
||||||
|
|
||||||
|
|||||||
@@ -1111,52 +1111,6 @@ void ScreenEvaluation::CommitScores(
|
|||||||
pcaToShowOut[p] = GAMESTATE->m_vLastPeakComboAwards[p].back();
|
pcaToShowOut[p] = GAMESTATE->m_vLastPeakComboAwards[p].back();
|
||||||
|
|
||||||
LOG->Trace( "done with per combo awards" );
|
LOG->Trace( "done with per combo awards" );
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// erase awards from the Last list that have been received so that we
|
|
||||||
// won't show them again.
|
|
||||||
//
|
|
||||||
if( !PROFILEMAN->IsUsingProfile(p) )
|
|
||||||
{
|
|
||||||
// don't show any awards on ScreenAward unless using a profile
|
|
||||||
GAMESTATE->m_vLastPerDifficultyAwards[p].clear();
|
|
||||||
GAMESTATE->m_vLastPeakComboAwards[p].clear();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Profile* pProfile = PROFILEMAN->GetProfile(p);
|
|
||||||
|
|
||||||
switch( m_Type )
|
|
||||||
{
|
|
||||||
case stage:
|
|
||||||
for( int i=GAMESTATE->m_vLastPerDifficultyAwards[p].size()-1; i>=0; i-- )
|
|
||||||
{
|
|
||||||
PerDifficultyAward pda = GAMESTATE->m_vLastPerDifficultyAwards[p][i];
|
|
||||||
Steps* pSteps = stageStats.pSteps[p];
|
|
||||||
ASSERT( pSteps != NULL );
|
|
||||||
bool bAlreadyHad = pProfile->HasPerDifficultyAward( pSteps->m_StepsType, pSteps->GetDifficulty(), pda );
|
|
||||||
pProfile->AddPerDifficultyAward( pSteps->m_StepsType, pSteps->GetDifficulty(), pda );
|
|
||||||
if( bAlreadyHad )
|
|
||||||
GAMESTATE->m_vLastPerDifficultyAwards[p].erase( GAMESTATE->m_vLastPerDifficultyAwards[p].begin()+i );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG->Trace( "done erasing dupe pdas" );
|
|
||||||
|
|
||||||
{
|
|
||||||
for( int i=GAMESTATE->m_vLastPeakComboAwards[p].size()-1; i>=0; i-- )
|
|
||||||
{
|
|
||||||
PeakComboAward pca = GAMESTATE->m_vLastPeakComboAwards[p][i];
|
|
||||||
bool bAlreadyHad = pProfile->HasPeakComboAward( pca );
|
|
||||||
pProfile->AddPeakComboAward( pca );
|
|
||||||
if( bAlreadyHad )
|
|
||||||
GAMESTATE->m_vLastPeakComboAwards[p].erase( GAMESTATE->m_vLastPeakComboAwards[p].begin()+i );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG->Trace( "done erasing pcas" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user