From: H.G. Muller Date: Fri, 10 Jul 2009 05:03:00 +0000 (-0700) Subject: some bugfixes: ICS error handling X-Git-Tag: v4.4.0.beta1~37 X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=5c635c780111b73638ba3a160b347ede6e117357 some bugfixes: ICS error handling * play a different sound for takebacks in ICS mode * pop up error messages for illegal moves for typed-in moves --- diff --git a/backend.c b/backend.c index 6810648..5586649 100644 --- a/backend.c +++ b/backend.c @@ -2953,22 +2953,23 @@ read_from_ics(isr, closure, data, count, error) } /* Error messages */ - if (ics_user_moved) { +// if (ics_user_moved) { + if (1) { // [HGM] old way ignored error after move type in; ics_user_moved is not set then! if (looking_at(buf, &i, "Illegal move") || looking_at(buf, &i, "Not a legal move") || looking_at(buf, &i, "Your king is in check") || looking_at(buf, &i, "It isn't your turn") || looking_at(buf, &i, "It is not your move")) { /* Illegal move */ - ics_user_moved = 0; - if (forwardMostMove > backwardMostMove) { + if (ics_user_moved && forwardMostMove > backwardMostMove) { // only backup if we already moved currentMove = --forwardMostMove; DisplayMove(currentMove - 1); /* before DMError */ - DisplayMoveError(_("Illegal move (rejected by ICS)")); DrawPosition(FALSE, boards[currentMove]); SwitchClocks(); DisplayBothClocks(); } + DisplayMoveError(_("Illegal move (rejected by ICS)")); // [HGM] but always relay error msg + ics_user_moved = 0; continue; } } @@ -3892,8 +3893,11 @@ ParseBoard12(string) DrawPosition(FALSE, boards[currentMove]); DisplayMove(moveNum - 1); - if (appData.ringBellAfterMoves && !ics_user_moved) - RingBell(); + if (appData.ringBellAfterMoves && /*!ics_user_moved*/ // [HGM] use absolute method to recognize own move + !((gameMode == IcsPlayingWhite) && (!WhiteOnMove(moveNum)) || + (gameMode == IcsPlayingBlack) && (WhiteOnMove(moveNum)) ) ) { + if(newMove) RingBell(); else PlayIcsUnfinishedSound(); + } } HistorySet(parseList, backwardMostMove, forwardMostMove, currentMove-1);