Bugfix legality null move in parsing with -testLegality off
authorH.G. Muller <h.g.muller@hccnet.nl>
Fri, 8 Jan 2010 08:21:04 +0000 (09:21 +0100)
committerArun Persaud <arun@nubati.net>
Tue, 12 Jan 2010 04:01:54 +0000 (20:01 -0800)
The pointers were compared, in stead of the values.
Furthermore, instead of null moves, it rejected moves on the main diagonal when legality checking was off.

Also exclude moves with empty squares and enemy pieces.

backend.c

index 4904638..dd4b0be 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -4360,7 +4360,8 @@ ParseOneMove(move, moveNum, moveType, fromX, fromY, toX, toY, promoChar)
        if (appData.testLegality) {
          return (*moveType != IllegalMove);
        } else {
-         return !(fromX == fromY && toX == toY);
+         return !(*fromX == *toX && *fromY == *toY) && boards[moveNum][*fromY][*fromX] != EmptySquare && 
+                       WhiteOnMove(moveNum) == (boards[moveNum][*fromY][*fromX] < BlackPawn);
        }
 
       case WhiteDrop: