From 536fe50335df801d3889cd55b827bdd8055f0715 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Thu, 4 Feb 2010 16:09:25 +0100 Subject: [PATCH] Use squares for computer seek ads Shape indication passed in sign bit of color (char) variable. --- backend.c | 4 +++- winboard/winboard.c | 6 ++++++ xboard.c | 12 ++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/backend.c b/backend.c index 4abf619..6499a0d 100644 --- a/backend.c +++ b/backend.c @@ -2068,6 +2068,7 @@ int suppressKibitz = 0; Boolean soughtPending = FALSE; Boolean seekGraphUp; #define MAX_SEEK_ADS 200 +#define SQUARE 0x80 char *seekAdList[MAX_SEEK_ADS]; int ratingList[MAX_SEEK_ADS], xList[MAX_SEEK_ADS], yList[MAX_SEEK_ADS], seekNrList[MAX_SEEK_ADS], zList[MAX_SEEK_ADS]; float tcList[MAX_SEEK_ADS]; @@ -2095,7 +2096,8 @@ PlotSeekAd(int i) !strstr(seekAdList[i], "bullet") && !strstr(seekAdList[i], "blitz") && !strstr(seekAdList[i], "standard") ) color = 2; - DrawSeekDot(xList[i]=x+3*color, yList[i]=h-1-y, colorList[i]=color); + if(strstr(seekAdList[i], "(C) ")) color |= SQUARE; // plot computer seeks as squares + DrawSeekDot(xList[i]=x+3*(color&~SQUARE), yList[i]=h-1-y, colorList[i]=color); } void diff --git a/winboard/winboard.c b/winboard/winboard.c index 29f7981..fae7a9d 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -3127,8 +3127,14 @@ void DrawSeekText(char *buf, int x, int y) void DrawSeekDot(int x, int y, int color) { + int square = color & 0x80; + color &= 0x7F; HBRUSH oldBrush = SelectObject(hdcSeek, color == 0 ? markerBrush : color == 1 ? darkSquareBrush : explodeBrush); + if(square) + Rectangle(hdcSeek, boardRect.left+x - squareSize/9, boardRect.top+y - squareSize/9, + boardRect.left+x + squareSize/9, boardRect.top+y + squareSize/9); + else Ellipse(hdcSeek, boardRect.left+x - squareSize/8, boardRect.top+y - squareSize/8, boardRect.left+x + squareSize/8, boardRect.top+y + squareSize/8); SelectObject(hdcSeek, oldBrush); diff --git a/xboard.c b/xboard.c index 7e30187..6233629 100644 --- a/xboard.c +++ b/xboard.c @@ -4321,9 +4321,17 @@ void DrawSeekText(char *buf, int x, int y) XDrawString(xDisplay, xBoardWindow, coordGC, x, y+4, buf, strlen(buf)); } -void DrawSeekDot(int x, int y, int color) -{ - XFillArc(xDisplay, xBoardWindow, color == 0 ? prelineGC : color == 1 ? darkSquareGC : highlineGC, +void DrawSeekDot(int x, int y, int colorNr) +{ + int square = colorNr & 0x80; + GC color; + colorNr &= 0x7F; + color = colorNr == 0 ? prelineGC : colorNr == 1 ? darkSquareGC : highlineGC; + if(square) + XFillRectangle(xDisplay, xBoardWindow, color, + x-squareSize/9, y-squareSize/9, 2*squareSize/9, 2*squareSize/9); + else + XFillArc(xDisplay, xBoardWindow, color, x-squareSize/8, y-squareSize/8, squareSize/4, squareSize/4, 0, 64*360); } -- 1.7.0.4