Indicate last rank in zone table
authorH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 6 Feb 2017 18:15:18 +0000 (19:15 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 6 Feb 2017 18:15:18 +0000 (19:15 +0100)
The least-sigificant bit in the zone table is nowused to indicate first
and second rank. This is used to forbid Pawn drops as check evasions.
Which is OK for crazyhouse, but is overruled on 1st rank for Shogi.
The last-2-ranks bits are suppressed in mini-Shogi (which has no Knight).

dropper.c

index d229f91..f2bf201 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -546,8 +546,9 @@ printf("# variant %d: %s\n", v, variants[v].name);
     }
     for(r=0; r<zone; r++) { // board-size table to indicate promotion zones and force-promotion zones
        for(f=0; f<nrFiles; f++) {
-           zoneTab[22*r + f]           = Z_BLACK & (Z_MUST | COLOR | (r<2)*Z_2ND);
-           zoneTab[22*(nrRanks-1-r)+f] = Z_WHITE & (Z_MUST | COLOR | (r<2)*Z_2ND);
+           int xr = nrRanks - 1 - r, c = Z_MUST | COLOR | (r==0)*Z_LAST | (r<2 && v!=1)*Z_2ND; // in mini-Shogi forelast not in zone
+           zoneTab[22*r  + f] = Z_BLACK & c;
+           zoneTab[22*xr + f] = Z_WHITE & c;
        }
     }