1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-01 00:39:41 +01:00

Convert Game::loadtele() to TinyXML2

Again, the only thing that needs to be changed is just the code at the
top of the function.
This commit is contained in:
Misa 2020-06-03 11:04:36 -07:00 committed by Ethan Lee
parent 6274707777
commit 9348bf5b24

View file

@ -6233,16 +6233,16 @@ void Game::customsavequick(std::string savfile)
void Game::loadtele() void Game::loadtele()
{ {
TiXmlDocument doc; tinyxml2::XMLDocument doc;
if (!FILESYSTEM_loadTiXmlDocument("saves/tsave.vvv", &doc)) return; if (!FILESYSTEM_loadTiXml2Document("saves/tsave.vvv", 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)
{ {
@ -6250,11 +6250,11 @@ void Game::loadtele()
} }
// 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() ;