more work on variant switch
authorH.G. Muller <h.g.muller@hccnet.nl>
Tue, 27 Oct 2009 03:38:37 +0000 (20:38 -0700)
committerArun Persaud <arun@nubati.net>
Tue, 27 Oct 2009 03:38:37 +0000 (20:38 -0700)
the previous solution to the cosmetic problem of displaying a wrong shuffle
in an ICS game that was observed from the very start unfortunately turned
out to cause a real error in diplaying a stored game through the smoves
command, for variants not using the FIDE setup as standard.

This patch displays the position from before setting up the start position
of the new variant, but does setup boards[0] to the initial position of that
variant. (If this is a wrong shuffle, it is thus ot displayed, and a new board
will immediately be sent from the ICS to correct the shuffle.)

backend.c

index a8a44cb..0db2b76 100755 (executable)
--- a/backend.c
+++ b/backend.c
@@ -2016,8 +2016,7 @@ VariantSwitch(Board board, VariantClass newVariant)
    } else gameInfo.variant = newVariant;
    CopyBoard(oldBoard, board);   // remember correctly formatted board
      InitPosition(FALSE);          /* this sets up board[0], but also other stuff        */
-   if(currentMove == 0) CopyBoard(board, oldBoard); // preserve start position
-   DrawPosition(TRUE, boards[currentMove]);
+   DrawPosition(TRUE, currentMove ? boards[currentMove] : oldBoard);
 }
 
 static int loggedOn = FALSE;