X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=5fb842c22aaeb1e96c0dd22c016a785c4ee1d6f9;hb=f9fe58c6ea5c0938364cd9bd0b434ee66e0f7272;hp=045657cc00f8a3d343ee4e5d1f751b4ce2e704ac;hpb=aa2b141fe5b67216cb63023f8c2b359e2c0a02d2;p=xboard.git diff --git a/backend.c b/backend.c index 045657c..5fb842c 100644 --- a/backend.c +++ b/backend.c @@ -2444,7 +2444,7 @@ read_from_ics(isr, closure, data, count, error) } } if(chattingPartner<0) // if not, look if there is a chatbox for this indivdual - for(p=0; puseSetboard) { // hideous kludge on kludge, because SendBoard sucks. + // we have a real problem now, as SendBoard will use the a2a3 kludge + // when black is to move, while there might be nothing on a2 or black + // might already have the move. So send the board as if white has the move. + // But first we must change the stm of the engine, as it refused the last move + SendBoard(cps, 0); // always kludgeless, as white is to move on boards[0] + if(WhiteOnMove(forwardMostMove)) { + SendToProgram("a7a6\n", cps); // for the engine black still had the move + SendBoard(cps, forwardMostMove); // kludgeless board + } else { + SendToProgram("a2a3\n", cps); // for the engine white still had the move + CopyBoard(boards[forwardMostMove+1], boards[forwardMostMove]); + SendBoard(cps, forwardMostMove+1); // kludgeless board + } + } else SendBoard(cps, forwardMostMove); // FEN case, also sets stm properly + if(gameMode == MachinePlaysWhite || gameMode == MachinePlaysBlack || + gameMode == TwoMachinesPlay) + SendToProgram("go\n", cps); + return; + } else if (gameMode == PlayFromGameFile) { /* Stop reading this game file */ gameMode = EditGame; @@ -8281,6 +8315,7 @@ Reset(redraw, init) gameMode = BeginningOfGame; ModeHighlight(); if(appData.icsActive) gameInfo.variant = VariantNormal; + currentMove = forwardMostMove = backwardMostMove = 0; InitPosition(redraw); for (i = 0; i < MAX_MOVES; i++) { if (commentList[i] != NULL) {