fixed aborting program due to '-psn' parameter when launched via GUI on Mac
[rocksndiamonds.git] / src / libgame / image.c
index 14fd7c65de90badadcab8c8d79e3baec070831e0..7fc7e2b82bca4edbaad546b5e996ac623b545658 100644 (file)
@@ -270,16 +270,10 @@ static boolean CheckIfImageContainsSmallImages(ImageInfo *img_info,
   // custom artwork set redefines classic (or default) graphics with wrong tile
   // size (by mistake or by intention), it will be corrected to its original
   // tile size here by forcing complete re-creation of all small images again
-  // (this does not work if different tile sizes are used in same image file)
 
   if (!strEqual(img_info->leveldir, leveldir_current->identifier) &&
       img_info->conf_tile_size != tile_size)
   {
-#if 0
-    printf("::: RE-CREATING DEFAULT TILE SIZE: %d -> %d\n",
-          img_info->conf_tile_size, tile_size);
-#endif
-
     int bitmap_nr = GET_BITMAP_ID_FROM_TILESIZE(img_info->conf_tile_size);
     int i;
 
@@ -309,6 +303,16 @@ static boolean CheckIfImageContainsSmallImages(ImageInfo *img_info,
     return FALSE;
   }
 
+  // special case 1 (continued):
+  //
+  // if different tile sizes are used in same image file (usually by mistake,
+  // like forgetting option ".tile_size" for one or more graphic definitions),
+  // make sure to use only the first tile size that is processed for this image
+  // (and ignore all subsequent, potentially different tile size definitions
+  // for this image within the current level set by disabling the above check)
+
+  setString(&img_info->leveldir, leveldir_current->identifier);
+
   // special case 2:
   //
   // graphic config setting "game.tile_size" has changed since last level set;
@@ -316,12 +320,6 @@ static boolean CheckIfImageContainsSmallImages(ImageInfo *img_info,
 
   if (img_info->game_tile_size != gfx.game_tile_size)
   {
-#if 0
-    if (strSuffix(img_info->source_filename, "RocksHeroes.png"))
-      printf("::: RE-CREATING IN-GAME TILE SIZE: %d -> %d\n",
-            img_info->game_tile_size, gfx.game_tile_size);
-#endif
-
     ReCreateGameTileSizeBitmap(img_info->bitmaps);
 
     img_info->game_tile_size = gfx.game_tile_size;