summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
412a8de)
The promotion popup did not work properly in variants where black did
not use the pieces that white wanted to promote to. Now the character
for the selected piece is taken from the piece encodings of the side to
move. In addition, selection of undefined pieces is ignored.
SW_SHOW : SW_HIDE);\r
/* [HGM] Only allow C & A promotions if these pieces are defined */\r
ShowWindow(GetDlgItem(hDlg, PB_Archbishop),\r
SW_SHOW : SW_HIDE);\r
/* [HGM] Only allow C & A promotions if these pieces are defined */\r
ShowWindow(GetDlgItem(hDlg, PB_Archbishop),\r
- ((PieceToChar(WhiteAngel) >= 'A' &&\r
+ ((PieceToChar(WhiteAngel) >= 'A' && WhiteOnMove(currentMove) &&\r
PieceToChar(WhiteAngel) != '~') ||\r
PieceToChar(WhiteAngel) != '~') ||\r
- (PieceToChar(BlackAngel) >= 'A' &&\r
+ (PieceToChar(BlackAngel) >= 'A' && !WhiteOnMove(currentMove) &&\r
PieceToChar(BlackAngel) != '~') ) ?\r
SW_SHOW : SW_HIDE);\r
ShowWindow(GetDlgItem(hDlg, PB_Chancellor), \r
PieceToChar(BlackAngel) != '~') ) ?\r
SW_SHOW : SW_HIDE);\r
ShowWindow(GetDlgItem(hDlg, PB_Chancellor), \r
- ((PieceToChar(WhiteMarshall) >= 'A' &&\r
+ ((PieceToChar(WhiteMarshall) >= 'A' && WhiteOnMove(currentMove) &&\r
PieceToChar(WhiteMarshall) != '~') ||\r
PieceToChar(WhiteMarshall) != '~') ||\r
- (PieceToChar(BlackMarshall) >= 'A' &&\r
+ (PieceToChar(BlackMarshall) >= 'A' && !WhiteOnMove(currentMove) &&\r
PieceToChar(BlackMarshall) != '~') ) ?\r
SW_SHOW : SW_HIDE);\r
/* [HGM] Hide B & R button in Shogi, use Q as promote, N as defer */\r
PieceToChar(BlackMarshall) != '~') ) ?\r
SW_SHOW : SW_HIDE);\r
/* [HGM] Hide B & R button in Shogi, use Q as promote, N as defer */\r
promoChar = gameInfo.variant == VariantSuper ? PieceToChar(BlackSilver) : PieceToChar(BlackKing);\r
break;\r
case PB_Queen:\r
promoChar = gameInfo.variant == VariantSuper ? PieceToChar(BlackSilver) : PieceToChar(BlackKing);\r
break;\r
case PB_Queen:\r
- promoChar = gameInfo.variant == VariantShogi ? '+' : PieceToChar(BlackQueen);\r
+ promoChar = gameInfo.variant == VariantShogi ? '+' : ToLower(PieceToChar(WhiteOnMove(currentMove) ? WhiteQueen : BlackQueen));\r
- promoChar = PieceToChar(BlackRook);\r
+ promoChar = ToLower(PieceToChar(WhiteOnMove(currentMove) ? WhiteRook : BlackRook));\r
break;\r
case PB_Bishop:\r
break;\r
case PB_Bishop:\r
- promoChar = PieceToChar(BlackBishop);\r
+ promoChar = ToLower(PieceToChar(WhiteOnMove(currentMove) ? WhiteBishop : BlackBishop));\r
break;\r
case PB_Chancellor:\r
break;\r
case PB_Chancellor:\r
- promoChar = PieceToChar(BlackMarshall);\r
+ promoChar = ToLower(PieceToChar(WhiteOnMove(currentMove) ? WhiteMarshall : BlackMarshall));\r
break;\r
case PB_Archbishop:\r
break;\r
case PB_Archbishop:\r
- promoChar = PieceToChar(BlackAngel);\r
+ promoChar = ToLower(PieceToChar(WhiteOnMove(currentMove) ? WhiteAngel : BlackAngel));\r
break;\r
case PB_Knight:\r
break;\r
case PB_Knight:\r
- promoChar = gameInfo.variant == VariantShogi ? '=' : PieceToChar(BlackKnight);\r
+ promoChar = gameInfo.variant == VariantShogi ? '=' : PieceToChar(WhiteOnMove(currentMove) ? WhiteKnight : BlackKnight);\r
break;\r
default:\r
return FALSE;\r
}\r
break;\r
default:\r
return FALSE;\r
}\r
+ if(promoChar == '.') return FALSE; // invalid piece chosen \r
EndDialog(hDlg, TRUE); /* Exit the dialog */\r
EndDialog(hDlg, TRUE); /* Exit the dialog */\r
- /* [HGM] <popupFix> Call FinishMove rather than UserMoveEvent, as we\r
- only show the popup when we are already sure the move is valid or\r
- legal. We pass a faulty move type, but the kludge is that FinishMove\r
- will figure out it is a promotion from the promoChar. */\r
UserMoveEvent(fromX, fromY, toX, toY, promoChar);\r
fromX = fromY = -1;\r
if (!appData.highlightLastMove) {\r
UserMoveEvent(fromX, fromY, toX, toY, promoChar);\r
fromX = fromY = -1;\r
if (!appData.highlightLastMove) {\r