mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-09 18:39:45 +01:00
Convert Game::loadstats() to TinyXML2
Surprisingly, I only had to change some names and stuff around at the top of the function. The rest of the function could be left untouched and it worked fine.
This commit is contained in:
parent
b17e96df7d
commit
f2709731e2
1 changed files with 9 additions and 8 deletions
|
@ -15,6 +15,7 @@
|
||||||
#include "FileSystemUtils.h"
|
#include "FileSystemUtils.h"
|
||||||
|
|
||||||
#include "tinyxml.h"
|
#include "tinyxml.h"
|
||||||
|
#include "tinyxml2.h"
|
||||||
|
|
||||||
#include "Network.h"
|
#include "Network.h"
|
||||||
|
|
||||||
|
@ -4231,20 +4232,20 @@ void Game::unlocknum( int t )
|
||||||
|
|
||||||
void Game::loadstats()
|
void Game::loadstats()
|
||||||
{
|
{
|
||||||
TiXmlDocument doc;
|
tinyxml2::XMLDocument doc;
|
||||||
if (!FILESYSTEM_loadTiXmlDocument("saves/unlock.vvv", &doc))
|
if (!FILESYSTEM_loadTiXml2Document("saves/unlock.vvv", doc))
|
||||||
{
|
{
|
||||||
savestats();
|
savestats();
|
||||||
printf("No Stats found. Assuming a new player\n");
|
printf("No Stats found. Assuming a new player\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -4253,14 +4254,14 @@ void Game::loadstats()
|
||||||
;
|
;
|
||||||
|
|
||||||
// save this for later
|
// save this for later
|
||||||
hRoot=TiXmlHandle(pElem);
|
hRoot=tinyxml2::XMLHandle(pElem);
|
||||||
}
|
}
|
||||||
|
|
||||||
// WINDOW DIMS, ADDED AT PATCH 22
|
// WINDOW DIMS, ADDED AT PATCH 22
|
||||||
int width = 320;
|
int width = 320;
|
||||||
int height = 240;
|
int height = 240;
|
||||||
|
|
||||||
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() ;
|
||||||
|
|
Loading…
Reference in a new issue