Replaced Ref and RefCounter with std::shared_ptr<>
[supertux.git] / src / object / coin_rain.cpp
index c3b10e5..7e6b4c3 100644 (file)
@@ -50,7 +50,7 @@ CoinRain::update(float elapsed_time)
   } // then the first collectable coin drops from one of ten random positions
   else if (counter==0){
     drop = gameRandom.rand(10);
-    Sector::current()->add_object(new HeavyCoin(Vector (position.x+32*((drop<5)?-drop-1:drop-4),-32), Vector (0,0)));
+    Sector::current()->add_object(std::make_shared<HeavyCoin>(Vector (position.x+32*((drop<5)?-drop-1:drop-4),-32), Vector (0,0)));
     counter++;
     timer.start(DROP_TIME);
   } // finally the remainder of the coins drop in a determined but appears to be a random order
@@ -58,7 +58,7 @@ CoinRain::update(float elapsed_time)
     if(counter<10){
       drop += 7;
       if(drop >= 10) drop -=10;
-      Sector::current()->add_object(new HeavyCoin(Vector (position.x+32*((drop<5)?-drop-1:drop-4),-32), Vector (0,0)));
+      Sector::current()->add_object(std::make_shared<HeavyCoin>(Vector (position.x+32*((drop<5)?-drop-1:drop-4),-32), Vector (0,0)));
       counter++;
       timer.start(DROP_TIME);
     }else{