From: H.G.Muller Date: Wed, 9 Apr 2014 07:19:43 +0000 (+0200) Subject: Make EditPosition pallette work in Asian variants X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=5f5ea25ea2421cdf6d620d05548c2efa3d81783f;p=xboard.git Make EditPosition pallette work in Asian variants Construction of the pallette position was not working in variants that did not have Pawns start on 2nd rank, or that had multiple ranks of pieces. Now the algorithm is applied to all ranks. --- diff --git a/backend.c b/backend.c index 88fed00..b05e795 100644 --- a/backend.c +++ b/backend.c @@ -15013,14 +15013,14 @@ EditPositionMenuEvent (ChessSquare selection, int x, int y) boards[0][y][x] = p; } } - menuBoard[1][x] = menuBoard[BOARD_HEIGHT-2][x] = p; } if(gameMode != IcsExamining) { // [HGM] editpos: cycle trough boards - for(x = BOARD_LEFT; x < BOARD_RGHT; x++) { // create 'menu board' by removing duplicates - ChessSquare p = menuBoard[0][x]; - for(y = x + 1; y < BOARD_RGHT; y++) if(menuBoard[0][y] == p) menuBoard[0][y] = EmptySquare; - p = menuBoard[BOARD_HEIGHT-1][x]; - for(y = x + 1; y < BOARD_RGHT; y++) if(menuBoard[BOARD_HEIGHT-1][y] == p) menuBoard[BOARD_HEIGHT-1][y] = EmptySquare; + int r; + for(r = 0; r < BOARD_HEIGHT; r++) { + for(x = BOARD_LEFT; x < BOARD_RGHT; x++) { // create 'menu board' by removing duplicates + ChessSquare p = menuBoard[r][x]; + for(y = x + 1; y < BOARD_RGHT; y++) if(menuBoard[r][y] == p) menuBoard[r][y] = EmptySquare; + } } DisplayMessage("Clicking clock again restores position", ""); if(gameInfo.variant != lastVariant) lastVariant = gameInfo.variant, CopyBoard(erasedBoard, boards[0]);