Fix recognition of variant 11x17+16_shogi
authorH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 10 Apr 2018 15:01:39 +0000 (17:01 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 10 Apr 2018 15:01:39 +0000 (17:01 +0200)
The general recognition of size-overridden variants prevented that an
name with override prefix was still sought as a full name. And because the
17 does not correspond to the true number of ranks, 11x17+16_shogi was not
recognized from the board parameters either.
  The duplicate of euroshogi as size-overridden shogi was misguided, and has
been removed: description of a variant by size overrides is now always
recogized automatically.

dropper.c

index 2cd7c92..3730022 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -344,7 +344,7 @@ shogiProms[16] = { Z_MUST, Z_2ND, COLOR, 0, Z_MUST, Z_MUST, Z_2ND, Z_2ND },
 toriProms[16]  = { Z_MUST, 0, 0, 0, 0, Z_MUST },
 waProms[16]    = { Z_MUST, Z_2ND, Z_MUST, Z_MUST, Z_MUST, COLOR, COLOR, Z_MUST, Z_MUST, Z_MUST, COLOR, Z_MUST, COLOR, Z_MUST };
 
-int lances[] = { 1, 3, 0103, 0103, 1, 1, 3, 3, 1 }; // bitmap indicating piece types with drop restriction (LSB = Pawn) in various variants
+int lances[] = { 1, 3, 0103, 0103, 1, 3, 3, 1 }; // bitmap indicating piece types with drop restriction (LSB = Pawn) in various variants
 
 char *betza[] = { // piece defs for sending to GUI
   NULL, // suppresses setup command
@@ -352,7 +352,6 @@ char *betza[] = { // piece defs for sending to GUI
   "",
   NULL,
   ",N& fNsW,+P& WfF,+N WfF",
-  NULL,
   ",P& fW,L& fWbF,U& fWbF,C& fFsW,G& fFvW,M& fFvW,D& fFbsW,V& FfW,W& WfF,O& fR,H& fRbW2,S& sRvW,F& BfW,E& vRfF3bFsW,R& fRFbW,X& FAvWvD"
   ",+P& WfF,+L& vRfF3bFsW,+U& BfW,+C& vRfFsW,+G& sRvW,+M& FfW,+D& WfF,+V& FfsW,+W& K,+O& K,+H& vN,+S& R,+F& BvRsW,+R& FAvWvD",
   NULL,
@@ -365,7 +364,6 @@ char *ptc[] = { // XBoard 4.9 piece-to-char table
   "PNBR.S...G.++++.+Kpnbr.s...g.++++.+k",
   NULL,
   "PNBR.....G.++++Kpnbr.....g.++++k",
-  NULL,
   "P..^S^FV..^LW^OH.F.^R.E....R...D.GOL^M..^H.M.C.^CU.^W../.......^V.^P.^U..^DS.^GXK"
   "p..^s^fv..^lw^oh.f.^r.e....r...d.gol^m..^h.m.c.^cu.^w../.......^v.^p.^u..^ds.^gxk",
    NULL,
@@ -378,7 +376,6 @@ char *pstType[] = {
   "3077160 7777187",
   "3077160 7777187",
   "30771607 77771877",
-  "30771607 77771877",
   "3055676777060100 77100787777801",
   "3055676777060100 77100787777801",
   "770076 100001"
@@ -398,13 +395,12 @@ VariantDesc variants[] = {
   {  6,  6,  6, 2, "judkinshogi\n", shogiIDs, judkinFEN, shogiDirs, shogiProms, shogiCodes, judkinValues },
   {  9,  9,  7, 3, "shogi\n",       shogiIDs, shogiFEN,  shogiDirs, shogiProms, shogiCodes, shogiValues },
   {  8,  8,  5, 3, "euroshogi\n",   euroIDs,  euroFEN,   shogiDirs, shogiProms, shogiCodes, shogiValues }, 
-  {  8,  8,  5, 3, "8x8+5_shogi\n", euroIDs,  euroFEN,   shogiDirs, shogiProms, shogiCodes, shogiValues }, 
   { 11, 11, 16, 3, "crazywa\n",     waIDs,    waFEN,     waDirs,    waProms,    shogiCodes, waValues    }, 
   { 11, 11, 16, 3, "11x17+16_chu\n",waIDs,    waFEN,     waDirs,    waProms,    shogiCodes, waValues    }, 
   {  7,  7,  6, 2, "torishogi\n",   toriIDs,  toriFEN,   toriDirs,  toriProms,  toriCodes,  toriValues  },
 };
 
-#define TORI_NR 8 /* must correspond to index of torishogi (which must be last) in table above! */
+#define TORI_NR 7 /* must correspond to index of torishogi (which must be last) in table above! */
 #define KNIGHTLESS 4 /* first variant without a Knight (except mini-, which has no 2-rank zone) */
 
 // info per piece type. sometimes indexed by negated holdings count instead of piece
@@ -469,14 +465,14 @@ char *pieces, *startPos;
 void
 GameInit (char *name)
 {
-    int v, *ip, i, color, r, f, zone;
+    int v=0, *ip, i, color, r, f, zone;
     unsigned char *moves, *codes; char c, *p;
 
     // determine variant parameters
     if(sscanf(name, "%dx%d+%d_%c", &f, &r, &i, &c) == 4) {
        for(v=TORI_NR+1; --v>0; ) if(variants[v].files == f && variants[v].ranks == r && variants[v].hand == i) break;
-    } else
-    for(v=TORI_NR+1; --v>0;) if(!strcmp(name, variants[v].name)) break;
+    }
+    if(v <= 0) for(v=TORI_NR+1; --v>0;) if(!strcmp(name, variants[v].name)) break;
     nrFiles = variants[v].files;
     nrRanks = variants[v].ranks;
     zone    = variants[v].zone;