Do not call illegal moves ambiguos
authorH.G.Muller <hgm@hgm-xboard.(none)>
Sat, 21 Feb 2015 19:08:00 +0000 (20:08 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 7 May 2015 18:53:33 +0000 (20:53 +0200)
When legality testing is off, an illegal SAN move would be interpreted
as if the mentioned piece type could move anywhere, which lead to an
'Ambiguous Move' message if there were multiple pieces of that type.
This should not be done if the piece moves are known through engine piece commands.

moves.c

diff --git a/moves.c b/moves.c
index 88bbdee..5c265a6 100644 (file)
--- a/moves.c
+++ b/moves.c
@@ -2031,7 +2031,7 @@ Disambiguate (Board board, int flags, DisambiguateClosure *closure)
         GenLegal(board, flags|F_IGNORE_CHECK, DisambiguateCallback, (VOIDSTAR) closure, closure->pieceIn);
        if (closure->count == 0) {
            /* No, it's not even that */
         GenLegal(board, flags|F_IGNORE_CHECK, DisambiguateCallback, (VOIDSTAR) closure, closure->pieceIn);
        if (closure->count == 0) {
            /* No, it's not even that */
-         if(!appData.testLegality && closure->pieceIn != EmptySquare) {
+         if(!appData.testLegality && !pieceDefs && closure->pieceIn != EmptySquare) {
            int f, r; // if there is only a single piece of the requested type on the board, use that
            closure->rt = closure->rtIn, closure->ft = closure->ftIn;
            for(r=0; r<BOARD_HEIGHT; r++) for(f=BOARD_LEFT; f<BOARD_RGHT; f++)
            int f, r; // if there is only a single piece of the requested type on the board, use that
            closure->rt = closure->rtIn, closure->ft = closure->ftIn;
            for(r=0; r<BOARD_HEIGHT; r++) for(f=BOARD_LEFT; f<BOARD_RGHT; f++)