[Orxonox-commit 5776] r10436 - code/branches/weaponFS15/src/modules/weapons/projectiles

meggiman at orxonox.net meggiman at orxonox.net
Thu May 7 22:45:20 CEST 2015


Author: meggiman
Date: 2015-05-07 22:45:20 +0200 (Thu, 07 May 2015)
New Revision: 10436

Modified:
   code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.cc
Log:
Fixed dangling pointer bug when GravityBomb was destroyed by tick of base class because of collision with other pawns.


Modified: code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.cc
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.cc	2015-05-07 15:43:36 UTC (rev 10435)
+++ code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.cc	2015-05-07 20:45:20 UTC (rev 10436)
@@ -53,14 +53,13 @@
 
 	void GravityBomb::tick(float dt)
 	{
-			SUPER(GravityBomb,tick,dt);
 			timeToLife_ -= dt;
 			if(timeToLife_ < 0)
 			{
 				orxout(debug_output) << "bomb has stoped moving" <<endl;
 				setVelocity(Vector3::ZERO);
 				setAcceleration(Vector3::ZERO);
-				detonate();
+				isDetonated_ = true;
 			}
 			else
 			{
@@ -68,6 +67,7 @@
 				destroyCheck();
 			}
 			if(isDetonated_) detonate();
+			else SUPER(GravityBomb, tick, dt);
 	}
 
 	bool GravityBomb::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)




More information about the Orxonox-commit mailing list