From 093d989d136cc87cbb1c739b3ddea5337cf2b702 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Mon, 7 Mar 2016 13:46:50 +0100 Subject: [PATCH] Show moves in Edit Book window as SAN The opening moves in the GUI book for the current position shown in the Edit Book window are converted to SAN before showing them, when they have the simple form fromSqr toSqr promoChar. (This excludes drop moves and double moves.) --- backend.h | 1 + book.c | 3 +++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/backend.h b/backend.h index be1906e..69ce5fb 100644 --- a/backend.h +++ b/backend.h @@ -428,6 +428,7 @@ char *SupportedVariant P((char *list, VariantClass v, int w, int h, int s, int p char *CollectPieceDescriptors P((void)); void RefreshSettingsDialog P((ChessProgramState *cps, int val)); void StartChessProgram P((ChessProgramState *cps)); +int PosFlags P((int n)); /* A point in time */ diff --git a/book.c b/book.c index cfc25c8..a777edc 100644 --- a/book.c +++ b/book.c @@ -742,6 +742,9 @@ MovesToText(int count, entry_t *entries) move_to_string(algMove, entries[i].move); if(sscanf(algMove, "%c%d%*c%*d,%c%d%c%d", &c1, &i1, &c2, &i2, &c3, &i3) == 6) snprintf(algMove, 12, "%c%dx%c%d-%c%d", c1, i1, c2, i2, c3, i3); // cast double-moves in format SAN parser will understand + else if(sscanf(algMove, "%c%d%c%d%c", &c1, &i1, &c2, &i2, &c3) >= 4) { + CoordsToAlgebraic(boards[currentMove], PosFlags(currentMove), i1-ONE+'0', c1-AAA, i2-ONE+'0', c2-AAA, c3, algMove); + } buf[0] = NULLCHAR; if(entries[i].learnCount || entries[i].learnPoints) snprintf(buf, MSG_SIZ, " {%d/%d}", entries[i].learnPoints, entries[i].learnCount); -- 1.7.0.4