diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-16 21:21:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-16 21:21:32 +0300 |
commit | c4a6dd36733fc3365d5a8913e8cdc7b4c1175c8d (patch) | |
tree | e5ff4ebbe3f233f89a3e813691483273554e7f99 /src/particle/particle.cpp | |
parent | b08de2d689c845c740fd25294bf93adf226fdb97 (diff) | |
download | manaverse-c4a6dd36733fc3365d5a8913e8cdc7b4c1175c8d.tar.gz manaverse-c4a6dd36733fc3365d5a8913e8cdc7b4c1175c8d.tar.bz2 manaverse-c4a6dd36733fc3365d5a8913e8cdc7b4c1175c8d.tar.xz manaverse-c4a6dd36733fc3365d5a8913e8cdc7b4c1175c8d.zip |
Move image field from ImageParticle into Particle.
Diffstat (limited to 'src/particle/particle.cpp')
-rw-r--r-- | src/particle/particle.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index 0805aed8c..db25f3c77 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -32,6 +32,7 @@ #include "particle/rotationalparticle.h" #include "particle/textparticle.h" +#include "resources/image.h" #include "resources/resourcemanager.h" #include "resources/animation/simpleanimation.h" @@ -60,6 +61,7 @@ Particle::Particle() : mAlive(AliveStatus::ALIVE), mType(ParticleType::Normal), mAnimation(nullptr), + mImage(nullptr), mChildEmitters(), mChildParticles(), mDeathEffect(), @@ -83,6 +85,22 @@ Particle::~Particle() // Delete child emitters and child particles clear(); delete2(mAnimation); + if (mImage) + { + const std::string &restrict name = mImage->getIdPath(); + StringIntMapIter it + = ImageParticle::imageParticleCountByName.find(name); + if (it != ImageParticle::imageParticleCountByName.end()) + { + int &cnt = (*it).second; + if (cnt > 0) + cnt --; + } + + mImage->decRef(); + mImage = nullptr; + } + ParticleEngine::particleCount--; } |