fix LastScores loading

This commit is contained in:
Chris Danford
2004-04-22 22:56:38 +00:00
parent 0cc49c66bb
commit 59126d1b79
5 changed files with 27 additions and 20 deletions
+2
View File
@@ -55,6 +55,7 @@ XNode* HighScore::CreateNode() const
pNode->AppendChild( "SurviveSeconds", fSurviveSeconds ); pNode->AppendChild( "SurviveSeconds", fSurviveSeconds );
pNode->AppendChild( "Modifiers", sModifiers ); pNode->AppendChild( "Modifiers", sModifiers );
pNode->AppendChild( "Time", (int)time ); pNode->AppendChild( "Time", (int)time );
pNode->AppendChild( "PlayerGuid", sPlayerGuid );
pNode->AppendChild( "MachineGuid", sMachineGuid ); pNode->AppendChild( "MachineGuid", sMachineGuid );
return pNode; return pNode;
@@ -74,6 +75,7 @@ void HighScore::LoadFromNode( const XNode* pNode )
else if( (*child)->name == "SurviveSeconds" ) (*child)->GetValue( fSurviveSeconds ); else if( (*child)->name == "SurviveSeconds" ) (*child)->GetValue( fSurviveSeconds );
else if( (*child)->name == "Modifiers" ) (*child)->GetValue( sModifiers ); else if( (*child)->name == "Modifiers" ) (*child)->GetValue( sModifiers );
else if( (*child)->name == "Time" ) (*child)->GetValue( (int&)time ); else if( (*child)->name == "Time" ) (*child)->GetValue( (int&)time );
else if( (*child)->name == "PlayerGuid" ) (*child)->GetValue( sPlayerGuid );
else if( (*child)->name == "MachineGuid" ) (*child)->GetValue( sMachineGuid ); else if( (*child)->name == "MachineGuid" ) (*child)->GetValue( sMachineGuid );
} }
+6 -2
View File
@@ -17,24 +17,28 @@
struct HighScore struct HighScore
{ {
CString sName; CString sName; // name that shows in the machine's ranking screen
Grade grade; Grade grade;
int iScore; int iScore;
float fPercentDP; float fPercentDP;
float fSurviveSeconds; float fSurviveSeconds;
CString sModifiers; CString sModifiers;
time_t time; // return value of time() when screenshot was taken time_t time; // return value of time() when screenshot was taken
CString sMachineGuid; // where this screenshot was taken CString sPlayerGuid; // who made this high score
CString sMachineGuid; // where this high score was made
HighScore() { Unset(); } HighScore() { Unset(); }
void Unset() void Unset()
{ {
sName = "";
grade = GRADE_NO_DATA; grade = GRADE_NO_DATA;
iScore = 0; iScore = 0;
fPercentDP = 0; fPercentDP = 0;
fSurviveSeconds = 0; fSurviveSeconds = 0;
time = 0; time = 0;
sPlayerGuid = "";
sMachineGuid = "";
} }
bool operator>=( const HighScore& other ) const; bool operator>=( const HighScore& other ) const;
+10 -10
View File
@@ -157,12 +157,12 @@ void Profile::InitAwards()
} }
} }
void Profile::InitSongLastScores() void Profile::InitLastSongScores()
{ {
m_vLastStepsScores.clear(); m_vLastStepsScores.clear();
} }
void Profile::InitCourseLastScores() void Profile::InitLastCourseScores()
{ {
m_vLastCourseScores.clear(); m_vLastCourseScores.clear();
} }
@@ -533,8 +533,8 @@ bool Profile::LoadAllFromDir( CString sDir, bool bRequireSignature )
LOAD_NODE( ScreenshotData ); LOAD_NODE( ScreenshotData );
LOAD_NODE( CalorieData ); LOAD_NODE( CalorieData );
LOAD_NODE( Awards ); LOAD_NODE( Awards );
LOAD_NODE( SongLastScores ); LOAD_NODE( LastSongScores );
LOAD_NODE( CourseLastScores ); LOAD_NODE( LastCourseScores );
} }
return true; // FIXME? Investigate what happens if we always return true. return true; // FIXME? Investigate what happens if we always return true.
@@ -560,8 +560,8 @@ bool Profile::SaveAllToDir( CString sDir, bool bSignData ) const
xml.AppendChild( SaveScreenshotDataCreateNode() ); xml.AppendChild( SaveScreenshotDataCreateNode() );
xml.AppendChild( SaveCalorieDataCreateNode() ); xml.AppendChild( SaveCalorieDataCreateNode() );
xml.AppendChild( SaveAwardsCreateNode() ); xml.AppendChild( SaveAwardsCreateNode() );
xml.AppendChild( SaveSongLastScoresCreateNode() ); xml.AppendChild( SaveLastSongScoresCreateNode() );
xml.AppendChild( SaveCourseLastScoresCreateNode() ); xml.AppendChild( SaveLastCourseScoresCreateNode() );
bool bSaved = xml.SaveToFile(fn); bool bSaved = xml.SaveToFile(fn);
// Update file cache, or else IsAFile in CryptManager won't see this new file. // Update file cache, or else IsAFile in CryptManager won't see this new file.
@@ -1838,7 +1838,7 @@ void Profile::HighScoreForASongAndSteps::LoadFromNode( const XNode* pNode )
hs.LoadFromNode( p ); hs.LoadFromNode( p );
} }
void Profile::LoadSongLastScoresFromNode( const XNode* pNode ) void Profile::LoadLastSongScoresFromNode( const XNode* pNode )
{ {
CHECKPOINT; CHECKPOINT;
@@ -1859,7 +1859,7 @@ void Profile::LoadSongLastScoresFromNode( const XNode* pNode )
} }
} }
XNode* Profile::SaveSongLastScoresCreateNode() const XNode* Profile::SaveLastSongScoresCreateNode() const
{ {
CHECKPOINT; CHECKPOINT;
@@ -1912,7 +1912,7 @@ void Profile::HighScoreForACourse::LoadFromNode( const XNode* pNode )
hs.LoadFromNode( p ); hs.LoadFromNode( p );
} }
void Profile::LoadCourseLastScoresFromNode( const XNode* pNode ) void Profile::LoadLastCourseScoresFromNode( const XNode* pNode )
{ {
CHECKPOINT; CHECKPOINT;
@@ -1933,7 +1933,7 @@ void Profile::LoadCourseLastScoresFromNode( const XNode* pNode )
} }
} }
XNode* Profile::SaveCourseLastScoresCreateNode() const XNode* Profile::SaveLastCourseScoresCreateNode() const
{ {
CHECKPOINT; CHECKPOINT;
+8 -8
View File
@@ -285,8 +285,8 @@ public:
InitScreenshotData(); InitScreenshotData();
InitCalorieData(); InitCalorieData();
InitAwards(); InitAwards();
InitSongLastScores(); InitLastSongScores();
InitCourseLastScores(); InitLastCourseScores();
} }
void InitEditableData(); void InitEditableData();
void InitGeneralData(); void InitGeneralData();
@@ -296,8 +296,8 @@ public:
void InitScreenshotData(); void InitScreenshotData();
void InitCalorieData(); void InitCalorieData();
void InitAwards(); void InitAwards();
void InitSongLastScores(); void InitLastSongScores();
void InitCourseLastScores(); void InitLastCourseScores();
// //
// Loading and saving // Loading and saving
@@ -318,8 +318,8 @@ public:
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 LoadAwardsFromNode( const XNode* pNode );
void LoadSongLastScoresFromNode( const XNode* pNode ); void LoadLastSongScoresFromNode( const XNode* pNode );
void LoadCourseLastScoresFromNode( const XNode* pNode ); void LoadLastCourseScoresFromNode( const XNode* pNode );
void SaveEditableDataToDir( CString sDir ) const; void SaveEditableDataToDir( CString sDir ) const;
XNode* SaveGeneralDataCreateNode() const; XNode* SaveGeneralDataCreateNode() const;
@@ -329,8 +329,8 @@ public:
XNode* SaveScreenshotDataCreateNode() const; XNode* SaveScreenshotDataCreateNode() const;
XNode* SaveCalorieDataCreateNode() const; XNode* SaveCalorieDataCreateNode() const;
XNode* SaveAwardsCreateNode() const; XNode* SaveAwardsCreateNode() const;
XNode* SaveSongLastScoresCreateNode() const; XNode* SaveLastSongScoresCreateNode() const;
XNode* SaveCourseLastScoresCreateNode() const; XNode* SaveLastCourseScoresCreateNode() const;
void DeleteProfileDataFromDirSM390a12( CString sDir ) const; void DeleteProfileDataFromDirSM390a12( CString sDir ) const;
void DeleteSongScoresFromDirSM390a12( CString sDir ) const; void DeleteSongScoresFromDirSM390a12( CString sDir ) const;
+1
View File
@@ -945,6 +945,7 @@ void ScreenEvaluation::CommitScores(
hs.fSurviveSeconds = stageStats.fAliveSeconds[p]; hs.fSurviveSeconds = stageStats.fAliveSeconds[p];
hs.sModifiers = GAMESTATE->m_PlayerOptions[p].GetString(); hs.sModifiers = GAMESTATE->m_PlayerOptions[p].GetString();
hs.time = time(NULL); hs.time = time(NULL);
hs.sPlayerGuid = PROFILEMAN->IsUsingProfile(p) ? PROFILEMAN->GetProfile(p)->m_sGuid : "";
hs.sMachineGuid = PROFILEMAN->GetMachineProfile()->m_sGuid; hs.sMachineGuid = PROFILEMAN->GetMachineProfile()->m_sGuid;
StepsType nt = GAMESTATE->GetCurrentStyleDef()->m_StepsType; StepsType nt = GAMESTATE->GetCurrentStyleDef()->m_StepsType;