summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-16 21:46:16 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-16 21:46:16 +0300
commitfd1be78642317f2a99bf2e8fdb7d3966184fb910 (patch)
tree0e83eeac67f9f9d10b9ad14b649cbc07aa315fbc
parent7c6cb759593ec5abc8cf2a3b04a388c7cba269b8 (diff)
downloadmanaverse-fd1be78642317f2a99bf2e8fdb7d3966184fb910.tar.gz
manaverse-fd1be78642317f2a99bf2e8fdb7d3966184fb910.tar.bz2
manaverse-fd1be78642317f2a99bf2e8fdb7d3966184fb910.tar.xz
manaverse-fd1be78642317f2a99bf2e8fdb7d3966184fb910.zip
Remove destructors from some particle classes.
-rw-r--r--src/particle/animationparticle.cpp5
-rw-r--r--src/particle/animationparticle.h2
-rw-r--r--src/particle/imageparticle.cpp4
-rw-r--r--src/particle/imageparticle.h5
-rw-r--r--src/particle/particle.cpp20
-rw-r--r--src/particle/rotationalparticle.cpp5
-rw-r--r--src/particle/rotationalparticle.h2
7 files changed, 11 insertions, 32 deletions
diff --git a/src/particle/animationparticle.cpp b/src/particle/animationparticle.cpp
index 48a62db9f..dc9142e8a 100644
--- a/src/particle/animationparticle.cpp
+++ b/src/particle/animationparticle.cpp
@@ -40,8 +40,3 @@ AnimationParticle::AnimationParticle(XmlNodePtrConst animationNode,
mType = ParticleType::Animation;
mAnimation = new SimpleAnimation(animationNode, dyePalettes);
}
-
-AnimationParticle::~AnimationParticle()
-{
- mImage = nullptr;
-}
diff --git a/src/particle/animationparticle.h b/src/particle/animationparticle.h
index 67d11b393..5ea8e3599 100644
--- a/src/particle/animationparticle.h
+++ b/src/particle/animationparticle.h
@@ -40,8 +40,6 @@ class AnimationParticle final : public ImageParticle
= std::string());
A_DELETE_COPY(AnimationParticle)
-
- ~AnimationParticle();
};
#endif // PARTICLE_ANIMATIONPARTICLE_H
diff --git a/src/particle/imageparticle.cpp b/src/particle/imageparticle.cpp
index 57fbddd93..8d53bddce 100644
--- a/src/particle/imageparticle.cpp
+++ b/src/particle/imageparticle.cpp
@@ -49,10 +49,6 @@ ImageParticle::ImageParticle(Image *restrict const image) :
}
}
-ImageParticle::~ImageParticle()
-{
-}
-
void ImageParticle::draw(Graphics *restrict const graphics,
const int offsetX,
const int offsetY) const restrict2
diff --git a/src/particle/imageparticle.h b/src/particle/imageparticle.h
index 78217b863..98a0f3d25 100644
--- a/src/particle/imageparticle.h
+++ b/src/particle/imageparticle.h
@@ -46,11 +46,6 @@ class ImageParticle notfinal : public Particle
A_DELETE_COPY(ImageParticle)
/**
- * Destructor.
- */
- virtual ~ImageParticle();
-
- /**
* Draws the particle image
*/
virtual void draw(Graphics *restrict const graphics,
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp
index 22e350123..1df42724b 100644
--- a/src/particle/particle.cpp
+++ b/src/particle/particle.cpp
@@ -89,17 +89,19 @@ Particle::~Particle()
delete2(mAnimation);
if (mImage)
{
- const std::string &restrict name = mImage->getIdPath();
- StringIntMapIter it
- = ImageParticle::imageParticleCountByName.find(name);
- if (it != ImageParticle::imageParticleCountByName.end())
+ if (mType == ParticleType::Image)
{
- int &cnt = (*it).second;
- if (cnt > 0)
- cnt --;
+ 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->decRef();
mImage = nullptr;
}
diff --git a/src/particle/rotationalparticle.cpp b/src/particle/rotationalparticle.cpp
index 71e9f09fd..dd9ea79bb 100644
--- a/src/particle/rotationalparticle.cpp
+++ b/src/particle/rotationalparticle.cpp
@@ -41,8 +41,3 @@ RotationalParticle::RotationalParticle(const XmlNodePtr animationNode,
mType = ParticleType::Rotational;
mAnimation = new SimpleAnimation(animationNode, dyePalettes);
}
-
-RotationalParticle::~RotationalParticle()
-{
- mImage = nullptr;
-}
diff --git a/src/particle/rotationalparticle.h b/src/particle/rotationalparticle.h
index 2b986b13f..c0b163b21 100644
--- a/src/particle/rotationalparticle.h
+++ b/src/particle/rotationalparticle.h
@@ -39,8 +39,6 @@ class RotationalParticle final : public ImageParticle
= std::string());
A_DELETE_COPY(RotationalParticle)
-
- ~RotationalParticle();
};
#endif // PARTICLE_ROTATIONALPARTICLE_H