Remove bogus assert
[supertux.git] / src / video / sdl_surface_ptr.hpp
index 2fffc95..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,13 +27,28 @@ private:
   SDL_Surface* m_surface;
 
 public:
+  SDLSurfacePtr() :
+    m_surface(0)
+  {}
+
   SDLSurfacePtr(SDL_Surface* surface) :
     m_surface(surface)
   {}
 
-  ~SDLSurfacePtr() 
+  ~SDLSurfacePtr()
+  {
+    SDL_FreeSurface(m_surface);
+  }
+
+  SDL_Surface* operator->()
+  {
+    return m_surface;
+  }
+
+  void reset(SDL_Surface* surface)
   {
     SDL_FreeSurface(m_surface);
+    m_surface = surface;
   }
 
   SDL_Surface* get()