Checking if badguy is active before double-killing in a few more places
authorTobias Markus <tobbi@mozilla-uk.org>
Fri, 23 Aug 2013 14:18:38 +0000 (16:18 +0200)
committerTobias Markus <tobbi@mozilla-uk.org>
Sat, 26 Oct 2013 16:45:19 +0000 (18:45 +0200)
src/badguy/badguy.cpp

index 8cbec1d..0cca9f5 100644 (file)
@@ -359,6 +359,8 @@ BadGuy::collision_bullet(Bullet& bullet, const CollisionHit& hit)
 void
 BadGuy::kill_squished(GameObject& object)
 {
+  if (!is_active()) return;
+
   sound_manager->play("sounds/squish.wav", get_pos());
   physic.enable_gravity(true);
   physic.set_velocity_x(0);
@@ -377,6 +379,8 @@ BadGuy::kill_squished(GameObject& object)
 void
 BadGuy::kill_fall()
 {
+  if (!is_active()) return;
+
   sound_manager->play("sounds/fall.wav", get_pos());
   physic.set_velocity_y(0);
   physic.set_acceleration_y(0);