summaryrefslogtreecommitdiff
path: root/src/particle/particle.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-23 02:14:30 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-23 02:14:30 +0300
commit6a65a4cf5b6b10839254c0c5846ec2dbfea882f8 (patch)
treecdf1dcc071ab18575defff569d33f3cbc8be0348 /src/particle/particle.cpp
parent1a5f8957c707625efbcf36722b057d5eda5a21bb (diff)
downloadmv-6a65a4cf5b6b10839254c0c5846ec2dbfea882f8.tar.gz
mv-6a65a4cf5b6b10839254c0c5846ec2dbfea882f8.tar.bz2
mv-6a65a4cf5b6b10839254c0c5846ec2dbfea882f8.tar.xz
mv-6a65a4cf5b6b10839254c0c5846ec2dbfea882f8.zip
Allow delete untracker being particle effects.
This fix some possible memory leaks.
Diffstat (limited to 'src/particle/particle.cpp')
-rw-r--r--src/particle/particle.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp
index 4e7b154c0..a04cee6f3 100644
--- a/src/particle/particle.cpp
+++ b/src/particle/particle.cpp
@@ -22,8 +22,11 @@
#include "particle/particle.h"
+#include "actormanager.h"
#include "logger.h"
+#include "being/actorsprite.h"
+
#include "particle/animationparticle.h"
#include "particle/particleemitter.h"
#include "particle/rotationalparticle.h"
@@ -61,6 +64,7 @@ Particle::Particle() :
mType(ParticleType::Normal),
mAnimation(nullptr),
mImage(nullptr),
+ mActor(BeingId_zero),
mChildEmitters(),
mChildParticles(),
mChildMoveParticles(),
@@ -82,6 +86,13 @@ Particle::Particle() :
Particle::~Particle()
{
+ if (mActor != BeingId_zero &&
+ actorManager)
+ {
+ ActorSprite *const actor = actorManager->findActor(mActor);
+ if (actor)
+ actor->controlParticleDeleted(this);
+ }
// Delete child emitters and child particles
clear();
delete2(mAnimation);