Fix illegal-move message on seirawan gating from gated pieces
[fairymax.git] / fairymax.c
index 83002e5..5106ae1 100644 (file)
@@ -68,10 +68,10 @@ int StartKey;
 #endif\r
 \r
 /* make unique integer from engine move representation */\r
-#define PACK_MOVE 256*K + L + (PromPiece << 16);\r
+#define PACK_MOVE 256*K + L + (PromPiece << 16) + (GT<<24);\r
 \r
 /* convert intger argument back to engine move representation */\r
-#define UNPACK_MOVE(A) K = (A)>>8 & 255; L = (A) & 255; PromPiece = (A)>>16 & 255;\r
+#define UNPACK_MOVE(A) K = (A)>>8 & 255; L = (A) & 255; PromPiece = (A)>>16 & 255; GT = (A)>>24 & 255;\r
 \r
 /* Global variables visible to engine. Normally they */\r
 /* would be replaced by the names under which these  */\r
@@ -876,7 +876,7 @@ int main(int argc, char **argv)
                     if(b[L] && (b[L]&16) == Side && w[b[L]&15] < 0) // capture own King: castling\r
                     { i=K; K = L; L = i>L ? i-1 : i+2; }\r
                    if(w[GT&15] < -1) pl[GT&31]++, J+=89729; // promotion to royal piece\r
-                    if(b[K]&32) GT = 0; // non-virgin mover => true promotion rather than gating\r
+                    if((b[K]&15) < 3) GT = 0; // Pawn => true promotion rather than gating\r
                     if(D(Side,-I,I,Q,O,LL|S,3)!=I) {\r
                         /* did have move syntax, but illegal move */\r
                         printf("Illegal move:%s\n", line);\r