Extend legality testing to drop moves
[xboard.git] / parser.l
index 528b3de..9590fe2 100644 (file)
--- a/parser.l
+++ b/parser.l
@@ -824,7 +824,7 @@ extern void CopyBoard P((Board to, Board from));
 }\r
 \r
 [A-Z][@*][a-l][0-9] {\r
-    /* Bughouse piece drop.  No legality checking for now. */\r
+    /* Bughouse piece drop. */\r
     currentMoveString[1] = '@';\r
     currentMoveString[2] = yytext[2];\r
     currentMoveString[3] = yytext[3];\r
@@ -840,11 +840,11 @@ extern void CopyBoard P((Board to, Board from));
 \r
     if (WhiteOnMove(yyboardindex)) {\r
        currentMoveString[0] = ToUpper(yytext[0]);\r
-       return (int) WhiteDrop;\r
     } else {\r
        currentMoveString[0] = ToLower(yytext[0]);\r
-       return (int) BlackDrop;\r
     }\r
+    return LegalityTest(boards[yyboardindex], PosFlags(yyboardindex), DROP_RANK, // [HGM] does drops now too
+                        CharToPiece(currentMoveString[0]), currentMoveString[3] - ONE, currentMoveString[2] - AAA, NULLCHAR);
 }\r
 \r
 [Rr]esign(s|ed)?  {\r