Always accept piece commands in partly supported variants
authorH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 25 Sep 2014 17:11:21 +0000 (19:11 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Sun, 28 Sep 2014 20:14:28 +0000 (22:14 +0200)
Normally piece commands are ignored when legality checking is on, as
XBoard's idea of legality should obviously overrule the engine's.
In variants that are not or only partly supported, however, XBoard has
no own idea of what is legal, so it is better to take the engine's
advice than enforcing wrong rules.

backend.c

index ec9cfbb..9495083 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -8893,7 +8893,11 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h
     if(sscanf(message, "piece %s %s", buf2, buf1) == 2) {
       ChessSquare piece = WhitePawn;
       char *p=buf2;
-      if(cps != &first || appData.testLegality) return;
+      if(cps != &first || appData.testLegality && *engineVariant == NULLCHAR
+      /* For variants we don't have   */       && gameInfo.variant != VariantBerolina
+      /* correct rules for, we cannot */       && gameInfo.variant != VariantCylinder
+      /* enforce legality on our own! */       && gameInfo.variant != VariantUnknown
+                                               && gameInfo.variant != VariantFairy    ) return;
       if(*p == '+') piece = CHUPROMOTED WhitePawn, p++;
       piece += CharToPiece(*p) - WhitePawn;
       if(piece < EmptySquare) {