From: H.G.Muller Date: Tue, 9 Feb 2016 08:53:44 +0000 (+0100) Subject: Allow setting of piece nicknames from pieceToChar string X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=ac0b7cea34e9ebbf980ba6e30844889a70e354fd Allow setting of piece nicknames from pieceToChar string A piece IDs in the pieceToChar string can now be suffixed by "=L", with L an arbitrary single letter, to define a nickname for the piece. Such a nickname would make it possible to specify a complex ID like +I' as promotion choice, and by indicating this in the pieceToChar string the engine can configure that through the 'setup' command. This facility is needed to force promotion after capture of a contageous piece in variants with Shogi promotion, such as Maka Dai Dai Shogi. --- diff --git a/backend.c b/backend.c index 3f673a5..7f06f2e 100644 --- a/backend.c +++ b/backend.c @@ -6003,7 +6003,7 @@ ptclen (const char *s, char *escapes) { int n = 0; if(!*escapes) return strlen(s); - while(*s) n += (*s != '/' && *s != '-' && *s != '^' && *s != '*' && !strchr(escapes, *s)), s++; + while(*s) n += (*s != '/' && *s != '-' && *s != '^' && *s != '*' && !strchr(escapes, *s)) - 2*(*s == '='), s++; return n; } @@ -6027,6 +6027,7 @@ SetCharTableEsc (unsigned char *table, const char * map, char * escapes) table[i+offs] = map[j++]; if(p = strchr(escapes, map[j])) j++, table[i+offs] += 64*(p - escapes + 1); if(c) partner[i+offs] = table[i+offs], table[i+offs] = c; + if(*escapes && map[j] == '=') pieceNickName[i+offs] = map[++j], j++; } table[(int) WhiteKing] = map[j++]; for( ii=offs=0; ii