added selecting new level set if dropped as zip file into window
[rocksndiamonds.git] / src / tools.c
index 6763d611a6d9ac384dc0228337f934afe45fcc39..33b677954947107346e76e69d65f778027d1e2f6 100644 (file)
@@ -1150,10 +1150,12 @@ void FadeSkipNextFadeOut(void)
 
 static Bitmap *getBitmapFromGraphicOrDefault(int graphic, int default_graphic)
 {
+  if (graphic == IMG_UNDEFINED)
+    return NULL;
+
   boolean redefined = getImageListEntryFromImageID(graphic)->redefined;
 
-  return (graphic == IMG_UNDEFINED ? NULL :
-         graphic_info[graphic].bitmap != NULL || redefined ?
+  return (graphic_info[graphic].bitmap != NULL || redefined ?
          graphic_info[graphic].bitmap :
          graphic_info[default_graphic].bitmap);
 }
@@ -9658,6 +9660,8 @@ void ChangeViewportPropertiesIfNeeded(void)
   {
     // printf("::: init_video_buffer\n");
 
+    FreeAllImageTextures();    // needs old renderer to free the textures
+
     InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen);
     InitImageTextures();
   }