1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Convert Game::loadcustomlevelstats() to TinyXML2

This commit is contained in:
Misa 2020-06-03 19:34:03 -07:00 committed by Ethan Lee
parent 683dc1f97d
commit c397c898fc

View file

@ -568,8 +568,8 @@ void Game::loadcustomlevelstats()
//testing //testing
if(!customlevelstatsloaded) if(!customlevelstatsloaded)
{ {
TiXmlDocument doc; tinyxml2::XMLDocument doc;
if (!FILESYSTEM_loadTiXmlDocument("saves/levelstats.vvv", &doc)) if (!FILESYSTEM_loadTiXml2Document("saves/levelstats.vvv", doc))
{ {
//No levelstats file exists; start new //No levelstats file exists; start new
numcustomlevelstats=0; numcustomlevelstats=0;
@ -577,12 +577,12 @@ void Game::loadcustomlevelstats()
} }
else else
{ {
TiXmlHandle hDoc(&doc); tinyxml2::XMLHandle hDoc(&doc);
TiXmlElement* pElem; tinyxml2::XMLElement* pElem;
TiXmlHandle hRoot(0); tinyxml2::XMLHandle hRoot(NULL);
{ {
pElem=hDoc.FirstChildElement().Element(); pElem=hDoc.FirstChildElement().ToElement();
// should always have a valid root but handle gracefully if it does // should always have a valid root but handle gracefully if it does
if (!pElem) if (!pElem)
{ {
@ -590,11 +590,11 @@ void Game::loadcustomlevelstats()
} }
// save this for later // save this for later
hRoot=TiXmlHandle(pElem); hRoot=tinyxml2::XMLHandle(pElem);
} }
for( pElem = hRoot.FirstChild( "Data" ).FirstChild().Element(); pElem; pElem=pElem->NextSiblingElement()) for( pElem = hRoot.FirstChildElement( "Data" ).FirstChild().ToElement(); pElem; pElem=pElem->NextSiblingElement())
{ {
std::string pKey(pElem->Value()); std::string pKey(pElem->Value());
const char* pText = pElem->GetText() ; const char* pText = pElem->GetText() ;