Extend legality testing to drop moves
[xboard.git] / parser.c
index ee1e2b1..ca1681b 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2838,7 +2838,7 @@ case 11:
 YY_RULE_SETUP
 #line 826 "parser.l"
 {\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
@@ -2854,11 +2854,11 @@ YY_RULE_SETUP
 \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
        YY_BREAK
 case 12: