fix RecentCourseScore saving
This commit is contained in:
@@ -1600,25 +1600,28 @@ void Profile::AddStepsRecentScore( const Song* pSong, const Steps* pSteps, HighS
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
XNode* Profile::HighScoreForACourse::CreateNode() const
|
XNode* Profile::HighScoreForACourseAndTrail::CreateNode() const
|
||||||
{
|
{
|
||||||
XNode* pNode = new XNode;
|
XNode* pNode = new XNode;
|
||||||
pNode->name = "HighScoreForACourse";
|
pNode->name = "HighScoreForACourseAndTrail";
|
||||||
|
|
||||||
pNode->AppendChild( courseID.CreateNode() );
|
pNode->AppendChild( courseID.CreateNode() );
|
||||||
|
pNode->AppendChild( trailID.CreateNode() );
|
||||||
pNode->AppendChild( hs.CreateNode() );
|
pNode->AppendChild( hs.CreateNode() );
|
||||||
|
|
||||||
return pNode;
|
return pNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profile::HighScoreForACourse::LoadFromNode( const XNode* pNode )
|
void Profile::HighScoreForACourseAndTrail::LoadFromNode( const XNode* pNode )
|
||||||
{
|
{
|
||||||
Unset();
|
Unset();
|
||||||
|
|
||||||
ASSERT( pNode->name == "HighScoreForACourse" );
|
ASSERT( pNode->name == "HighScoreForACourseAndTrail" );
|
||||||
XNode* p;
|
XNode* p;
|
||||||
if( (p = pNode->GetChild("Course")) )
|
if( (p = pNode->GetChild("Course")) )
|
||||||
courseID.LoadFromNode( p );
|
courseID.LoadFromNode( p );
|
||||||
|
if( (p = pNode->GetChild("Trail")) )
|
||||||
|
trailID.LoadFromNode( p );
|
||||||
if( (p = pNode->GetChild("HighScore")) )
|
if( (p = pNode->GetChild("HighScore")) )
|
||||||
hs.LoadFromNode( p );
|
hs.LoadFromNode( p );
|
||||||
}
|
}
|
||||||
@@ -1632,9 +1635,9 @@ void Profile::LoadRecentCourseScoresFromNode( const XNode* pNode )
|
|||||||
p != pNode->childs.end();
|
p != pNode->childs.end();
|
||||||
p++ )
|
p++ )
|
||||||
{
|
{
|
||||||
if( (*p)->name == "HighScoreForACourse" )
|
if( (*p)->name == "HighScoreForACourseAndTrail" )
|
||||||
{
|
{
|
||||||
HighScoreForACourse h;
|
HighScoreForACourseAndTrail h;
|
||||||
h.LoadFromNode( *p );
|
h.LoadFromNode( *p );
|
||||||
|
|
||||||
m_vRecentCourseScores.push_back( h );
|
m_vRecentCourseScores.push_back( h );
|
||||||
@@ -1666,7 +1669,7 @@ XNode* Profile::SaveRecentCourseScoresCreateNode() const
|
|||||||
|
|
||||||
void Profile::AddCourseRecentScore( const Course* pCourse, const Trail* pTrail, HighScore hs )
|
void Profile::AddCourseRecentScore( const Course* pCourse, const Trail* pTrail, HighScore hs )
|
||||||
{
|
{
|
||||||
HighScoreForACourse h;
|
HighScoreForACourseAndTrail h;
|
||||||
h.courseID.FromCourse( pCourse );
|
h.courseID.FromCourse( pCourse );
|
||||||
h.trailID.FromTrail( pTrail );
|
h.trailID.FromTrail( pTrail );
|
||||||
h.hs = hs;
|
h.hs = hs;
|
||||||
|
|||||||
@@ -254,19 +254,19 @@ public:
|
|||||||
//
|
//
|
||||||
// RecentCourseScores
|
// RecentCourseScores
|
||||||
//
|
//
|
||||||
struct HighScoreForACourse
|
struct HighScoreForACourseAndTrail
|
||||||
{
|
{
|
||||||
CourseID courseID;
|
CourseID courseID;
|
||||||
TrailID trailID;
|
TrailID trailID;
|
||||||
HighScore hs;
|
HighScore hs;
|
||||||
|
|
||||||
HighScoreForACourse() { Unset(); }
|
HighScoreForACourseAndTrail() { Unset(); }
|
||||||
void Unset() { courseID.Unset(); hs.Unset(); }
|
void Unset() { courseID.Unset(); hs.Unset(); }
|
||||||
|
|
||||||
XNode* CreateNode() const;
|
XNode* CreateNode() const;
|
||||||
void LoadFromNode( const XNode* pNode );
|
void LoadFromNode( const XNode* pNode );
|
||||||
};
|
};
|
||||||
vector<HighScoreForACourse> m_vRecentCourseScores;
|
vector<HighScoreForACourseAndTrail> m_vRecentCourseScores;
|
||||||
void AddCourseRecentScore( const Course* pCourse, const Trail* pTrail, HighScore hs );
|
void AddCourseRecentScore( const Course* pCourse, const Trail* pTrail, HighScore hs );
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user