From: H.G. Muller Date: Thu, 4 Feb 2010 21:45:01 +0000 (+0100) Subject: Dynamic Seek Graph X-Git-Tag: master-20100206~5 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=475d3b4e733b515cb06dbe46921f63cb15399ff4;p=xboard.git Dynamic Seek Graph The new option -autoRefresh sets FICS and ICC to report removal of seek ads, and then removes those from the Seek Graph. New seek ads are added to the graph, as soon as the ICS reports them. --- diff --git a/args.h b/args.h index 305906e..1c6053e 100644 --- a/args.h +++ b/args.h @@ -243,6 +243,7 @@ ArgDescriptor argDescriptors[] = { { "icshelper", ArgFilename, (void *) &appData.icsHelper, FALSE, (ArgIniType) "" }, { "seekGraph", ArgBoolean, (void *) &appData.seekGraph, TRUE, (ArgIniType) FALSE }, { "sg", ArgTrue, (void *) &appData.seekGraph, FALSE, INVALID }, + { "autoRefresh", ArgBoolean, (void *) &appData.autoRefresh, TRUE, (ArgIniType) FALSE }, { "gateway", ArgString, (void *) &appData.gateway, FALSE, (ArgIniType) "" }, { "loadGameFile", ArgFilename, (void *) &appData.loadGameFile, FALSE, (ArgIniType) "" }, { "lgf", ArgFilename, (void *) &appData.loadGameFile, FALSE, INVALID }, diff --git a/backend.c b/backend.c index caa8e19..dedf333 100644 --- a/backend.c +++ b/backend.c @@ -2071,6 +2071,7 @@ Boolean seekGraphUp; 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]; +char colorList[MAX_SEEK_ADS]; int nrOfSeekAds = 0; int minRating = 1010, maxRating = 2800; int hMargin = 10, vMargin = 20, h, w; @@ -2088,14 +2089,14 @@ PlotSeekAd(int i) if(tc > 95.) tc = 95.; x = (w-hMargin)* log(tc)/log(100.) + hMargin; y = ((double)r - minRating)/(maxRating - minRating) - * (h-vMargin-squareSize/8) + vMargin; + * (h-vMargin-squareSize/8-1) + vMargin; if(ratingList[i] < 0) y = vMargin + squareSize/4; if(strstr(seekAdList[i], " u ")) color = 1; if(!strstr(seekAdList[i], "lightning") && // for now all wilds same color !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, color); + DrawSeekDot(xList[i]=x+3*color, yList[i]=h-1-y, colorList[i]=color); } void @@ -2121,6 +2122,40 @@ AddAd(char *handle, char *rating, int base, int inc, char rated, char *type, in } } +void +EraseSeekDot(int i) +{ + int x = xList[i], y = yList[i], d=squareSize/4, k; + DrawSeekBackground(x-squareSize/8, y-squareSize/8, x+squareSize/8+1, y+squareSize/8+1); + if(x < hMargin+d) DrawSeekAxis(hMargin, y-squareSize/8, hMargin, y+squareSize/8+1); + // now replot every dot that overlapped + for(k=0; k x-d && yy <= y+d && yy > y-d) + DrawSeekDot(xx, yy, colorList[k]); + } +} + +void +RemoveSeekAd(int nr) +{ + int i; + for(i=0; i=minRating && i