Replaced Ref and RefCounter with std::shared_ptr<>
[supertux.git] / src / scripting / floating_image.cpp
index 270814d..2264d0d 100644 (file)
 #include "supertux/sector.hpp"
 #include "worldmap/worldmap.hpp"
 
-namespace Scripting {
+namespace scripting {
 
-FloatingImage::FloatingImage(const std::string& spritefile)
+FloatingImage::FloatingImage(const std::string& spritefile) :
+  floating_image()
 {
-  using namespace WorldMapNS;
+  using namespace worldmap;
 
-  floating_image = new _FloatingImage(spritefile);
+  floating_image = std::make_shared<_FloatingImage>(spritefile);
   if(Sector::current() != NULL) {
-    Sector::current()->add_object(floating_image.get());
+    Sector::current()->add_object(floating_image);
   } else if(WorldMap::current() != NULL) {
-    WorldMap::current()->add_object(floating_image.get());
+    WorldMap::current()->add_object(floating_image);
   } else {
     throw new std::runtime_error("Neither sector nor worldmap active");
   }