From: H.G.Muller Date: Wed, 27 Apr 2016 20:22:35 +0000 (+0200) Subject: Prevent sending empty line to engine after multi-leg move X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=1fd133e6b9a69f8e2e32a5cad04bfc9930db9ee4 Prevent sending empty line to engine after multi-leg move As the pmoves are stored internally with a linefeed suffixed to them, this linefeed was mistaken for a promotion character in the multi-leg printing formats, and led to an extra empty line being sent to the engine on non-promotion multi-leg moves. Now a linefeed is replaced by a null character before sending the move. --- diff --git a/backend.c b/backend.c index 83034f4..23bfda7 100644 --- a/backend.c +++ b/backend.c @@ -5162,14 +5162,14 @@ SendMoveToProgram (int moveNum, ChessProgramState *cps) if(moveList[moveNum][4] == ';') { // [HGM] lion: move is double-step over intermediate square char *m = moveList[moveNum]; static char c[2]; - *c = m[7]; // promoChar + *c = m[7]; if(*c == '\n') *c = NULLCHAR; // promoChar if((boards[moveNum][m[6]-ONE][m[5]-AAA] < BlackPawn) == (boards[moveNum][m[1]-ONE][m[0]-AAA] < BlackPawn)) // move is kludge to indicate castling snprintf(buf, MSG_SIZ, "%c%d%c%d,%c%d%c%d\n", m[0], m[1] - '0', // convert to two moves m[2], m[3] - '0', m[5], m[6] - '0', m[2] + (m[0] > m[5] ? 1 : -1), m[3] - '0'); else if(*c && m[8]) { // kill square followed by 2 characters: 2nd kill square rather than promo suffix - *c = m[9]; + *c = m[9]; if(*c == '\n') *c = NULLCHAR; snprintf(buf, MSG_SIZ, "%c%d%c%d,%c%d%c%d,%c%d%c%d%s\n", m[0], m[1] - '0', // convert to three moves m[7], m[8] - '0', m[7], m[8] - '0',