From af73501b054db378b0a3e687a28e98c9234e973c Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Tue, 13 Oct 2009 20:32:32 -0700 Subject: [PATCH] Proper board and holdings size when switching to variants gothic, capablanca, great and super within an ICS game. --- backend.c | 114 +++++++++++++++++++++++++++++++----------------------------- 1 files changed, 59 insertions(+), 55 deletions(-) diff --git a/backend.c b/backend.c index 1f424e3..bdac10d 100644 --- a/backend.c +++ b/backend.c @@ -1940,8 +1940,6 @@ void VariantSwitch(Board board, VariantClass newVariant) { int newHoldingsWidth, newWidth = 8, newHeight = 8, i, j; - int oldCurrentMove = currentMove, oldForwardMostMove = forwardMostMove, oldBackwardMostMove = backwardMostMove; -// Board tempBoard; int saveCastling[BOARD_SIZE], saveEP; startedFromPositionFile = FALSE; if(gameInfo.variant == newVariant) return; @@ -1958,59 +1956,65 @@ VariantSwitch(Board board, VariantClass newVariant) * case we want to add those holdings to the already received position. */ - - if (appData.debugMode) { - fprintf(debugFP, "Switch board from %s to %s\n", - VariantName(gameInfo.variant), VariantName(newVariant)); - setbuf(debugFP, NULL); - } - shuffleOpenings = 0; /* [HGM] shuffle */ - gameInfo.holdingsSize = 5; /* [HGM] prepare holdings */ - switch(newVariant) { - case VariantShogi: - newWidth = 9; newHeight = 9; - gameInfo.holdingsSize = 7; - case VariantBughouse: - case VariantCrazyhouse: - newHoldingsWidth = 2; break; - default: - newHoldingsWidth = gameInfo.holdingsSize = 0; - } - - if(newWidth != gameInfo.boardWidth || - newHeight != gameInfo.boardHeight || - newHoldingsWidth != gameInfo.holdingsWidth ) { - - /* shift position to new playing area, if needed */ - if(newHoldingsWidth > gameInfo.holdingsWidth) { - for(i=0; i=BOARD_LEFT; j--) - board[i][j+newHoldingsWidth-gameInfo.holdingsWidth] = - board[i][j]; - for(i=0; i gameInfo.holdingsWidth) { + for(i=0; i=BOARD_LEFT; j--) + board[i][j+newHoldingsWidth-gameInfo.holdingsWidth] = + board[i][j]; + for(i=0; i