Replaced Ref and RefCounter with std::shared_ptr<>
[supertux.git] / src / object / wind.cpp
index 7a9c6f1..db27bb4 100644 (file)
@@ -27,9 +27,9 @@
 #include "video/drawing_context.hpp"
 
 Wind::Wind(const Reader& reader) :
-  blowing(true), 
+  blowing(true),
   speed(),
-  acceleration(100), 
+  acceleration(100),
   elapsed_time(0)
 {
   reader.get("name", name);
@@ -53,18 +53,18 @@ Wind::Wind(const Reader& reader) :
 }
 
 void
-Wind::update(float elapsed_time)
+Wind::update(float elapsed_time_)
 {
-  this->elapsed_time = elapsed_time;
+  this->elapsed_time = elapsed_time_;
 
   if (!blowing) return;
 
   // TODO: nicer, configurable particles for wind?
-  if (systemRandom.rand(0, 100) < 20) {
+  if (graphicsRandom.rand(0, 100) < 20) {
     // emit a particle
-    Vector ppos = Vector(systemRandom.randf(bbox.p1.x+8, bbox.p2.x-8), systemRandom.randf(bbox.p1.y+8, bbox.p2.y-8));
+    Vector ppos = Vector(graphicsRandom.randf(bbox.p1.x+8, bbox.p2.x-8), graphicsRandom.randf(bbox.p1.y+8, bbox.p2.y-8));
     Vector pspeed = Vector(speed.x, speed.y);
-    Sector::current()->add_object(new Particles(ppos, 44, 46, pspeed, Vector(0,0), 1, Color(.4f, .4f, .4f), 3, .1f,
+    Sector::current()->add_object(std::make_shared<Particles>(ppos, 44, 46, pspeed, Vector(0,0), 1, Color(.4f, .4f, .4f), 3, .1f,
                                                 LAYER_BACKGROUNDTILES+1));
   }
 }
@@ -95,8 +95,8 @@ Wind::expose(HSQUIRRELVM vm, SQInteger table_idx)
   if (name == "")
     return;
 
-  Scripting::Wind* interface = new Scripting::Wind(this);
-  expose_object(vm, table_idx, interface, name, true);
+  scripting::Wind* _this = new scripting::Wind(this);
+  expose_object(vm, table_idx, _this, name, true);
 }
 
 void
@@ -105,7 +105,7 @@ Wind::unexpose(HSQUIRRELVM vm, SQInteger table_idx)
   if (name == "")
     return;
 
-  Scripting::unexpose_object(vm, table_idx, name);
+  scripting::unexpose_object(vm, table_idx, name);
 }
 
 void
@@ -120,6 +120,4 @@ Wind::stop()
   blowing = false;
 }
 
-IMPLEMENT_FACTORY(Wind, "wind");
-
 /* EOF */