From: H.G. Muller Date: Sat, 5 Apr 2014 18:39:55 +0000 (+0200) Subject: Fix writing of Chu-Shogi FENs X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=55cafba6c2f03dec96d41f7a85c03d4cd641190a;p=xboard.git Fix writing of Chu-Shogi FENs Promoted pieces were getting the wrong ID letter, of the piece demoted by 11, rather than 22. --- diff --git a/backend.c b/backend.c index 5771996..88fed00 100644 --- a/backend.c +++ b/backend.c @@ -17639,12 +17639,12 @@ PositionToFEN (int move, char *overrideCastling, int moveCounts) if(PieceToChar(piece) == '+') { /* [HGM] write promoted pieces as '+' (Shogi) */ *p++ = '+'; - piece = (ChessSquare)(DEMOTED piece); + piece = (ChessSquare)(CHUDEMOTED piece); } *p++ = (piece == DarkSquare ? '*' : PieceToChar(piece)); if(p[-1] == '~') { /* [HGM] flag promoted pieces as '~' (Crazyhouse) */ - p[-1] = PieceToChar((ChessSquare)(DEMOTED piece)); + p[-1] = PieceToChar((ChessSquare)(CHUDEMOTED piece)); *p++ = '~'; } } diff --git a/common.h b/common.h index 3d92dc0..132c48d 100644 --- a/common.h +++ b/common.h @@ -313,6 +313,7 @@ typedef enum { #define DEMOTED (int)WhiteRook - (int)WhiteDragon + (int) #define SHOGI (int)EmptySquare + (int) #define CHUPROMOTED ((int)WhitePDragon - (int)WhiteDragon)*(gameInfo.variant == VariantChu) + PROMOTED +#define CHUDEMOTED ((int)WhiteDragon - (int)WhitePDragon)*(gameInfo.variant == VariantChu) + DEMOTED #define IS_SHOGI(V) ((V) == VariantShogi || (V) == VariantChu) #define IS_LION(V) ((V) == WhiteLion || (V) == BlackLion)