This had to be a Shogi-style popup.
if(gameInfo.variant == VariantChu) {
int p = piece >= BlackPawn ? BLACK_TO_WHITE piece : piece;
promotionZoneSize = BOARD_HEIGHT/3;
- highestPromotingPiece = (p >= WhiteLion || PieceToChar(piece + 22) == '.') ? WhitePawn : WhiteKing;
+ highestPromotingPiece = (p >= WhiteLion || PieceToChar(piece + 22) == '.') ? WhitePawn : WhiteLion;
} else if(gameInfo.variant == VariantShogi) {
promotionZoneSize = BOARD_HEIGHT/3;
highestPromotingPiece = (int)WhiteAlfil;
ClearHighlights();
}
#endif
- if(!dragging || marker[y][x] == 5) { // [HGM] lion: this was the release of a to-click or drag on a cyan square
+ if(marker[y][x] == 5) { // [HGM] lion: this was the release of a to-click or drag on a cyan square
dragging *= 2; // flag button-less dragging if we are dragging
MarkTargetSquares(1);
if(x == killX && y == killY) killX = killY = -1; else {
{ // choice depends on variant: prepare dialog acordingly
count = 8;
SetPromo(_("Cancel"), --count, 0); // Beware: GenericPopUp cannot handle user buttons named "cancel" (lowe case)!
- if(gameInfo.variant != VariantShogi) {
+ if(!IS_SHOGI(gameInfo.variant)) {
if (!appData.testLegality || gameInfo.variant == VariantSuicide ||
gameInfo.variant == VariantSpartan && !WhiteOnMove(currentMove) ||
gameInfo.variant == VariantGiveaway) {
if(board[BOARD_HEIGHT-1-PieceToNumber(CharToPiece(ToLower(promoChar)))][1] == 0) return ImpossibleMove;
}
} else
- if(IS_SHOGI(gameInfo.variant)) {
+ if(gameInfo.variant == VariantChu) {
+ if(cl.kind != NormalMove || promoChar == NULLCHAR || promoChar == '=') return cl.kind;
+ if(promoChar != '+')
+ return CharToPiece(promoChar) == EmptySquare ? ImpossibleMove : IllegalMove;
+ if(PieceToChar(CHUPROMOTED board[rf][ff]) != '+') return ImpossibleMove;
+ return flags & F_WHITE_ON_MOVE ? WhitePromotion : BlackPromotion;
+ } else
+ if(gameInfo.variant == VariantShogi) {
/* [HGM] Shogi promotions. '=' means defer */
if(rf != DROP_RANK && cl.kind == NormalMove) {
ChessSquare piece = board[rf][ff];