Added TexturePtr
[supertux.git] / src / object / ghost_particle_system.cpp
index 4b493a4..17ddcf4 100644 (file)
 #include <math.h>
 
 #include "math/random_generator.hpp"
-#include "supertux/main.hpp"
+#include "supertux/globals.hpp"
 #include "video/drawing_context.hpp"
 
 //FIXME: Sometimes both ghosts have the same image
 //       Ghosts don't change their movement pattern - not random
 GhostParticleSystem::GhostParticleSystem()
 {
-  ghosts[0] = new Surface("images/objects/particles/ghost0.png");
-  ghosts[1] = new Surface("images/objects/particles/ghost1.png");
+  ghosts[0] = Surface::create("images/objects/particles/ghost0.png");
+  ghosts[1] = Surface::create("images/objects/particles/ghost1.png");
 
   virtual_width = SCREEN_WIDTH * 2;
 
@@ -52,8 +52,6 @@ GhostParticleSystem::parse(const Reader& reader)
 
 GhostParticleSystem::~GhostParticleSystem()
 {
-  for(int i=0;i<2;++i)
-    delete ghosts[i];
 }
 
 void GhostParticleSystem::update(float elapsed_time)