Forbid promotion to pieces with value ending in 3
authorH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 15 Oct 2014 12:56:09 +0000 (14:56 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 15 Oct 2014 13:20:06 +0000 (15:20 +0200)
No piece had that yet in any existing variant, and although Fairy-Max will
still always promote to piece #7, the user's promotion choice can now be
checked better for legality.

data/fmax.ini
fairymax.c

index 88c76a8..a68c328 100644 (file)
@@ -204,6 +204,10 @@ A royal value of -2 is currently used as a kludge to enable an alternative
 winning condition, namely when the royal piece reaches (and survives in)\r
 one of the four central squares.\r
 \r
+NOTE: Any piece value that (in decimal notation) ends in '3' will not be \r
+accepted as promotion choice. (And neither will be absolute royalty,\r
+i.e. piece value -1).\r
+\r
 The individual bits in the move-mode descriptor have the following meaning:\r
 In the last hexadecimal digit:\r
     1 capture allowed (of enemy piece; own pieces always block a move)\r
index 2046aaa..9589df7 100644 (file)
@@ -896,7 +896,7 @@ printf("# promo = %d (%c) GT = %d\n", prom, prom + '`', GT);
                 GT = (Side == WHITE ? piecetype : blacktype)[line[4]&31];\r
                 if(GT) PromPiece = (Side == WHITE ? 7 : 7+pm) - GT, GT |= 32 + Side;\r
                 {char *c=line; K=c[0]-16*c[1]+799;L=c[2]-16*c[3]+799; }\r
-                if(w[GT&15] == -1) L = S; // spoil move for promotion to King\r
+                if(w[GT&15] == -1 || w[GT&15]%10 == 3) L = S; // spoil move for promotion to King (or when marked non-promoting)\r
                 if (m & line[1] != '@')\r
                         /* doesn't have move syntax */\r
                        printf("Error (unknown command): %s\n", command);\r