summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--src/being.cpp13
-rw-r--r--src/particle.h3
3 files changed, 20 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index cdbc6492..1d960159 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
-2007-06-06 Bjørn Lindeijer <bjorn@lindeijer.nl>
+2007-06-11 Philipp Sehmisch <tmw@crushnet.org>
+
+ * src/particle.h, src/being.cpp: Fixed a bug that prevented being-controlled
+ particles from being deleted (thanks to tuchs for reporting).
+
+2007-06-06 Bjørn Lindeijer <bjorn@lindeijer.nl>
* data/items.xml: Fixed defense of silk headband.
diff --git a/src/being.cpp b/src/being.cpp
index 45032f6f..0ddceb0f 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -391,10 +391,19 @@ Being::logic()
//Update particle effects
for ( std::list<Particle *>::iterator i = mChildParticleEffects.begin();
- i != mChildParticleEffects.end();
- i++)
+ i != mChildParticleEffects.end();
+
+ )
{
(*i)->setPosition((float)mPx + 16.0f, (float)mPy + 32.0f);
+ if (!(*i)->isAlive())
+ {
+ (*i)->kill();
+ i = mChildParticleEffects.erase(i);
+ }
+ else {
+ i++;
+ }
}
}
diff --git a/src/particle.h b/src/particle.h
index 7a747a5f..9e9223c7 100644
--- a/src/particle.h
+++ b/src/particle.h
@@ -243,6 +243,9 @@ class Particle : public Sprite
void setDieDistance(float dist)
{ mInvDieDistance = 1.0f / dist; }
+ bool isAlive()
+ { return mAlive; }
+
/**
* Manually marks the particle for deletion
*/