X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=b2ec75aa73b8aa07e3d1dfe03537f14df8b35569;hb=c6cb9e16126dd82a6727d4ca9f3a3507dbfb92ab;hp=bd37f6daf7526652d58244f7c3745db529ce1e2f;hpb=4d3fc238587cf474577210196630a69530cd7c2b;p=xboard.git diff --git a/backend.c b/backend.c index bd37f6d..b2ec75a 100644 --- a/backend.c +++ b/backend.c @@ -5956,7 +5956,7 @@ ptclen (const char *s, char *escapes) { int n = 0; if(!*escapes) return strlen(s); - while(*s) n += (*s != ':' && !strchr(escapes, *s)), s++; + while(*s) n += (*s != '/' && !strchr(escapes, *s)), s++; return n; } @@ -5965,25 +5965,25 @@ SetCharTableEsc (unsigned char *table, const char * map, char * escapes) /* [HGM] moved here from winboard.c because of its general usefulness */ /* Basically a safe strcpy that uses the last character as King */ { - int result = FALSE; int NrPieces; + int result = FALSE; int NrPieces, offs; if( map != NULL && (NrPieces=ptclen(map, escapes)) <= (int) EmptySquare && NrPieces >= 12 && !(NrPieces&1)) { int i, j = 0; /* [HGM] Accept even length from 12 to 88 */ for( i=0; i<(int) EmptySquare; i++ ) table[i] = '.'; - for( i=0; i= 0 && p <= (int)WhiteKing) k++; + oppoKings += (p + color == WhiteKing + BlackPawn - color); } if (appData.debugMode) { fprintf(debugFP, "GE(%d, %s, %d) bare king k=%d color=%d\n", result, resultDetails ? resultDetails : "(null)", whosays, k, color); } - if(k <= 1) { + if(k <= 1 && oppoKings > 0) { // the latter needed in Atomic, where bare K wins if opponent King already destroyed result = GameIsDrawn; snprintf(buf, MSG_SIZ, "%s but bare king", resultDetails); resultDetails = buf;