From: H.G. Muller Date: Wed, 3 Jul 2013 13:34:48 +0000 (+0200) Subject: Use highlight command to specify move legality X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=d0dd56ea50571359ce9cf8d368aff29e5d5b25c5;p=xboard.git Use highlight command to specify move legality When a highlight command has been sent, LeftClick will only accept to-square events when they occur on a square that highlight marked as legal, i.e. indicated by a capital. The transparant 'color' T is added to allow the engine to mark a to-square as legal without putting any visible marker on it. --- diff --git a/backend.c b/backend.c index 15c3e42..b8ebf8f 100644 --- a/backend.c +++ b/backend.c @@ -269,6 +269,7 @@ char chatPartner[MAX_CHAT][MSG_SIZ]; /* [HGM] chat: list of chatting partners */ extern int chatCount; int chattingPartner; char marker[BOARD_RANKS][BOARD_FILES]; /* [HGM] marks for target squares */ +char legal[BOARD_RANKS][BOARD_FILES]; /* [HGM] legal target squares */ char lastMsg[MSG_SIZ]; ChessSquare pieceSweep = EmptySquare; ChessSquare promoSweep = EmptySquare, defaultPromoChoice; @@ -7019,12 +7020,15 @@ MarkByFEN(char *fen) { int r, f; if(!appData.markers || !appData.highlightDragging) return; - for(r=0; r= 'A' && *fen <= 'Z') legal[r][f] = 1; else + if(*fen >= 'a' && *fen <= 'z') *fen += 'A' - 'a'; if(*fen == '/' && f > BOARD_LEFT) f = BOARD_LEFT, r--; else + if(*fen == 'T') marker[r][f++] = 0; else if(*fen == 'Y') marker[r][f++] = 1; else if(*fen == 'R') marker[r][f++] = 2; else { while(*fen <= '9' && *fen >= '0') s = 10*s + *fen++ - '0'; @@ -7104,6 +7108,9 @@ CanPromote (ChessSquare piece, int y) void ReportClick(char *action, int x, int y) { char buf[MSG_SIZ]; // Inform engine of what user does + int r, f; + if(action[0] == 'l') // mark any target square of a lifted piece as legal to-square + for(r=0; r