Fall back on Tile SVG in pieceImageDirectory
[xboard.git] / draw.c
diff --git a/draw.c b/draw.c
index 40a4393..5d268f2 100644 (file)
--- a/draw.c
+++ b/draw.c
@@ -311,8 +311,15 @@ LoadSVG (char *dir, int color, int piece, int retry)
 
     snprintf(buf, MSG_SIZ, "%s/%s%s.svg", dir, color ? "Black" : "White", name);
 
-    if(svg || *dir && (svg = rsvg_handle_new_from_file(buf, &svgerror))) {
+    if(!svg && *dir) {
+      svg = rsvg_handle_new_from_file(buf, &svgerror);
+      if(!svg && *appData.inscriptions) { // if there is no piece-specific SVG, but we make inscriptions, try general background
+       snprintf(buf, MSG_SIZ, "%s/%sTile.svg", dir, color ? "Black" : "White");
+       svg = rsvg_handle_new_from_file(buf, &svgerror);
+      }
+    }
 
+    if(svg) {
       rsvg_handle_get_dimensions(svg, &svg_dimensions);
       img = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, squareSize,  squareSize);