X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsdl.c;h=ef68a08e90f408b2658ce2df76c18bed010563ba;hb=dfe0a71a9939e0c55bb54dcc92db1749e8e21747;hp=7cd641187a18293e761c2d801b677cd1b3e121f6;hpb=e0e2697df0d0da483a91b1248c120aef6b3caf9b;p=rocksndiamonds.git diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 7cd64118..ef68a08e 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -829,21 +829,33 @@ Bitmap *SDLLoadImage(char *filename) /* load image to temporary surface */ if ((sdl_image_tmp = IMG_Load(filename)) == NULL) - Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError()); + { + SetError("IMG_Load(): %s", SDL_GetError()); + return NULL; + } /* create native non-transparent surface for current image */ if ((new_bitmap->surface = SDL_DisplayFormat(sdl_image_tmp)) == NULL) - Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError()); + { + SetError("SDL_DisplayFormat(): %s", SDL_GetError()); + return NULL; + } /* create native transparent surface for current image */ SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY, SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00)); if ((new_bitmap->surface_masked = SDL_DisplayFormat(sdl_image_tmp)) == NULL) - Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError()); + { + SetError("SDL_DisplayFormat(): %s", SDL_GetError()); + return NULL; + } /* free temporary surface */ SDL_FreeSurface(sdl_image_tmp); + new_bitmap->width = new_bitmap->surface->w; + new_bitmap->height = new_bitmap->surface->h; + return new_bitmap; }