Fix disambiguation of shogi-style promotions
authorH.G. Muller <h.g.muller@hccnet.nl>
Mon, 21 Oct 2013 19:03:24 +0000 (21:03 +0200)
committerH.G. Muller <h.g.muller@hccnet.nl>
Sun, 22 Dec 2013 22:32:07 +0000 (23:32 +0100)
moves.c

diff --git a/moves.c b/moves.c
index fba01a7..978d895 100644 (file)
--- a/moves.c
+++ b/moves.c
@@ -1764,6 +1764,10 @@ Disambiguate (Board board, int flags, DisambiguateClosure *closure)
             else
                 c = PieceToChar(BlackQueen);
         } else if(c == '=') closure->kind = IllegalMove; // no deferral outside Shogi
+    } else if (c == '+') { // '+' outside shogi, check if pieceToCharTable enabled it
+        ChessSquare p = closure->piece;
+        if(p > WhiteMan && p < BlackPawn || p > BlackMan || PieceToChar(PROMOTED p) != '+')
+            closure->kind = ImpossibleMove; // used on non-promotable piece
     } else if (c != NULLCHAR) closure->kind = IllegalMove;
 
     closure->promoChar = ToLower(c); // this can be NULLCHAR! Note we keep original promoChar even if illegal.