From: H.G.Muller Date: Wed, 7 Oct 2020 21:20:14 +0000 (+0200) Subject: Fix spurious promotion for redefined Pawns in Xiangqi X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=bfad37ff0b19741ac44a75b062723138b588a975;p=xboard.git Fix spurious promotion for redefined Pawns in Xiangqi The Betza move generator, used for pieces with moves redefined by the 'piece' command, always generated Pawn moves to last rank as promotions. In Xiangqi this had the undesired effect that promotion suffixes were considered missing on such moves arriving as text, and a default promotion to Queen was appended to them. Which made the Pawns disappear, as a Queen normally does not participate in Xiangqi. Now the MovesFromString routine suppresses promotion in Xiangqi and Janggi. It still doesn't pay attention to zone depth in other variants. --- diff --git a/moves.c b/moves.c index bbb3b91..f60ec7a 100644 --- a/moves.c +++ b/moves.c @@ -321,8 +321,10 @@ MovesFromString (Board board, int flags, int f, int r, int tx, int ty, int angle ChessMove promo= NormalMove; ChessSquare pc = board[r][f]; if(pc == DarkSquare) return; // this is not a piece, but a 'hole' in the board if(flags & F_WHITE_ON_MOVE) his = 2, mine = 1; else his = 1, mine = 2; - if(pc == WhitePawn || pc == WhiteLance) promo = WhitePromotion, promoRank = BOARD_HEIGHT-1; else - if(pc == BlackPawn || pc == BlackLance) promo = BlackPromotion, promoRank = 0; + if(gameInfo.variant != VariantXiangqi && gameInfo.variant != VariantJanggi) { + if(pc == WhitePawn || pc == WhiteLance) promo = WhitePromotion, promoRank = BOARD_HEIGHT-1; else + if(pc == BlackPawn || pc == BlackLance) promo = BlackPromotion, promoRank = 0; + } while(*p) { // more moves to go int expo = -1, dx, dy, x, y, mode, dirSet, ds2=0, retry=0, initial=0, jump=1, skip = 0, all = 0, put = 0, u = 0; char *cont = NULL, *q;