Fix promoting pieces in Shogi
authorH.G.Muller <hgm@hgm-xboard.(none)>
Fri, 26 Jan 2018 13:14:30 +0000 (14:14 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Fri, 26 Jan 2018 13:14:30 +0000 (14:14 +0100)
Because of a bug in a boolean expression the Gold had become a promoting
piece. The promotion procedure on user moves is now only triggered if
the piece itself was not defined as promoted, AND its partner is defined
as promoted.

backend.c

index e0f60b4..0e04a16 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -6746,7 +6746,7 @@ HasPromotionChoice (int fromX, int fromY, int toX, int toY, char *promoChoice, i
     } else if(gameInfo.variant == VariantShogi) {
         promotionZoneSize = (BOARD_HEIGHT- deadRanks)/3 +(BOARD_HEIGHT == 8);
         highestPromotingPiece = (int)WhiteAlfil;
-        if(PieceToChar(piece) != '+' || PieceToChar(CHUPROMOTED(piece)) == '+') highestPromotingPiece = piece;
+        if(PieceToChar(piece) != '+' && PieceToChar(CHUPROMOTED(piece)) == '+') highestPromotingPiece = piece;
     } else if(gameInfo.variant == VariantMakruk || gameInfo.variant == VariantGrand || gameInfo.variant == VariantChuChess) {
         promotionZoneSize = 3;
     }