New sound effects
[supertux.git] / src / video / sdl_surface_ptr.hpp
index 4311e70..ac1c126 100644 (file)
@@ -1,5 +1,5 @@
 //  SuperTux
-//  Copyright (C) 2009 Ingo Ruhnke <grumbel@gmx.de>
+//  Copyright (C) 2009 Ingo Ruhnke <grumbel@gmail.com>
 //
 //  This program is free software: you can redistribute it and/or modify
 //  it under the terms of the GNU General Public License as published by
@@ -27,11 +27,15 @@ private:
   SDL_Surface* m_surface;
 
 public:
+  SDLSurfacePtr() :
+    m_surface(0)
+  {}
+
   SDLSurfacePtr(SDL_Surface* surface) :
     m_surface(surface)
   {}
 
-  ~SDLSurfacePtr() 
+  ~SDLSurfacePtr()
   {
     SDL_FreeSurface(m_surface);
   }
@@ -41,6 +45,12 @@ public:
     return m_surface;
   }
 
+  void reset(SDL_Surface* surface)
+  {
+    SDL_FreeSurface(m_surface);
+    m_surface = surface;
+  }
+
   SDL_Surface* get()
   {
     return m_surface;