int border; /* [HGM] width of board rim, needed to size seek graph */
char bestMove[MSG_SIZ], avoidMove[MSG_SIZ];
int solvingTime, totalTime, jawsClock;
-
+ChessSquare leaveBehind[EmptySquare+1][EmptySquare];
/* States for ics_getting_history */
#define H_FALSE 0
#define H_REQUESTED 1
return TRUE;
}
+void
+ParseMatrix (char *s, ChessSquare matrix[][EmptySquare])
+{
+ int i= -1, j, k;
+ char c = '/';
+ do {
+ if(c == '/') { while(pieceToChar[++i] == '.') {} j = -2; continue; }
+ if(j == -2) { j++; k = EmptySquare; } else {
+ while(pieceToChar[++j] == '.') {}
+ k = j;
+ }
+ matrix[k][i] = CharToPiece(c);
+ } while((c = *s++));
+}
+
char *savedMessage;
ChessProgramState *savedState;
void
}
return;
}
+ if(sscanf(message, "split %s" , buf1) == 1) { if(*engineVariant) ParseMatrix(buf1, leaveBehind); return;}
if(sscanf(message, "choice %s", promoRestrict) == 1) {
if(gameMode == BeginningOfGame && cps == &first &&
(!appData.testLegality || *engineVariant != NULLCHAR || gameInfo.variant == VariantFairy)) {
void
ApplyMove (int fromX, int fromY, int toX, int toY, int promoChar, Board board)
{
- ChessSquare captured = board[toY][toX], piece, pawn, king, killed, killed2;
+ ChessSquare captured = board[toY][toX], piece, pawn, king, killed, killed2, left;
int p, rookX, oldEP, epRank, epFile, lastFile, lastRank, berolina = 0, isEP = 0;
int promoRank = gameInfo.variant == VariantMakruk || gameInfo.variant == VariantGrand || gameInfo.variant == VariantChuChess ? 3 : 1;
&& pieceToChar[PROMOTED(newPiece)] == '~') newPiece = PROMOTED(newPiece);// but promoted version available
board[toY][toX] = newPiece;
}
+ left = leaveBehind[promoChar ? board[toY][toX] : EmptySquare][piece]; // [HGM] for variants that split pieces
+ if(left != EmptySquare) board[fromY][fromX] = left; // make sure this does not interfere unless split command was received
if((gameInfo.variant == VariantSuper || gameInfo.variant == VariantGreat || gameInfo.variant == VariantGrand)
&& promoChar != NULLCHAR && gameInfo.holdingsSize) {
// [HGM] superchess: take promotion piece out of holdings
void
Reset (int redraw, int init)
{
- int i;
+ int i, j;
if (appData.debugMode) {
fprintf(debugFP, "Reset(%d, %d) from gameMode %d\n",
handSize = 0;
prelude = FALSE; preludeText[0] = NULLCHAR;
for(i=0; i<EmptySquare; i++) { FREE(pieceDesc[i]); pieceDesc[i] = NULL; }
+ for(i=0; i<=EmptySquare; i++) for(j=0; j<EmptySquare; j++) leaveBehind[i][j] = EmptySquare;
CleanupTail(); // [HGM] vari: delete any stored variations
CommentPopDown(); // [HGM] make sure no comments to the previous game keep hanging on
pausing = pauseExamInvalid = FALSE;