ChessSquare piece;
if(gameInfo.holdingsWidth < 2) return;
+ if(gameInfo.variant != VariantBughouse && board[BOARD_SIZE-1][BOARD_SIZE-2])
+ return; // prevent overwriting by pre-board holdings
if( (int)lowestPiece >= BlackPawn ) {
holdingsColumn = 0;
board[holdingsStartRow+j*direction][holdingsColumn] = piece;
board[holdingsStartRow+j*direction][countsColumn]++;
}
-
}
gameInfo.holdingsWidth = newHoldingsWidth;
gameInfo.variant = newVariant;
InitDrawingSizes(-2, 0);
- InitPosition(TRUE); /* this sets up board[0], but also other stuff */
- } else { gameInfo.variant = newVariant; InitPosition(TRUE); }
+ InitPosition(FALSE); /* this sets up board[0], but also other stuff */
+ } else { gameInfo.variant = newVariant; InitPosition(FALSE); }
+ DrawPosition(TRUE, boards[currentMove]);
}
static int loggedOn = FALSE;
moves and soak them up so user can step
through them and/or save them.
*/
- Reset(TRUE, TRUE);
+ Reset(FALSE, TRUE);
gameMode = IcsObserving;
ModeHighlight();
ics_gamenum = -1;
currentMove = forwardMostMove;
ClearHighlights();/*!!could figure this out*/
flipView = appData.flipView;
- DrawPosition(FALSE, boards[currentMove]);
+ DrawPosition(TRUE, boards[currentMove]);
DisplayBothClocks();
sprintf(str, "%s vs. %s",
gameInfo.white, gameInfo.black);
if (currentMove == 0 &&
gameMode == IcsPlayingWhite &&
appData.premoveWhite) {
- sprintf(str, "%s%s\n", ics_prefix,
- appData.premoveWhiteText);
+ sprintf(str, "%s\n", appData.premoveWhiteText);
if (appData.debugMode)
fprintf(debugFP, "Sending premove:\n");
SendToICS(str);
} else if (currentMove == 1 &&
gameMode == IcsPlayingBlack &&
appData.premoveBlack) {
- sprintf(str, "%s%s\n", ics_prefix,
- appData.premoveBlackText);
+ sprintf(str, "%s\n", appData.premoveBlackText);
if (appData.debugMode)
fprintf(debugFP, "Sending premove:\n");
SendToICS(str);
/* [HGM] copy holdings to board holdings area */
CopyHoldings(boards[forwardMostMove], white_holding, WhitePawn);
CopyHoldings(boards[forwardMostMove], black_holding, BlackPawn);
+ boards[forwardMostMove][BOARD_SIZE-1][BOARD_SIZE-2] = 1; // flag holdings as set
#if ZIPPY
if (appData.zippyPlay && first.initDone) {
ZippyHoldings(white_holding, black_holding,
}
}
CopyBoard(boards[moveNum], board);
+ boards[moveNum][BOARD_SIZE-1][BOARD_SIZE-2] = 0; // [HGM] indicate holdings not set
if (moveNum == 0) {
startedFromSetupPosition =
!CompareBoards(board, initialPosition);
return ImpossibleMove;
}
+ if(toX < 0 || toY < 0) return ImpossibleMove;
pdown = boards[currentMove][fromY][fromX];
pup = boards[currentMove][toY][toX];
}
return;
}
- // ignore to-clicks in holdings
+ // ignore clicks on holdings
if(x < BOARD_LEFT || x >= BOARD_RGHT) return;
}
- if (clickType == Release && (x == fromX && y == fromY ||
- x < BOARD_LEFT || x >= BOARD_RGHT)) {
-
- // treat drags into holding as click on start square
- x = fromX; y = fromY;
-
+ if (clickType == Release && x == fromX && y == fromY) {
DragPieceEnd(xPix, yPix);
if (appData.animateDragging) {
/* Undo animation damage if any */
return;
}
- /* we now have a different from- and to-square */
+ /* we now have a different from- and (possibly off-board) to-square */
/* Completed move */
toX = x;
toY = y;
/* Don't animate move and drag both */
appData.animate = FALSE;
}
+
+ // moves into holding are invalid for now (later perhaps allow in EditPosition)
+ if(x >= 0 && x < BOARD_LEFT || x >= BOARD_RGHT) {
+ ClearHighlights();
+ fromX = fromY = -1;
+ return;
+ }
+
+ // off-board moves should not be highlighted
+ if(x < 0 || x < 0) ClearHighlights();
+
if (HasPromotionChoice(fromX, fromY, toX, toY, &promoChoice)) {
SetHighlights(fromX, fromY, toX, toY);
if(gameInfo.variant == VariantSuper || gameInfo.variant == VariantGreat) {