Use squares for computer seek ads
authorH.G. Muller <h.g.muller@hccnet.nl>
Thu, 4 Feb 2010 15:09:25 +0000 (16:09 +0100)
committerArun Persaud <arun@nubati.net>
Sat, 6 Feb 2010 21:04:17 +0000 (13:04 -0800)
Shape indication passed in sign bit of color (char) variable.

backend.c
winboard/winboard.c
xboard.c

index 4abf619..6499a0d 100644 (file)
--- 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
index 29f7981..fae7a9d 100644 (file)
@@ -3127,8 +3127,14 @@ void DrawSeekText(char *buf, int x, int y)
 \r
 void DrawSeekDot(int x, int y, int color)\r
 {\r
+       int square = color & 0x80;\r
+       color &= 0x7F;\r
            HBRUSH oldBrush = SelectObject(hdcSeek, \r
                        color == 0 ? markerBrush : color == 1 ? darkSquareBrush : explodeBrush);\r
+       if(square)\r
+           Rectangle(hdcSeek, boardRect.left+x - squareSize/9, boardRect.top+y - squareSize/9,\r
+                              boardRect.left+x + squareSize/9, boardRect.top+y + squareSize/9);\r
+       else\r
            Ellipse(hdcSeek, boardRect.left+x - squareSize/8, boardRect.top+y - squareSize/8,\r
                             boardRect.left+x + squareSize/8, boardRect.top+y + squareSize/8);\r
            SelectObject(hdcSeek, oldBrush);\r
index 7e30187..6233629 100644 (file)
--- 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);
 }