Replaced Ref and RefCounter with std::shared_ptr<>
[supertux.git] / src / badguy / poisonivy.cpp
index 5b28671..799d040 100644 (file)
@@ -35,6 +35,12 @@ PoisonIvy::PoisonIvy(const Vector& pos, Direction d)
 }
 
 bool
+PoisonIvy::is_freezable() const
+{
+  return true;
+}
+
+bool
 PoisonIvy::collision_squished(GameObject& object)
 {
   sprite->set_action(dir == LEFT ? "squished-left" : "squished-right");
@@ -42,13 +48,17 @@ PoisonIvy::collision_squished(GameObject& object)
   // TODO: provide convenience function in MovingSprite or MovingObject?
   for (int i = 0; i < 3; i++) {
     Vector ppos = bbox.get_middle();
-    float angle = systemRandom.randf(-M_PI_2, M_PI_2);
-    float velocity = systemRandom.randf(350, 400);
+    float angle = graphicsRandom.randf(-M_PI_2, M_PI_2);
+    float velocity = graphicsRandom.randf(350, 400);
     float vx = sin(angle)*velocity;
     float vy = -cos(angle)*velocity;
     Vector pspeed = Vector(vx, vy);
     Vector paccel = Vector(0, 100);
-    Sector::current()->add_object(new SpriteParticle("images/objects/particles/poisonivy.sprite", "default", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS-1));
+    Sector::current()->add_object(std::make_shared<SpriteParticle>("images/objects/particles/poisonivy.sprite",
+                                                                   "default",
+                                                                   ppos, ANCHOR_MIDDLE,
+                                                                   pspeed, paccel,
+                                                                   LAYER_OBJECTS-1));
   }
   kill_squished(object);
   return true;