X-Git-Url: http://winboard.nl/cgi-bin?p=capablanca.git;a=blobdiff_plain;f=lasker-2.2.3%2Fsrc%2Falgcheck.c;h=33f6b288fa7856a038ef90d0588095903415aec1;hp=1c1ff75585e17431c7e6f3184d87475a47b38917;hb=5317b80b41045bd23473faf4748a9539a06e5f52;hpb=3f31178e2168d0dc5ca0db4e245c63c25bb7ed1d diff --git a/lasker-2.2.3/src/algcheck.c b/lasker-2.2.3/src/algcheck.c index 1c1ff75..33f6b28 100644 --- a/lasker-2.2.3/src/algcheck.c +++ b/lasker-2.2.3/src/algcheck.c @@ -529,12 +529,18 @@ char *alg_unparse(struct game_state_t * gs, struct move_t * mt) piece = piecetype(gs->board[mt->fromFile][mt->fromRank]); } - if ((mt->fromFile == ALG_CASTLE) && (mt->toFile > mt->toRank)) { // [HGM] castle: K ends right of R - strcpy(mStr, "O-O"); - goto check; - } - if ((mt->fromFile == ALG_CASTLE) && (mt->toFile < mt->toRank)) { // [HGM] castle: K ends left of R - strcpy(mStr, "O-O-O"); + if (mt->fromFile == ALG_CASTLE) { + int r = gs->onMove == WHITE ? 1 : gs->ranks; + if(mt->toFile > mt->toRank) { // [HGM] castle: K ends right of R + strcpy(mStr, "O-O"); + } + if (mt->toFile < mt->toRank) { // [HGM] castle: K ends left of R + strcpy(mStr, "O-O-O"); + } + if(gs->drops == 2) { + if(mt->piecePromotionTo < 0) snprintf(mStr, 20, "%c%de%d", mt->fromRank + 'a', r, r); + goto suffix; // [HGM] in Seirawan castling can have gating suffix + } goto check; } strcpy(mStr, ""); @@ -690,10 +696,10 @@ char *alg_unparse(struct game_state_t * gs, struct move_t * mt) } sprintf(tmp, "%c%d", mt->toFile + 'a', mt->toRank + 1 - (gs->ranks > 9)); strcat(mStr, tmp); - +suffix: if ((piece == PAWN || gs->promoType == 3 || gs->drops == 2) && (mt->piecePromotionTo != NOPIECE)) { strcat(mStr, "="); /* = before promoting piece */ - switch (piecetype(mt->piecePromotionTo)) { + switch (piecetype(abs(mt->piecePromotionTo))) { case KNIGHT: strcat(mStr, "N"); break;