src/chess/rules.c

changeset 155
835776e0338f
parent 154
5336e985bd69
child 156
05fc8a454700
--- a/src/chess/rules.c	Fri Jul 24 12:44:42 2026 +0200
+++ b/src/chess/rules.c	Fri Jul 24 12:53:58 2026 +0200
@@ -804,8 +804,14 @@
             if (mstr[2] == 'x') {
                 move->capture = 1;
                 if (move->piece) {
-                    /* capture (e.g. "Ndxf3") */
-                    move->fromfile = fileidx(mstr[1]);
+                    /* capture (e.g. "Ndxf3" or "R1xh3") */
+                    if (isfile(mstr[1])) {
+                        move->fromfile = fileidx(mstr[1]);
+                    } else if (isrow(mstr[1])) {
+                        move->fromrow = rowidx(mstr[1]);
+                    } else {
+                        return INVALID_MOVE_SYNTAX;
+                    }
                 } else {
                     /* long notation capture (e.g. "e5xf6") */
                     move->piece = PAWN;

mercurial