X-Git-Url: http://winboard.nl/cgi-bin?p=capablanca.git;a=blobdiff_plain;f=lasker-2.2.3%2Fsrc%2Falgcheck.c;h=3efc4ce34ed04d60441290a7cb8b5d9645cc0971;hp=cdc97b266566bd0ac03b2a1717eae83dc9439bc7;hb=534b15b1773a6f879b0b83fb0cfa0b02b003813c;hpb=aabaa926fde2f7cd599776bd6ae0f6868eb892da diff --git a/lasker-2.2.3/src/algcheck.c b/lasker-2.2.3/src/algcheck.c index cdc97b2..3efc4ce 100644 --- a/lasker-2.2.3/src/algcheck.c +++ b/lasker-2.2.3/src/algcheck.c @@ -199,6 +199,7 @@ static int get_move_info(const char *str, int *piece, int *ff, int *fr, int *tf, matchVal = i; nomatch:; } + if (matchVal != -1) return MS_ALG; else @@ -221,7 +222,6 @@ static void add_promotion(struct game_state_t *gs, const char *mstr, struct move if (s == NULL) { return; } - if(gs->promoType == 3) { // handle Shogi promotions piece = gs->board[mt->fromFile][mt->fromRank]; if(colorval(piece) == WHITE && mt->fromRank < gs->ranks - gs->ranks/3 @@ -250,7 +250,7 @@ static void add_promotion(struct game_state_t *gs, const char *mstr, struct move if (piecetype(gs->board[mt->fromFile][mt->fromRank]) != PAWN) { return; } - if (mt->toRank != gs->ranks-1 && mt->toRank != 0) { + if (mt->toRank < gs->ranks - gs->promoZone && mt->toRank >= gs->promoZone) { return; } @@ -305,9 +305,9 @@ static void add_promotion(struct game_state_t *gs, const char *mstr, struct move default: return; } - i = colorval(gs->board[mt->fromFile][mt->fromRank]) == WHITE ? 0 : 1; - if(piece >= WOODY && (gs->promoType != 2 || gs->holding[i][piece-1] == 0)) return; + if(gs->promoType == 2 && gs->holding[i][piece-1] == 0) return; // only if piece was captured + if(piece >= WOODY && (gs->promoType != 2 || gs->promoZone == 3)) return; // reserved for Superchess mt->piecePromotionTo = piece | colorval(gs->board[mt->fromFile][mt->fromRank]); } @@ -322,7 +322,6 @@ int alg_parse_move(char *mstr, struct game_state_t * gs, struct move_t * mt) d_printf( "CHESSD: Shouldn't try to algebraicly parse non-algabraic move string.\n"); return MOVE_ILLEGAL; } - // [HGM] check if move does not stray off board if(gs->ranks < 10) { if(tr == 0 || fr == 0) return MOVE_ILLEGAL; // used nonexistent 0-rank @@ -431,7 +430,6 @@ int alg_parse_move(char *mstr, struct game_state_t * gs, struct move_t * mt) // note that the interpretation Bxc4 is matched last, and has set piece to BISHOP continue; } - if (legal_andcheck_move(gs, f, r, tf, tr)) { if ((piecetype(gs->board[f][r]) == PAWN) && (f != tolower(mstr[0]) - 'a')) { continue;