From 0a6563fcc2f49857c581d9def24407a3a4ef526c Mon Sep 17 00:00:00 2001 From: andyq Date: Tue, 21 Jan 2003 20:37:00 +0000 Subject: Clean up of code - fixed memory leaks (most of them) and added new custom config menu --- (limited to 'noncore/games/sfcave-sdl/animatedimage.cpp') diff --git a/noncore/games/sfcave-sdl/animatedimage.cpp b/noncore/games/sfcave-sdl/animatedimage.cpp index d9d6ff6..441c647 100644 --- a/noncore/games/sfcave-sdl/animatedimage.cpp +++ b/noncore/games/sfcave-sdl/animatedimage.cpp @@ -4,7 +4,7 @@ #include "constants.h" #include "animatedimage.h" -AnimatedImage :: AnimatedImage( QString file, int nFrames ) +AnimatedImage :: AnimatedImage( string file, int nFrames ) { nrFrames = nFrames; currentFrame = 0; @@ -19,9 +19,6 @@ AnimatedImage :: AnimatedImage( QString file, int nFrames ) } SDL_SetColorKey(image, SDL_SRCCOLORKEY | SDL_RLEACCEL, SDL_MapRGB( image->format, 0, 0, 0 ) ); -// image = SDL_DisplayFormat( tmp ); - -// SDL_FreeSurface( tmp ); frameWidth = image->w/nrFrames; frameHeight = image->h; } @@ -47,6 +44,9 @@ bool AnimatedImage :: nextFrame() void AnimatedImage :: draw( SDL_Surface *screen, int x, int y ) { + if ( !image ) + return; + SDL_Rect dst; dst.x = currentFrame * frameWidth; dst.y = 0; -- cgit v0.9.0.2