From ca959d6ae1c8b3b46ba50e7b9982b47037eae573 Mon Sep 17 00:00:00 2001
From: H.G. Muller <h.g.muller@hccnet.nl>
Date: Tue, 8 Oct 2013 19:54:23 +0200
Subject: [PATCH] Fix re-appearing of board markers

The board markers could reappear after a machine move, after the already
had been cleared at the end of the previous user move. This because
HoverEvent() could restore them from the copy it keeps during hovering.
Now clearing of the board markers also clearse baseMarker[][], which had to
be made a global for that purpose.
---
 backend.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/backend.c b/backend.c
index fac9abd..6d2e706 100644
--- a/backend.c
+++ b/backend.c
@@ -7114,6 +7114,8 @@ MarkByFEN(char *fen)
 	DrawPosition(TRUE, NULL);
 }
 
+static char baseMarker[BOARD_RANKS][BOARD_FILES], baseLegal[BOARD_RANKS][BOARD_FILES];
+
 void
 Mark (Board board, int flags, ChessMove kind, int rf, int ff, int rt, int ft, VOIDSTAR closure)
 {
@@ -7131,7 +7133,7 @@ MarkTargetSquares (int clear)
 {
   int x, y, sum=0;
   if(clear) { // no reason to ever suppress clearing
-    for(x=0; x<BOARD_WIDTH; x++) for(y=0; y<BOARD_HEIGHT; y++) sum += marker[y][x], marker[y][x] = 0;
+    for(x=0; x<BOARD_WIDTH; x++) for(y=0; y<BOARD_HEIGHT; y++) sum += marker[y][x], marker[y][x] = baseMarker[y][x] = 0;
     if(!sum) return; // nothing was cleared,no redraw needed
   } else {
     int capt = 0;
@@ -7181,7 +7183,6 @@ CanPromote (ChessSquare piece, int y)
 void
 HoverEvent (int xPix, int yPix, int x, int y)
 {
-	static char baseMarker[BOARD_RANKS][BOARD_FILES], baseLegal[BOARD_RANKS][BOARD_FILES];
 	static int oldX = -1, oldY = -1, oldFromX = -1, oldFromY = -1;
 	int r, f;
 	if(dragging == 2) DragPieceMove(xPix, yPix); // [HGM] lion: drag without button for second leg
-- 
1.7.0.4