From 4a93b2d0743219a65784b043395cda77fa80662c Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Fri, 29 Jan 2016 10:32:02 +0100 Subject: [PATCH] Fix Chu promotion with added pieces There were still some hard-coded 22s in the code, which no longer described the difference between Pawn and Tokin and the number of promotable pieces, now that new pieces have been added. --- backend.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend.c b/backend.c index f10b4a0..3254ff7 100644 --- a/backend.c +++ b/backend.c @@ -5383,7 +5383,7 @@ static ClickType lastClickType; int Partner (ChessSquare *p) { // change piece into promotion partner if one shogi-promotes to the other - int stride = gameInfo.variant == VariantChu ? 22 : 11; + int stride = gameInfo.variant == VariantChu ? WhiteTokin : 11; ChessSquare partner; partner = (*p/stride & 1 ? *p - stride : *p + stride); if(PieceToChar(*p) != '+' && PieceToChar(partner) != '+') return 0; @@ -6632,7 +6632,7 @@ HasPromotionChoice (int fromX, int fromY, int toX, int toY, char *promoChoice, i if(gameInfo.variant == VariantChu) { int p = piece >= BlackPawn ? BLACK_TO_WHITE piece : piece; promotionZoneSize = BOARD_HEIGHT/3; - highestPromotingPiece = (p >= WhiteLion || PieceToChar(piece + 22) == '.') ? WhitePawn : WhiteLion; + highestPromotingPiece = (p >= WhiteTokin || PieceToChar(piece + WhiteTokin) != '+') ? WhitePawn : WhiteTokin-1; } else if(gameInfo.variant == VariantShogi) { promotionZoneSize = BOARD_HEIGHT/3 +(BOARD_HEIGHT == 8); highestPromotingPiece = (int)WhiteAlfil; -- 1.7.0.4