From: H.G. Muller Date: Fri, 28 Feb 2014 08:40:51 +0000 (+0100) Subject: Fix variant choice X-Git-Tag: 0.18~4 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=7f4e90428b8f436483fe19d86d81b4acc67929ef;p=hachu.git Fix variant choice Init() must be passed the variant number, not a variant ID, so setting the variant to Chess (which has number 0 in the variants table) got confused with V_SAME for staying in the same variant, and thus did not work. The invalid variant number -1 is now used to stay in the current variant. --- diff --git a/hachu.c b/hachu.c index 1bfa35a..84f7249 100644 --- a/hachu.c +++ b/hachu.c @@ -432,7 +432,9 @@ typedef struct { char *array; // initial position } VariantDesc; -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; +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; + +#define SAME (-1) VariantDesc variants[] = { { 16, 8, 8, 1, V_CHESS, "normal", chessArray }, // FIDE @@ -890,7 +892,7 @@ 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) + if(var != 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; @@ -2487,7 +2489,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(V_SAME); stm = Setup2(startPos); + Init(SAME); stm = Setup2(startPos); printf("# setup done");fflush(stdout); for(moveNr=0; moveNr