Allow double-digit rank numbers
authorH.G. Muller <h.g.muller@hccnet.nl>
Mon, 20 Jun 2011 21:53:49 +0000 (23:53 +0200)
committerH.G. Muller <h.g.muller@hccnet.nl>
Sun, 26 Jun 2011 12:36:04 +0000 (14:36 +0200)
The parser already understood double-digit numbers on input, and
CoordsToAlgebraic produced them on otput. This patch also fixes sending
of the moves to the computer, for which the moveList was used. The latter
stored 10 as ':', etc,to always get a 4-char move, the characters of which
were frequently being converted to fromY or toY by adding/subtracting ONE.
To not break that the one-character encoding of rank number is kept in
moveList, but in SendMoveToProgram, characters > '9' are converted to
double digits.

backend.c

index 6ad2142..2cbe2e0 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -4888,6 +4888,11 @@ SendMoveToProgram(moveNum, cps)
          else SendToProgram("O-O-O\n", cps);
        }
        else SendToProgram(moveList[moveNum], cps);
+      } else
+      if(BOARD_HEIGHT > 10) { // [HGM] big: convert ranks to double-digit where needed
+       snprintf(buf, MSG_SIZ, "%c%d%c%d%s", moveList[moveNum][0], moveList[moveNum][1] - '0',
+                                            moveList[moveNum][2], moveList[moveNum][3] - '0', moveList[moveNum]+4);
+       SendToProgram(buf, cps);
       }
       else SendToProgram(moveList[moveNum], cps);
       /* End of additions by Tord */