X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=a54c6ccc3c5f674b65ba32c6e732c4a689db678a;hb=bf1467b590e28b4dc641a3c753ce728b90d42081;hp=4abf6197f66a6e497c86361379fc26774f12b5b0;hpb=9d5cf883b49ff08738e437514a4d0eb978c23647;p=xboard.git diff --git a/backend.c b/backend.c index 4abf619..a54c6cc 100644 --- a/backend.c +++ b/backend.c @@ -5,7 +5,7 @@ * Massachusetts. * * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006, - * 2007, 2008, 2009 Free Software Foundation, Inc. + * 2007, 2008, 2009, 2010 Free Software Foundation, Inc. * * Enhancements Copyright 2005 Alessandro Scotti * @@ -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 @@ -5547,6 +5549,55 @@ OKToStartUserMove(x, y) return TRUE; } +Boolean +OnlyMove(int *x, int *y) { + DisambiguateClosure cl; + if (appData.zippyPlay) return FALSE; + switch(gameMode) { + case MachinePlaysBlack: + case IcsPlayingWhite: + case BeginningOfGame: + if(!WhiteOnMove(currentMove)) return FALSE; + break; + case MachinePlaysWhite: + case IcsPlayingBlack: + if(WhiteOnMove(currentMove)) return FALSE; + break; + default: + return FALSE; + } + cl.pieceIn = EmptySquare; + cl.rfIn = *y; + cl.ffIn = *x; + cl.rtIn = -1; + cl.ftIn = -1; + cl.promoCharIn = NULLCHAR; + Disambiguate(boards[currentMove], PosFlags(currentMove), &cl); + if(cl.kind == NormalMove) { + fromX = cl.ff; + fromY = cl.rf; + *x = cl.ft; + *y = cl.rt; + return TRUE; + } + if(cl.kind != ImpossibleMove) return FALSE; + cl.pieceIn = EmptySquare; + cl.rfIn = -1; + cl.ffIn = -1; + cl.rtIn = *y; + cl.ftIn = *x; + cl.promoCharIn = NULLCHAR; + Disambiguate(boards[currentMove], PosFlags(currentMove), &cl); + if(cl.kind == NormalMove) { + fromX = cl.ff; + fromY = cl.rf; + *x = cl.ft; + *y = cl.rt; + return TRUE; + } + return FALSE; +} + FILE *lastLoadGameFP = NULL, *lastLoadPositionFP = NULL; int lastLoadGameNumber = 0, lastLoadPositionNumber = 0; int lastLoadGameUseList = FALSE; @@ -6037,6 +6088,7 @@ void LeftClick(ClickType clickType, int xPix, int yPix) return; if (fromX == -1) { + if(!appData.oneClick || !OnlyMove(&x, &y)) { if (clickType == Press) { /* First square */ if (OKToStartUserMove(x, y)) { @@ -6051,6 +6103,7 @@ void LeftClick(ClickType clickType, int xPix, int yPix) } } return; + } } /* fromX != -1 */