Commit be97fa8e authored by Anakin's avatar Anakin
Browse files

fixed crash problem

parent c0a84c75
......@@ -61,7 +61,7 @@ private:
void setModlDefault(Modl* model);
void loadChunks(std::list<ChunkHeader*> &destination, std::streampos start, const std::uint32_t end);
void analyseMsh2Chunks(std::list<ChunkHeader*> &chunkList);
void analyseMatdChunks(Modl* dataDestination, std::list<ChunkHeader*> &chunkList);
void analyseMatdChunks(std::list<ChunkHeader*> &chunkList);
void analyseModlChunks(Modl* dataDestination, std::list<ChunkHeader*> &chunkList);
void analyseGeomChunks(Modl* dataDestination, std::list<ChunkHeader*> &chunkList);
void analyseSegmChunks(Modl* dataDestination, std::list<ChunkHeader*> &chunkList);
......
......@@ -133,9 +133,6 @@ void Object::analyseMsh2Chunks(std::list<ChunkHeader*>& chunkList)
{
for (std::list<ChunkHeader*>::iterator it = chunkList.begin(); it != chunkList.end(); it++)
{
Modl* tempModl = new Modl;
setModlDefault(tempModl);
if (!strcmp("MATL", (*it)->name))
{
// get all MATD from MATL list
......@@ -153,7 +150,7 @@ void Object::analyseMsh2Chunks(std::list<ChunkHeader*>& chunkList)
loadChunks(tempMatdChunks, (*it)->position, (*it)->size);
// analyse MATD subchunks
analyseMatdChunks(tempModl, tempMatdChunks);
analyseMatdChunks(tempMatdChunks);
// clean up
while (!tempMatdChunks.empty())
......@@ -178,6 +175,10 @@ void Object::analyseMsh2Chunks(std::list<ChunkHeader*>& chunkList)
if (!strcmp("MODL", (*it)->name))
{
Modl* tempModl = new Modl;
setModlDefault(tempModl);
// get all subchunks
std::list<ChunkHeader*> tempChunks;
loadChunks(tempChunks, (*it)->position, (*it)->size);
......@@ -193,15 +194,15 @@ void Object::analyseMsh2Chunks(std::list<ChunkHeader*>& chunkList)
delete tempCursor;
}
// save Model data
lModls.push_back(tempModl);
continue;
}
// save Model data
lModls.push_back(tempModl);
}
}
void Object::analyseMatdChunks(Modl * dataDestination, std::list<ChunkHeader*>& chunkList)
void Object::analyseMatdChunks(std::list<ChunkHeader*>& chunkList)
{
for (std::list<ChunkHeader*>::iterator it = chunkList.begin(); it != chunkList.end(); it++)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment