X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=blobdiff_plain;f=draw.c;h=82072bfc9f15ed46a78e5c4efd4a1604ddebe040;hp=4ad6887c967171130df3bbb2bcc68ff84fdeb100;hb=caebf04d588b07dd8691c65a9b5cc145829e69b9;hpb=7f8decab1cc394f7a798b04fc0a3de4edf043877 diff --git a/draw.c b/draw.c index 4ad6887..82072bf 100644 --- a/draw.c +++ b/draw.c @@ -351,6 +351,15 @@ LoadSVG (char *dir, int color, int piece, int retry) if(!svg && *dir) { svg = rsvg_handle_new_from_file(buf, &svgerror); + if(!svg) { // failed! If -pid name starts with "sub_" we try to load the piece from the parent directory + char *p = buf, *q; + safeStrCpy(buf, dir, MSG_SIZ); + while((q = strchr(p, '/'))) p = q + 1; + if(!strncmp(p, "sub_", 4)) { + if(p == buf) safeStrCpy(buf, ".", MSG_SIZ); else p[-1] = NULLCHAR; // strip last directory off path + return LoadSVG(buf, color, piece, retry); + } + } 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);