summaryrefslogtreecommitdiff
path: root/src/particle/particle.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-18 18:42:51 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-19 15:12:21 +0300
commit2033ce76a8fba2148bc034d16e1d226bc757c47f (patch)
tree08a53fde19959fc72c09c42b457f63d63aba291d /src/particle/particle.cpp
parente441e9e40d27930f3533ffecfa2a48e4fd312f4c (diff)
downloadplus-2033ce76a8fba2148bc034d16e1d226bc757c47f.tar.gz
plus-2033ce76a8fba2148bc034d16e1d226bc757c47f.tar.bz2
plus-2033ce76a8fba2148bc034d16e1d226bc757c47f.tar.xz
plus-2033ce76a8fba2148bc034d16e1d226bc757c47f.zip
remove virtual methos call from particle constructor.
Diffstat (limited to 'src/particle/particle.cpp')
-rw-r--r--src/particle/particle.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp
index 1427ffae0..7bdc24345 100644
--- a/src/particle/particle.cpp
+++ b/src/particle/particle.cpp
@@ -52,7 +52,7 @@ int Particle::emitterSkip = 1;
bool Particle::enabled = true;
const float Particle::PARTICLE_SKY = 800.0F;
-Particle::Particle(Map *const map) :
+Particle::Particle() :
Actor(),
mAlpha(1.0F),
mLifetimeLeft(-1),
@@ -76,7 +76,6 @@ Particle::Particle(Map *const map) :
mAllowSizeAdjust(false),
mFollow(false)
{
- setMap(map);
Particle::particleCount++;
}
@@ -276,7 +275,8 @@ void Particle::moveTo(const float x, const float y)
Particle *Particle::createChild()
{
- Particle *const newParticle = new Particle(mMap);
+ Particle *const newParticle = new Particle();
+ newParticle->setMap(mMap);
mChildParticles.push_back(newParticle);
return newParticle;
}
@@ -314,13 +314,15 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
// Animation
if ((node = XML::findFirstChildByName(effectChildNode, "animation")))
{
- newParticle = new AnimationParticle(mMap, node, dyePalettes);
+ newParticle = new AnimationParticle(node, dyePalettes);
+ newParticle->setMap(mMap);
}
// Rotational
else if ((node = XML::findFirstChildByName(
effectChildNode, "rotation")))
{
- newParticle = new RotationalParticle(mMap, node, dyePalettes);
+ newParticle = new RotationalParticle(node, dyePalettes);
+ newParticle->setMap(mMap);
}
// Image
else if ((node = XML::findFirstChildByName(effectChildNode, "image")))
@@ -331,12 +333,14 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
Dye::instantiate(imageSrc, dyePalettes);
Image *const img = resman->getImage(imageSrc);
- newParticle = new ImageParticle(mMap, img);
+ newParticle = new ImageParticle(img);
+ newParticle->setMap(mMap);
}
// Other
else
{
- newParticle = new Particle(mMap);
+ newParticle = new Particle();
+ newParticle->setMap(mMap);
}
// Read and set the basic properties of the particle
@@ -415,8 +419,8 @@ Particle *Particle::addTextSplashEffect(const std::string &text,
gcn::Font *const font,
const bool outline)
{
- Particle *const newParticle = new TextParticle(
- mMap, text, color, font, outline);
+ Particle *const newParticle = new TextParticle(text, color, font, outline);
+ newParticle->setMap(mMap);
newParticle->moveTo(static_cast<float>(x), static_cast<float>(y));
newParticle->setVelocity(
static_cast<float>((rand() % 100) - 50) / 200.0F, // X
@@ -439,8 +443,8 @@ Particle *Particle::addTextRiseFadeOutEffect(const std::string &text,
gcn::Font *const font,
const bool outline)
{
- Particle *const newParticle = new TextParticle(
- mMap, text, color, font, outline);
+ Particle *const newParticle = new TextParticle(text, color, font, outline);
+ newParticle->setMap(mMap);
newParticle->moveTo(static_cast<float>(x), static_cast<float>(y));
newParticle->setVelocity(0.0F, 0.0F, 0.5F);
newParticle->setGravity(0.0015F);