allow loading editable data from stats.xml

This commit is contained in:
Glenn Maynard
2005-08-13 03:16:28 +00:00
parent 570713023a
commit 18d3efa6e1
2 changed files with 26 additions and 4 deletions
+25 -3
View File
@@ -850,7 +850,7 @@ Profile::LoadResult Profile::LoadAllFromDir( CString sDir, bool bRequireSignatur
return LoadStatsXmlFromNode( &xml );
}
Profile::LoadResult Profile::LoadStatsXmlFromNode( const XNode *xml )
Profile::LoadResult Profile::LoadStatsXmlFromNode( const XNode *xml, bool bIgnoreEditable )
{
/* The placeholder stats.xml file has an <html> tag. Don't load it, but don't
* warn about it. */
@@ -863,6 +863,13 @@ Profile::LoadResult Profile::LoadStatsXmlFromNode( const XNode *xml )
return failed_tampered;
}
/* These are loaded from Editable, so we usually want to ignore them
* here. */
CString sName = m_sDisplayName;
CString sCharacter = m_sCharacter;
CString sLastUsedHighScoreName = m_sLastUsedHighScoreName;
int iWeightPounds = m_iWeightPounds;
LOAD_NODE( GeneralData );
LOAD_NODE( SongScores );
LOAD_NODE( CourseScores );
@@ -872,6 +879,14 @@ Profile::LoadResult Profile::LoadStatsXmlFromNode( const XNode *xml )
LOAD_NODE( RecentSongScores );
LOAD_NODE( RecentCourseScores );
if( bIgnoreEditable )
{
m_sDisplayName = sName;
m_sCharacter = sCharacter;
m_sLastUsedHighScoreName = sLastUsedHighScoreName;
m_iWeightPounds = iWeightPounds;
}
return success;
}
@@ -966,10 +981,13 @@ XNode* Profile::SaveGeneralDataCreateNode() const
XNode* pGeneralDataNode = new XNode;
pGeneralDataNode->m_sName = "GeneralData";
// TRICKY: These are write-only elements that are never read again. This
// data is required by other apps (like internet ranking), but is
// TRICKY: These are write-only elements that are normally never read again.
// This data is required by other apps (like internet ranking), but is
// redundant to the game app.
pGeneralDataNode->AppendChild( "DisplayName", GetDisplayNameOrHighScoreName() );
pGeneralDataNode->AppendChild( "Character", m_sCharacter );
pGeneralDataNode->AppendChild( "LastUsedHighScoreName", m_sLastUsedHighScoreName );
pGeneralDataNode->AppendChild( "WeightPounds", m_iWeightPounds );
pGeneralDataNode->AppendChild( "IsMachine", IsMachine() );
pGeneralDataNode->AppendChild( "IsWeightSet", m_iWeightPounds != 0 );
@@ -1132,6 +1150,10 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
CString s;
const XNode* pTemp;
pNode->GetChildValue( "DisplayName", m_sDisplayName );
pNode->GetChildValue( "Character", m_sCharacter );
pNode->GetChildValue( "LastUsedHighScoreName", m_sLastUsedHighScoreName );
pNode->GetChildValue( "WeightPounds", m_iWeightPounds );
pNode->GetChildValue( "Guid", m_sGuid );
pNode->GetChildValue( "SortOrder", s ); m_SortOrder = StringToSortOrder( s );
pNode->GetChildValue( "LastDifficulty", s ); m_LastDifficulty = StringToDifficulty( s );
+1 -1
View File
@@ -305,7 +305,7 @@ public:
bool SaveAllToDir( CString sDir, bool bSignData ) const;
LoadResult LoadEditableDataFromDir( CString sDir );
LoadResult LoadStatsXmlFromNode( const XNode* pNode );
LoadResult LoadStatsXmlFromNode( const XNode* pNode, bool bIgnoreEditable = true );
void LoadGeneralDataFromNode( const XNode* pNode );
void LoadSongScoresFromNode( const XNode* pNode );
void LoadCourseScoresFromNode( const XNode* pNode );