GL - Fixed memory leaks in LevelLoader.
This commit is contained in:
parent
9bdf258c5d
commit
fef40f58f9
|
@ -43,14 +43,14 @@ std::vector<SmartPointer<ObjectTypeHeader>> LevelParser::Parse(std::string filen
|
|||
while(counter < bufferSize)
|
||||
{
|
||||
//Get typeID
|
||||
ObjectTypeHeader typeID;
|
||||
ObjectType typeID;
|
||||
ParseObject(&buffer[counter], &typeID, sizeof(typeID));
|
||||
switch((int)typeID.typeID)
|
||||
switch((int)typeID)
|
||||
{
|
||||
case ObjectType_LevelMetaData:
|
||||
{
|
||||
LevelMetaData* header = new LevelMetaData;
|
||||
ParseLevelMetaData(&buffer[counter], *header, counter);
|
||||
SmartPointer<ObjectTypeHeader> header = new LevelMetaData;
|
||||
ParseLevelMetaData(&buffer[counter], *(LevelMetaData*)header.Get(), counter);
|
||||
objects.push_back(header);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -126,6 +126,9 @@ namespace GameLogic
|
|||
struct ObjectTypeHeader
|
||||
{
|
||||
ObjectType typeID;
|
||||
|
||||
//Unless this is here the object destructor wont be called.
|
||||
virtual ~ObjectTypeHeader(){}
|
||||
};
|
||||
|
||||
namespace LevelLoaderInternal
|
||||
|
@ -182,6 +185,9 @@ namespace GameLogic
|
|||
WorldSize worldSize;
|
||||
std::string overviewPicturePath;
|
||||
std::vector<GameMode> gameModesSupported;
|
||||
|
||||
virtual ~LevelMetaData(){}
|
||||
|
||||
};
|
||||
|
||||
struct ObjectHeader : public ObjectTypeHeader, public LevelLoaderInternal::PhysicsObject
|
||||
|
@ -197,6 +203,8 @@ namespace GameLogic
|
|||
float angle;
|
||||
//Scale
|
||||
float scale[3];
|
||||
|
||||
virtual ~ObjectHeader(){}
|
||||
};
|
||||
|
||||
/************************************
|
||||
|
|
Loading…
Reference in New Issue