Fix parsing of illegal drops from PGN
authorH.G.Muller <hgm@hgm-xboard.(none)>
Sat, 21 Feb 2015 19:02:06 +0000 (20:02 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 7 May 2015 18:53:33 +0000 (20:53 +0200)
These were parsed as if the first two characters were the from-square.

backend.c

index d637ab1..8aae7b4 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -12075,8 +12075,13 @@ LoadGameOneMove (ChessMove readAhead)
            if (appData.debugMode)
              fprintf(debugFP, "Parsed %s into IllegalMove %s\n",
                      yy_text, currentMoveString);
-            fromX = currentMoveString[0] - AAA;
-            fromY = currentMoveString[1] - ONE;
+            if(currentMoveString[1] == '@') {
+                fromX = CharToPiece(WhiteOnMove(currentMove) ? ToUpper(currentMoveString[0]) : ToLower(currentMoveString[0]));
+                fromY = DROP_RANK;
+            } else {
+                fromX = currentMoveString[0] - AAA;
+                fromY = currentMoveString[1] - ONE;
+            }
             toX = currentMoveString[2] - AAA;
             toY = currentMoveString[3] - ONE;
            promoChar = currentMoveString[4];