From 993c315fcddbf1717850eb3a4fa3748f69050c4b Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sun, 24 Jan 2010 18:51:38 +0100 Subject: [PATCH] Send FICS atomic claim to ICS if move creates draw after offer The FICS format "draw MOVE" is used to send the move to the ICS when the user enters a move that adjudicates as a claimable draw, and he offered a draw before the move. For the benefit of ICS that do not understand this format, the plain move is sent afterwards. --- backend.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/backend.c b/backend.c index 3fc68f2..d8c5410 100644 --- a/backend.c +++ b/backend.c @@ -5473,8 +5473,6 @@ UserMoveTest(fromX, fromY, toX, toY, promoChar, captureOwn) } } - userOfferedDraw = FALSE; // [HGM] drawclaim: only if we do a legal move! - return moveType; /* [HGM] in stead of calling FinishMove directly, this function is made into one that returns an OK move type if FinishMove @@ -5604,6 +5602,12 @@ FinishMove(moveType, fromX, fromY, toX, toY, promoChar) if (appData.icsActive) { if (gameMode == IcsPlayingWhite || gameMode == IcsPlayingBlack || gameMode == IcsExamining) { + if(userOfferedDraw && (signed char)boards[forwardMostMove][EP_STATUS] <= EP_DRAWS) { + SendToICS(ics_prefix); // [HGM] drawclaim: send caim and move on one line for FICS + SendToICS("draw "); + SendMoveToICS(moveType, fromX, fromY, toX, toY); + } + // also send plain move, in case ICS does not understand atomic claims SendMoveToICS(moveType, fromX, fromY, toX, toY); ics_user_moved = 1; } @@ -5655,6 +5659,8 @@ FinishMove(moveType, fromX, fromY, toX, toY, promoChar) break; } + userOfferedDraw = FALSE; // [HGM] drawclaim: after move made, and tested for claimable draw + if(bookHit) { // [HGM] book: simulate book reply static char bookMove[MSG_SIZ]; // a bit generous? -- 1.7.0.4