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.
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) {