mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-29 19:00:33 +02:00
Better freeing for memory in GameSave
This commit is contained in:
@@ -22,6 +22,8 @@ gravityMode(save.gravityMode),
|
|||||||
airMode(save.airMode),
|
airMode(save.airMode),
|
||||||
signs(save.signs)
|
signs(save.signs)
|
||||||
{
|
{
|
||||||
|
blockMap, blockMapPtr, fanVelX, fanVelXPtr, fanVelY, fanVelYPtr, particles = NULL;
|
||||||
|
|
||||||
setSize(save.blockWidth, save.blockHeight);
|
setSize(save.blockWidth, save.blockHeight);
|
||||||
|
|
||||||
particlesCount = save.particlesCount;
|
particlesCount = save.particlesCount;
|
||||||
@@ -33,6 +35,7 @@ signs(save.signs)
|
|||||||
|
|
||||||
GameSave::GameSave(int width, int height)
|
GameSave::GameSave(int width, int height)
|
||||||
{
|
{
|
||||||
|
blockMap, blockMapPtr, fanVelX, fanVelXPtr, fanVelY, fanVelYPtr, particles = NULL;
|
||||||
setSize(width, height);
|
setSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1672,26 +1675,18 @@ fin:
|
|||||||
|
|
||||||
GameSave::~GameSave()
|
GameSave::~GameSave()
|
||||||
{
|
{
|
||||||
if(blockWidth && blockHeight)
|
|
||||||
{
|
|
||||||
if(particles)
|
if(particles)
|
||||||
{
|
|
||||||
delete[] particles;
|
delete[] particles;
|
||||||
}
|
|
||||||
if(blockMap)
|
if(blockMap)
|
||||||
{
|
|
||||||
delete[] blockMapPtr;
|
|
||||||
delete[] blockMap;
|
delete[] blockMap;
|
||||||
}
|
if(blockMapPtr)
|
||||||
|
delete[] blockMapPtr;
|
||||||
if(fanVelX)
|
if(fanVelX)
|
||||||
{
|
|
||||||
delete[] fanVelXPtr;
|
|
||||||
delete[] fanVelX;
|
delete[] fanVelX;
|
||||||
}
|
if(fanVelXPtr)
|
||||||
|
delete[] fanVelXPtr;
|
||||||
if(fanVelY)
|
if(fanVelY)
|
||||||
{
|
|
||||||
delete[] fanVelYPtr;
|
|
||||||
delete[] fanVelY;
|
delete[] fanVelY;
|
||||||
}
|
if(fanVelYPtr)
|
||||||
}
|
delete[] fanVelYPtr;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user