From: H.G. Muller Date: Sat, 11 Jan 2014 14:34:36 +0000 (+0100) Subject: Fix undo, remove commands X-Git-Tag: 0.18~6 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=3460d0ca7ea329ce5b9db05024e79dd18a942cd3;p=hachu.git Fix undo, remove commands The Init() done in the framework of takebacks did refer to the variant by V_number, rather than by table index. A V_number as now been added to signify 'same variant'. --- diff --git a/hachu.c b/hachu.c index 778182b..f5fd5d2 100644 --- a/hachu.c +++ b/hachu.c @@ -432,7 +432,7 @@ typedef struct { char *array; // initial position } VariantDesc; -typedef enum { V_CHESS, V_SHO, V_CHU, V_DAI, V_DADA, V_MAKA, V_TAI, V_KYOKU, V_TENJIKU, V_SHATRANJ, V_MAKRUK, V_LION } Variant; +typedef enum { V_SAME, V_CHESS, V_SHO, V_CHU, V_DAI, V_DADA, V_MAKA, V_TAI, V_KYOKU, V_TENJIKU, V_SHATRANJ, V_MAKRUK, V_LION } Variant; VariantDesc variants[] = { { 16, 8, 8, 1, V_CHESS, "normal", chessArray }, // FIDE @@ -890,11 +890,13 @@ Init (int var) int i, j, k; PieceDesc *pawn; + if(var != V_SAME) { // the following should be already set if we stay in same variant (for TakeBack) currentVariant = variants[var].varNr; bWidth = variants[var].boardWidth; bHeight = variants[var].boardRanks; zone = variants[var].zoneDepth; array = variants[var].array; + } bsize = bWidth*bHeight; chuFlag = (currentVariant == V_CHU || currentVariant == V_LION); tenFlag = (currentVariant == V_TENJIKU); @@ -2485,7 +2487,7 @@ printf("# ponder=%s\n", MoveToText(pv[1],0)); { // reset the game and then replay it to the desired point int last, stm; last = moveNr - n; if(last < 0) last = 0; - Init(currentVariant); stm = Setup2(startPos); + Init(V_SAME); stm = Setup2(startPos); printf("# setup done");fflush(stdout); for(moveNr=0; moveNr