From 52eb7a79b8b62bd712c1f4b537b8a26847289019 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 12 Aug 2005 03:12:54 +0000 Subject: [PATCH] cleanup --- stepmania/src/HighScore.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/stepmania/src/HighScore.cpp b/stepmania/src/HighScore.cpp index 1144730487..48e9be7dbf 100644 --- a/stepmania/src/HighScore.cpp +++ b/stepmania/src/HighScore.cpp @@ -27,7 +27,7 @@ struct HighScoreImpl float fLifeRemainingSeconds; void Unset(); - void AppendChildren( XNode *pNode ) const; + XNode *CreateNode() const; void LoadFromNode( const XNode *pNode ); bool operator==( const HighScoreImpl& other ) const; @@ -76,8 +76,11 @@ void HighScoreImpl::Unset() fLifeRemainingSeconds = 0; } -void HighScoreImpl::AppendChildren( XNode *pNode ) const +XNode *HighScoreImpl::CreateNode() const { + XNode *pNode = new XNode; + pNode->m_sName = "HighScore"; + // TRICKY: Don't write "name to fill in" markers. pNode->AppendChild( "Name", IsRankingToFillIn(sName) ? CString("") : sName ); pNode->AppendChild( "Grade", GradeToString(grade) ); @@ -99,10 +102,14 @@ void HighScoreImpl::AppendChildren( XNode *pNode ) const pHoldNoteScores->AppendChild( HoldNoteScoreToString(hns), iHoldNoteScores[hns] ); pNode->AppendChild( radarValues.CreateNode() ); pNode->AppendChild( "LifeRemainingSeconds", fLifeRemainingSeconds ); + + return pNode; } void HighScoreImpl::LoadFromNode( const XNode *pNode ) { + ASSERT( pNode->m_sName == "HighScore" ); + CString s; pNode->GetChildValue( "Name", sName ); @@ -208,17 +215,11 @@ bool HighScore::operator==( const HighScore& other ) const XNode* HighScore::CreateNode() const { - XNode* pNode = new XNode; - pNode->m_sName = "HighScore"; - - m_Impl->AppendChildren( pNode ); - return pNode; + return m_Impl->CreateNode(); } void HighScore::LoadFromNode( const XNode* pNode ) { - ASSERT( pNode->m_sName == "HighScore" ); - m_Impl->LoadFromNode( pNode ); }