Game Development Community

Bug in explosion.cc

by Daniel Dobson · in Torque Game Engine · 07/15/2005 (11:26 am) · 1 replies

I have a demo I've been working on for a while, and it has lots of explosions. I noticed that I'd get weird crashes when I had many enemies and lots of explosions (like, dozens of enemies, hundreds of explosions). I traced it back to game/fx/explosion.cc and processTick(). The corrected code is below.

//--------------------------------------------------------------------------
void Explosion::processTick(const Move*)
{
   mCurrMS += TickMs;

   if( mCurrMS >= mEndingMS )
   {
      deleteObject();
      // I added this return.  Otherwise it's going to delete the object but then call explode() on it
      return;
   }

   if( (mCurrMS > mDelayMS) && !mActive )
      explode();
}

This made my segfaults go away. Does this seem right to you guys?

#1
02/07/2007 (12:22 pm)
Definitely seems right to me, shouldn't be doing anything after deleteObject is called!


this bug is in 1.5 still as well.

Tim at Doppelganger just found the same problem with our code after I started using explosions recently.