fixed crash problem

This commit is contained in:
Anakin 2016-10-22 14:05:46 +02:00
parent c0a84c7513
commit be97fa8e6f
2 changed files with 10 additions and 9 deletions

View File

@ -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);

View File

@ -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++)
{