Added TexturePtr
[supertux.git] / src / video / sdl / sdl_lightmap.cpp
index a5e15ed..b523fbc 100644 (file)
 #include "video/sdl/sdl_surface_data.hpp"
 #include "video/sdl/sdl_texture.hpp"
 
-SDLLightmap::SDLLightmap()
+SDLLightmap::SDLLightmap() :
+  screen(),
+  red_channel(),
+  blue_channel(),
+  green_channel(),
+  width(),
+  height(),
+  numerator(),
+  denominator(),
+  LIGHTMAP_DIV()
 {
   screen = SDL_GetVideoSurface();
 
@@ -442,7 +451,7 @@ SDLLightmap::draw_surface(const DrawingRequest& request)
   //FIXME: support parameters request.alpha, request.angle, request.blend
  
   const Surface* surface = (const Surface*) request.request_data;
-  SDLTexture *sdltexture = dynamic_cast<SDLTexture *>(surface->get_texture());
+  boost::shared_ptr<SDLTexture> sdltexture = boost::dynamic_pointer_cast<SDLTexture>(surface->get_texture());
   SDLSurfaceData *surface_data = reinterpret_cast<SDLSurfaceData *>(surface->get_surface_data());
 
   DrawingEffect effect = request.drawing_effect;
@@ -469,7 +478,7 @@ SDLLightmap::draw_surface_part(const DrawingRequest& request)
     = (SurfacePartRequest*) request.request_data;
 
   const Surface* surface = surfacepartrequest->surface;
-  SDLTexture *sdltexture = dynamic_cast<SDLTexture *>(surface->get_texture());
+  boost::shared_ptr<SDLTexture> sdltexture = boost::dynamic_pointer_cast<SDLTexture>(surface->get_texture());
 
   DrawingEffect effect = request.drawing_effect;
   if (surface->get_flipx()) effect = HORIZONTAL_FLIP;