From: H.G.Muller Date: Wed, 17 Feb 2016 19:55:36 +0000 (+0100) Subject: Allow promotion choice in engine-defined variants X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=a2f3d790becbea6cd93ec51add89f2251a90bba4 Allow promotion choice in engine-defined variants When variant shatranj, courier or makruk, which normally do not have promotion choice, are used as parent for an engine-defined variant, we now invoke the piece-selection routine. This to make these variants also suitable as parent for variants that do have choice (e.g. to give them the baring rule, which is unique for Shatranj). --- diff --git a/backend.c b/backend.c index bc6ec28..b49ba15 100644 --- a/backend.c +++ b/backend.c @@ -6742,7 +6742,7 @@ HasPromotionChoice (int fromX, int fromY, int toX, int toY, char *promoChoice, i *promoChoice = PieceToChar(p++); if(*promoChoice != '.') break; } - return FALSE; + if(!*engineVariant) return FALSE; // if used as parent variant there might be promotion choice } // no sense asking what we must promote to if it is going to explode... if(gameInfo.variant == VariantAtomic && boards[currentMove][toY][toX] != EmptySquare) { @@ -7449,8 +7449,8 @@ CanPromote (ChessSquare piece, int y) // some variants have fixed promotion piece, no promotion at all, or another selection mechanism if(IS_SHOGI(gameInfo.variant) || gameInfo.variant == VariantXiangqi || gameInfo.variant == VariantSuper || gameInfo.variant == VariantGreat || - gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || - gameInfo.variant == VariantMakruk) return FALSE; + (gameInfo.variant == VariantShatranj || gameInfo.variant == VariantCourier || + gameInfo.variant == VariantMakruk) && !*engineVariant) return FALSE; return (piece == BlackPawn && y <= zone || piece == WhitePawn && y >= BOARD_HEIGHT-1-zone || piece == BlackLance && y <= zone ||