fix LastScores loading
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
+10
-10
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user