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)
|
||||
{
|
||||
*mem = (unsigned char *) malloc(length + 1);
|
||||
mem[length] = 0;
|
||||
(*mem)[length] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -116,19 +116,13 @@ void editorclass::getDirectoryData()
|
|||
}
|
||||
bool editorclass::getLevelMetaData(std::string& _path, LevelMetaData& _data )
|
||||
{
|
||||
unsigned char *mem = NULL;
|
||||
FILESYSTEM_loadFileToMemory(_path.c_str(), &mem, NULL);
|
||||
|
||||
if (mem == NULL)
|
||||
TiXmlDocument doc;
|
||||
if (!FILESYSTEM_loadTiXmlDocument(_path.c_str(), &doc))
|
||||
{
|
||||
printf("Level %s not found :(\n", _path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
TiXmlDocument doc;
|
||||
doc.Parse((const char*) mem);
|
||||
FILESYSTEM_freeMemory(&mem);
|
||||
|
||||
TiXmlHandle hDoc(&doc);
|
||||
TiXmlElement* pElem;
|
||||
TiXmlHandle hRoot(0);
|
||||
|
@ -1712,23 +1706,19 @@ void editorclass::load(std::string& _path)
|
|||
{
|
||||
reset();
|
||||
|
||||
unsigned char *mem = NULL;
|
||||
static const char *levelDir = "levels/";
|
||||
if (_path.compare(0, strlen(levelDir), levelDir) != 0)
|
||||
{
|
||||
_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());
|
||||
return;
|
||||
}
|
||||
|
||||
TiXmlDocument doc;
|
||||
doc.Parse((const char*) mem);
|
||||
FILESYSTEM_freeMemory(&mem);
|
||||
|
||||
TiXmlHandle hDoc(&doc);
|
||||
TiXmlElement* pElem;
|
||||
|
|
Loading…
Reference in a new issue