Convert Game::customloadquick() to TinyXML2

Ok, who's even reading these commit messages at this point?
This commit is contained in:
Misa
2020-06-03 17:34:05 -07:00
committed by Ethan Lee
parent c62bfad19d
commit c03fdc6c01

View File

@@ -5181,16 +5181,16 @@ void Game::customloadquick(std::string savfile)
} }
std::string levelfile = savfile.substr(7); std::string levelfile = savfile.substr(7);
TiXmlDocument doc; tinyxml2::XMLDocument doc;
if (!FILESYSTEM_loadTiXmlDocument(("saves/"+levelfile+".vvv").c_str(), &doc)) return; if (!FILESYSTEM_loadTiXml2Document(("saves/"+levelfile+".vvv").c_str(), doc)) return;
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)
{ {
@@ -5198,10 +5198,10 @@ void Game::customloadquick(std::string savfile)
} }
// 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() ;