use multimap in XmlFile

This commit is contained in:
Chris Danford
2005-01-07 09:09:23 +00:00
parent b1070d2077
commit 5b2582cab3
6 changed files with 150 additions and 325 deletions
+8 -9
View File
@@ -4,6 +4,7 @@
#include "GameConstantsAndTypes.h"
#include "ThemeManager.h"
#include "XmlFile.h"
#include "Foreach.h"
#define EMPTY_NAME THEME->GetMetric ("HighScore","EmptyName")
@@ -163,23 +164,21 @@ XNode* HighScoreList::CreateNode() const
return pNode;
}
void HighScoreList::LoadFromNode( const XNode* pNode )
void HighScoreList::LoadFromNode( const XNode* pHighScoreList )
{
Init();
ASSERT( pNode->name == "HighScoreList" );
for( vector<XNode*>::const_iterator child = pNode->childs.begin();
child != pNode->childs.end();
child++)
ASSERT( pHighScoreList->name == "HighScoreList" );
FOREACH_CONST_Child( pHighScoreList, p )
{
if( (*child)->name == "NumTimesPlayed" )
if( p->name == "NumTimesPlayed" )
{
(*child)->GetValue( iNumTimesPlayed );
p->GetValue( iNumTimesPlayed );
}
else if( (*child)->name == "HighScore" )
else if( p->name == "HighScore" )
{
vHighScores.resize( vHighScores.size()+1 );
vHighScores.back().LoadFromNode( (*child) );
vHighScores.back().LoadFromNode( p );
// ignore all high scores that are 0
if( vHighScores.back().iScore == 0 )