From 0572e7f6b4745cdfc793faa3af6c19ddb750c4ba Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Thu, 7 May 2009 21:44:03 -0700 Subject: [PATCH] handle promotion case for Shogi --- moves.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/moves.c b/moves.c index 58cbfc0..eb0701c 100644 --- a/moves.c +++ b/moves.c @@ -169,7 +169,9 @@ ChessMove PromoCharToMoveType(whiteOnMove, promoChar) int whiteOnMove; int promoChar; { /* [HGM] made dependent on CharToPiece to alow alternate piece letters */ - ChessSquare piece = CharToPiece(whiteOnMove ? ToUpper(promoChar) : ToLower(promoChar) ); + ChessSquare piece = CharToPiece(whiteOnMove ? ToUpper(promoChar) : ToLower(promoChar) ); + + if(promoChar == NULLCHAR) return NormalMove; switch(piece) { @@ -1086,6 +1088,7 @@ ChessMove LegalityTest(board, flags, epfile, castlingRights, rf, ff, rt, ft, pro } } else if (promoChar != NULLCHAR && promoChar != 'x') { + if(promoChar == '=') cl.kind = IllegalMove; else // [HGM] shogi: no deferred promotion outside Shogi if (cl.kind == WhitePromotionQueen || cl.kind == BlackPromotionQueen) { cl.kind = PromoCharToMoveType((flags & F_WHITE_ON_MOVE) != 0, promoChar); -- 1.7.0.4