X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=a75a87ad0bc582ece2be05df6879b0cf66a290f3;hb=7b721be1faca2a8524f56ab9e414d0bb97215765;hp=6cd22244edf161b2a48b0e13ffd71f3a953a9e12;hpb=9249912d43d4c814c953f51146a65fc33250e385;p=xboard.git diff --git a/backend.c b/backend.c index 6cd2224..a75a87a 100644 --- a/backend.c +++ b/backend.c @@ -5947,23 +5947,39 @@ SetUpShuffle (Board board, int number) } int +ptclen (const char *s) +{ + int n = 0; + while(*s) n += (*s != '\'' && *s != '"' && *s != '`' && *s != '!'), s++; + return n; +} + +int SetCharTable (char *table, const char * map) /* [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; - if( map != NULL && (NrPieces=strlen(map)) <= (int) EmptySquare + if( map != NULL && (NrPieces=ptclen(map)) <= (int) EmptySquare && NrPieces >= 12 && !(NrPieces&1)) { - int i; /* [HGM] Accept even length from 12 to 34 */ + 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