Allow promotion to piece with letter ID in Chu
authorH.G.Muller <hgm@hgm-xboard.(none)>
Sat, 18 Apr 2015 09:09:34 +0000 (11:09 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 7 May 2015 18:53:34 +0000 (20:53 +0200)
Normally all promoted versions in Chu have ID '+', but it could be
useful to allow piece promotion always, as long as the promoted piece
participates.

moves.c

diff --git a/moves.c b/moves.c
index a66c2e0..8b04b53 100644 (file)
--- a/moves.c
+++ b/moves.c
@@ -1829,7 +1829,10 @@ LegalityTest (Board board, int flags, int rf, int ff, int rt, int ft, int promoC
         if(cl.kind != NormalMove || promoChar == NULLCHAR || promoChar == '=') return cl.kind;
         if(promoChar != '+')
             return CharToPiece(promoChar) == EmptySquare ? ImpossibleMove : IllegalMove;
-        if(PieceToChar(CHUPROMOTED board[rf][ff]) != '+') return ImpossibleMove;
+        if(PieceToChar(CHUPROMOTED board[rf][ff]) != '+') {
+           if(PieceToChar(CHUPROMOTED (board[rf][ff] < BlackPawn ? WhitePawn : BlackPawn)) != '.')
+           return ImpossibleMove;
+       }
         return flags & F_WHITE_ON_MOVE ? WhitePromotion : BlackPromotion;
     } else
     if(gameInfo.variant == VariantShogi) {