mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Fix level editor not using LoadTiXmlDocument
This commit is contained in:
parent
5862af4445
commit
2ec1106741
2 changed files with 5 additions and 15 deletions
|
@ -139,7 +139,7 @@ void FILESYSTEM_loadFileToMemory(const char *name, unsigned char **mem,
|
||||||
if (addnull)
|
if (addnull)
|
||||||
{
|
{
|
||||||
*mem = (unsigned char *) malloc(length + 1);
|
*mem = (unsigned char *) malloc(length + 1);
|
||||||
mem[length] = 0;
|
(*mem)[length] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,19 +116,13 @@ void editorclass::getDirectoryData()
|
||||||
}
|
}
|
||||||
bool editorclass::getLevelMetaData(std::string& _path, LevelMetaData& _data )
|
bool editorclass::getLevelMetaData(std::string& _path, LevelMetaData& _data )
|
||||||
{
|
{
|
||||||
unsigned char *mem = NULL;
|
TiXmlDocument doc;
|
||||||
FILESYSTEM_loadFileToMemory(_path.c_str(), &mem, NULL);
|
if (!FILESYSTEM_loadTiXmlDocument(_path.c_str(), &doc))
|
||||||
|
|
||||||
if (mem == NULL)
|
|
||||||
{
|
{
|
||||||
printf("Level %s not found :(\n", _path.c_str());
|
printf("Level %s not found :(\n", _path.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlDocument doc;
|
|
||||||
doc.Parse((const char*) mem);
|
|
||||||
FILESYSTEM_freeMemory(&mem);
|
|
||||||
|
|
||||||
TiXmlHandle hDoc(&doc);
|
TiXmlHandle hDoc(&doc);
|
||||||
TiXmlElement* pElem;
|
TiXmlElement* pElem;
|
||||||
TiXmlHandle hRoot(0);
|
TiXmlHandle hRoot(0);
|
||||||
|
@ -1712,23 +1706,19 @@ void editorclass::load(std::string& _path)
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
unsigned char *mem = NULL;
|
|
||||||
static const char *levelDir = "levels/";
|
static const char *levelDir = "levels/";
|
||||||
if (_path.compare(0, strlen(levelDir), levelDir) != 0)
|
if (_path.compare(0, strlen(levelDir), levelDir) != 0)
|
||||||
{
|
{
|
||||||
_path = levelDir + _path;
|
_path = levelDir + _path;
|
||||||
}
|
}
|
||||||
FILESYSTEM_loadFileToMemory(_path.c_str(), &mem, NULL);
|
|
||||||
|
|
||||||
if (mem == NULL)
|
TiXmlDocument doc;
|
||||||
|
if (!FILESYSTEM_loadTiXmlDocument(_path.c_str(), &doc))
|
||||||
{
|
{
|
||||||
printf("No level %s to load :(\n", _path.c_str());
|
printf("No level %s to load :(\n", _path.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlDocument doc;
|
|
||||||
doc.Parse((const char*) mem);
|
|
||||||
FILESYSTEM_freeMemory(&mem);
|
|
||||||
|
|
||||||
TiXmlHandle hDoc(&doc);
|
TiXmlHandle hDoc(&doc);
|
||||||
TiXmlElement* pElem;
|
TiXmlElement* pElem;
|
||||||
|
|
Loading…
Reference in a new issue