if(!blackPlaysFirst) {
startedFromPositionFile = TRUE;
CopyBoard(filePosition, boards[0]);
+ CopyBoard(initialPosition, boards[0]);
}
}
if (initialMode == AnalyzeMode) {
return;
}
}
-printf("to click %d,%d\n",x,y);
+
/* fromX != -1 */
if (clickType == Press && gameMode != EditPosition) {
ChessSquare fromP;
// ignore clicks on holdings
if(x < BOARD_LEFT || x >= BOARD_RGHT) return;
}
-printf("A type=%d\n",clickType);
- if(x == fromX && y == fromY && gameMode == EditPosition && SubtractTimeMarks(&lastClickTime, &prevClickTime) < 200) {
+ if(x == fromX && y == fromY && clickType == Press && gameMode == EditPosition && SubtractTimeMarks(&lastClickTime, &prevClickTime) < 200) {
gatingPiece = boards[currentMove][fromY][fromX]; // prepare to copy rather than move
+ DragPieceBegin(xPix, yPix, FALSE); dragging = 1;
return;
}
}
clearFlag = 0;
-printf("B\n");
+
if(gameMode != EditPosition && !appData.testLegality && !legal[y][x] &&
fromX >= BOARD_LEFT && fromX < BOARD_RGHT && (x != killX || y != killY) && !sweepSelecting) {
if(dragging) DragPieceEnd(xPix, yPix), dragging = 0;
DrawPosition(TRUE, NULL);
return; // ignore to-click
}
-printf("(%d,%d)-(%d,%d) %d %d\n",fromX,fromY,toX,toY,x,y);
+
/* we now have a different from- and (possibly off-board) to-square */
/* Completed move */
if(!sweepSelecting) {
gameInfo.event = StrSave(yy_text);
}
- startedFromSetupPosition = FALSE;
+ startedFromSetupPosition = startedFromPositionFile; // [HGM]
while (cm == PGNTag) {
if (appData.debugMode)
fprintf(debugFP, "Parsed PGNTag: %s\n", yy_text);
while (emptycount--)
board[i][(j++)+gameInfo.holdingsWidth] = EmptySquare;
if (*p == '/') p++;
- else if(autoSize) { // we stumbled unexpectedly into end of board
+ else if(autoSize && i != BOARD_HEIGHT-1) { // we stumbled unexpectedly into end of board
for(k=i; k<BOARD_HEIGHT; k++) { // too few ranks; shift towards bottom
for(j=0; j<BOARD_WIDTH; j++) board[k-i][j] = board[k][j];
}
}
while (*p == '/' || *p == ' ') p++;
- if(autoSize) appData.NrFiles = w, InitPosition(TRUE);
+ if(autoSize && w != 0) appData.NrFiles = w, InitPosition(TRUE);
/* [HGM] by default clear Crazyhouse holdings, if present */
if(gameInfo.holdingsWidth) {