Fixed #726 - explosions not removed when restarting

a race.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11889 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2012-11-07 11:23:17 +00:00
parent a541eef436
commit c720ed602e

View File

@@ -38,7 +38,7 @@ Explosion::Explosion(const Vec3& coord, const char* explosion_sound)
// short emision time, explosion, not constant flame
m_remaining_time = burst_time;
m_node = irr_driver->addParticleNode();
m_node->grab();
#ifdef DEBUG
m_node->setName("explosion");
#endif
@@ -77,6 +77,13 @@ Explosion::Explosion(const Vec3& coord, const char* explosion_sound)
*/
Explosion::~Explosion()
{
if(m_node)
{
m_node->drop();
// Remove from scene node by removing from parent.
irr_driver->removeNode(m_node);
m_node = NULL;
}
} // ~Explosion
//-----------------------------------------------------------------------------
@@ -125,9 +132,9 @@ bool Explosion::updateAndDelete(float dt)
}
else
{
// Sound and animation finished --> remove node
irr_driver->removeNode(m_node);
m_node = NULL;
// Sound and animation finished, node can be removed now.
// Returning true will cause this node to be deleted by
// the projectile manager.
return true; // finished
}