Fix legality testing with mandatory capture
authorH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 5 Dec 2016 08:54:30 +0000 (09:54 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Fri, 13 Jan 2017 15:39:24 +0000 (16:39 +0100)
When a capture was possible in suicide/giveaway/losers, only the board
markers of all non-captures were cleared, but not the legality of the
corresponding destination squares in the array legal[][]. The patch that
forced destinations to be legal when the engine had highlighted them had
therefore broken rejection of illegal non-captures in this case.

backend.c

index 3792971..890461a 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -7462,7 +7462,7 @@ MarkTargetSquares (int clear)
     if(PosFlags(0) & F_MANDATORY_CAPTURE) {
       for(x=0; x<BOARD_WIDTH; x++) for(y=0; y<BOARD_HEIGHT; y++) if(marker[y][x]>1) capt++;
       if(capt)
-      for(x=0; x<BOARD_WIDTH; x++) for(y=0; y<BOARD_HEIGHT; y++) if(marker[y][x] == 1) marker[y][x] = 0;
+      for(x=0; x<BOARD_WIDTH; x++) for(y=0; y<BOARD_HEIGHT; y++) if(marker[y][x] == 1) marker[y][x] = legal[y][x] = 0;
     }
   }
   DrawPosition(FALSE, NULL);