No more segfaults when trying to spawn bullets of unknown type
[supertux.git] / src / object / firefly.cpp
index dc537cc..8dd4fe4 100644 (file)
@@ -49,7 +49,7 @@ Firefly::Firefly(const lisp::Lisp& lisp)
   reactivate();
 }
 
-void 
+void
 Firefly::reactivate()
 {
   if(GameSession::current()->get_reset_point_pos() == initial_position){
@@ -82,16 +82,16 @@ Firefly::collision(GameObject& other, const CollisionHit& )
     activated = true;
 // spawn some particles
 // TODO: provide convenience function in MovingSprite or MovingObject?
-          for (int i = 0; i < 5; i++) {
-            Vector ppos = bbox.get_middle();
-            float angle = systemRandom.randf(-M_PI_2, M_PI_2);
-            float velocity = systemRandom.randf(450, 900);
-            float vx = sin(angle)*velocity;
-            float vy = -cos(angle)*velocity;
-            Vector pspeed = Vector(vx, vy);
-            Vector paccel = Vector(0, 1000);
-            Sector::current()->add_object(new SpriteParticle("images/objects/particles/reset.sprite", "default", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS-1));
-          }
+       for (int i = 0; i < 5; i++) {
+         Vector ppos = bbox.get_middle();
+         float angle = systemRandom.randf(-M_PI_2, M_PI_2);
+         float velocity = systemRandom.randf(450, 900);
+         float vx = sin(angle)*velocity;
+         float vy = -cos(angle)*velocity;
+         Vector pspeed = Vector(vx, vy);
+         Vector paccel = Vector(0, 1000);
+         Sector::current()->add_object(new SpriteParticle("images/objects/particles/reset.sprite", "default", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS-1));
+       }
     // TODO play sound
     sprite->set_action("ringing");
     GameSession::current()->set_reset_point(Sector::current()->get_name(),