Suppress testing of holdings in holdingless seirawan
authorH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 1 Jan 2020 19:17:46 +0000 (20:17 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 1 Jan 2020 19:17:46 +0000 (20:17 +0100)
The legality test in variant seirawan normally tests if a piece specified
for gating is indeed in hand. This is now suppressed if there are no
holdings. There is no check on the correctness of the indicated gating
piece at all now, in that case. But presence of the suffix is still
necessary to trigger the gating of the piece that should be gated.

moves.c

diff --git a/moves.c b/moves.c
index 726dfd2..638a4c0 100644 (file)
--- a/moves.c
+++ b/moves.c
@@ -1938,6 +1938,7 @@ LegalityTest (Board board, int flags, int rf, int ff, int rt, int ft, int promoC
     if(promoChar == 'x') promoChar = NULLCHAR; // [HGM] is this ever the case?
     if(autoProm[piece]) promoChar = NULLCHAR;  // ignore promotion characters on auto-promoting pieces
     if(gameInfo.variant == VariantSChess && promoChar && promoChar != '=' && board[rf][ff] != WhitePawn && board[rf][ff] != BlackPawn) {
+      if(gameInfo.holdingsSize) {
         if(board[rf][ff] < BlackPawn) { // white
             if(rf != 0) return IllegalMove; // must be on back rank
             if(!(board[VIRGIN][ff] & VIRGIN_W)) return IllegalMove; // non-virgin
@@ -1951,6 +1952,7 @@ LegalityTest (Board board, int flags, int rf, int ff, int rt, int ft, int promoC
             if(cl.kind == BlackHSideCastleFR && (ff == BOARD_RGHT-2 || ff == BOARD_RGHT-3)) return ImpossibleMove;
             if(cl.kind == BlackASideCastleFR && (ff == BOARD_LEFT+2 || ff == BOARD_LEFT+3)) return ImpossibleMove;
         }
+      }
     } else
     if(gameInfo.variant == VariantChu) {
         if(cl.kind != NormalMove || promoChar == NULLCHAR || promoChar == '=') return cl.kind;