From 59126d1b79d4b2603fa5ac23a30221a03d7397bb Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 22 Apr 2004 22:56:38 +0000 Subject: [PATCH] fix LastScores loading --- stepmania/src/HighScore.cpp | 2 ++ stepmania/src/HighScore.h | 8 ++++++-- stepmania/src/Profile.cpp | 20 ++++++++++---------- stepmania/src/Profile.h | 16 ++++++++-------- stepmania/src/ScreenEvaluation.cpp | 1 + 5 files changed, 27 insertions(+), 20 deletions(-) diff --git a/stepmania/src/HighScore.cpp b/stepmania/src/HighScore.cpp index 39baffe0fd..8e7c7c469e 100644 --- a/stepmania/src/HighScore.cpp +++ b/stepmania/src/HighScore.cpp @@ -55,6 +55,7 @@ XNode* HighScore::CreateNode() const pNode->AppendChild( "SurviveSeconds", fSurviveSeconds ); pNode->AppendChild( "Modifiers", sModifiers ); pNode->AppendChild( "Time", (int)time ); + pNode->AppendChild( "PlayerGuid", sPlayerGuid ); pNode->AppendChild( "MachineGuid", sMachineGuid ); return pNode; @@ -74,6 +75,7 @@ void HighScore::LoadFromNode( const XNode* pNode ) else if( (*child)->name == "SurviveSeconds" ) (*child)->GetValue( fSurviveSeconds ); else if( (*child)->name == "Modifiers" ) (*child)->GetValue( sModifiers ); 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 ); } diff --git a/stepmania/src/HighScore.h b/stepmania/src/HighScore.h index 8d9020f2c1..1012a3ac85 100644 --- a/stepmania/src/HighScore.h +++ b/stepmania/src/HighScore.h @@ -17,24 +17,28 @@ struct HighScore { - CString sName; + CString sName; // name that shows in the machine's ranking screen Grade grade; int iScore; float fPercentDP; float fSurviveSeconds; CString sModifiers; 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(); } void Unset() { + sName = ""; grade = GRADE_NO_DATA; iScore = 0; fPercentDP = 0; fSurviveSeconds = 0; time = 0; + sPlayerGuid = ""; + sMachineGuid = ""; } bool operator>=( const HighScore& other ) const; diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index bc2df64d33..264e923415 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -157,12 +157,12 @@ void Profile::InitAwards() } } -void Profile::InitSongLastScores() +void Profile::InitLastSongScores() { m_vLastStepsScores.clear(); } -void Profile::InitCourseLastScores() +void Profile::InitLastCourseScores() { m_vLastCourseScores.clear(); } @@ -533,8 +533,8 @@ bool Profile::LoadAllFromDir( CString sDir, bool bRequireSignature ) LOAD_NODE( ScreenshotData ); LOAD_NODE( CalorieData ); LOAD_NODE( Awards ); - LOAD_NODE( SongLastScores ); - LOAD_NODE( CourseLastScores ); + LOAD_NODE( LastSongScores ); + LOAD_NODE( LastCourseScores ); } 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( SaveCalorieDataCreateNode() ); xml.AppendChild( SaveAwardsCreateNode() ); - xml.AppendChild( SaveSongLastScoresCreateNode() ); - xml.AppendChild( SaveCourseLastScoresCreateNode() ); + xml.AppendChild( SaveLastSongScoresCreateNode() ); + xml.AppendChild( SaveLastCourseScoresCreateNode() ); bool bSaved = xml.SaveToFile(fn); // 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 ); } -void Profile::LoadSongLastScoresFromNode( const XNode* pNode ) +void Profile::LoadLastSongScoresFromNode( const XNode* pNode ) { CHECKPOINT; @@ -1859,7 +1859,7 @@ void Profile::LoadSongLastScoresFromNode( const XNode* pNode ) } } -XNode* Profile::SaveSongLastScoresCreateNode() const +XNode* Profile::SaveLastSongScoresCreateNode() const { CHECKPOINT; @@ -1912,7 +1912,7 @@ void Profile::HighScoreForACourse::LoadFromNode( const XNode* pNode ) hs.LoadFromNode( p ); } -void Profile::LoadCourseLastScoresFromNode( const XNode* pNode ) +void Profile::LoadLastCourseScoresFromNode( const XNode* pNode ) { CHECKPOINT; @@ -1933,7 +1933,7 @@ void Profile::LoadCourseLastScoresFromNode( const XNode* pNode ) } } -XNode* Profile::SaveCourseLastScoresCreateNode() const +XNode* Profile::SaveLastCourseScoresCreateNode() const { CHECKPOINT; diff --git a/stepmania/src/Profile.h b/stepmania/src/Profile.h index 9c9a6105e6..83c521ae85 100644 --- a/stepmania/src/Profile.h +++ b/stepmania/src/Profile.h @@ -285,8 +285,8 @@ public: InitScreenshotData(); InitCalorieData(); InitAwards(); - InitSongLastScores(); - InitCourseLastScores(); + InitLastSongScores(); + InitLastCourseScores(); } void InitEditableData(); void InitGeneralData(); @@ -296,8 +296,8 @@ public: void InitScreenshotData(); void InitCalorieData(); void InitAwards(); - void InitSongLastScores(); - void InitCourseLastScores(); + void InitLastSongScores(); + void InitLastCourseScores(); // // Loading and saving @@ -318,8 +318,8 @@ public: void LoadScreenshotDataFromNode( const XNode* pNode ); void LoadCalorieDataFromNode( const XNode* pNode ); void LoadAwardsFromNode( const XNode* pNode ); - void LoadSongLastScoresFromNode( const XNode* pNode ); - void LoadCourseLastScoresFromNode( const XNode* pNode ); + void LoadLastSongScoresFromNode( const XNode* pNode ); + void LoadLastCourseScoresFromNode( const XNode* pNode ); void SaveEditableDataToDir( CString sDir ) const; XNode* SaveGeneralDataCreateNode() const; @@ -329,8 +329,8 @@ public: XNode* SaveScreenshotDataCreateNode() const; XNode* SaveCalorieDataCreateNode() const; XNode* SaveAwardsCreateNode() const; - XNode* SaveSongLastScoresCreateNode() const; - XNode* SaveCourseLastScoresCreateNode() const; + XNode* SaveLastSongScoresCreateNode() const; + XNode* SaveLastCourseScoresCreateNode() const; void DeleteProfileDataFromDirSM390a12( CString sDir ) const; void DeleteSongScoresFromDirSM390a12( CString sDir ) const; diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index fd4c3e7737..6b6d95924f 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -945,6 +945,7 @@ void ScreenEvaluation::CommitScores( hs.fSurviveSeconds = stageStats.fAliveSeconds[p]; hs.sModifiers = GAMESTATE->m_PlayerOptions[p].GetString(); hs.time = time(NULL); + hs.sPlayerGuid = PROFILEMAN->IsUsingProfile(p) ? PROFILEMAN->GetProfile(p)->m_sGuid : ""; hs.sMachineGuid = PROFILEMAN->GetMachineProfile()->m_sGuid; StepsType nt = GAMESTATE->GetCurrentStyleDef()->m_StepsType;