Fix variant-dependent pieces
[xboard.git] / draw.c
diff --git a/draw.c b/draw.c
index 625c0bd..99203b9 100644 (file)
--- a/draw.c
+++ b/draw.c
@@ -166,7 +166,6 @@ void
 InitDrawingSizes (BoardSize boardSize, int flags)
 {   // [HGM] resize is functional now, but for board format changes only (nr of ranks, files)
     int boardWidth, boardHeight;
-    int i;
     static int oldWidth, oldHeight;
     static VariantClass oldVariant;
     static int oldMono = -1, oldTwoBoards = 0;
@@ -282,17 +281,15 @@ ScaleOnePiece (int color, int piece)
 
   g_type_init ();
 
-  if(!svgPieces[color][piece]) { // try to freshly render cached svg pieces first, to supply the source bitmap
-    svgPieces[color][piece] = LoadSVG("", color, piece); // this fills pngPieceImages if we had cached svg with bitmap of wanted size
-  }
+  svgPieces[color][piece] = LoadSVG("", color, piece); // this fills pngPieceImages if we had cached svg with bitmap of wanted size
 
   if(!pngPieceImages[color][piece]) { // we don't have cached bitmap (implying we did not have cached svg)
     if(*appData.pieceDirectory) { // user specified piece directory
       snprintf(buf, MSG_SIZ, "%s/%s%s.png", appData.pieceDirectory, color ? "Black" : "White", pngPieceNames[piece]);
-      pngPieceImages[color][piece] = img = cairo_image_surface_create_from_png (buf); // try if there are png pieces there
+      img = cairo_image_surface_create_from_png (buf); // try if there are png pieces there
       if(cairo_surface_status(img) != CAIRO_STATUS_SUCCESS) { // there were not
        svgPieces[color][piece] = LoadSVG(appData.pieceDirectory, color, piece); // so try if he has svg there
-      }
+      } else pngPieceImages[color][piece] = img;
     }
   }