From 2198cc8f179a74ddfe499c5ced469c86a8f2cd42 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sun, 23 Apr 2006 08:38:57 -0400 Subject: [PATCH] libchess: RAV parsing fix. --- libchess/pgn.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libchess/pgn.c b/libchess/pgn.c index f5b88d7..91ca988 100644 --- a/libchess/pgn.c +++ b/libchess/pgn.c @@ -1107,13 +1107,13 @@ static int rav_text(GAME *g, FILE *fp, int which, BOARD o) memcpy(&tg, g, sizeof(GAME)); memcpy(pgn_board, o, sizeof(BOARD)); - if ((g->hp[g->hindex]->rav = calloc(1, sizeof(HISTORY))) == NULL) { + if ((g->hp[g->hindex - 1]->rav = calloc(1, sizeof(HISTORY))) == NULL) { warn("calloc()"); return 1; } // pgn_history_add() will now append to this new RAV. - g->hp = g->hp[g->hindex]->rav; + g->hp = g->hp[g->hindex - 1]->rav; /* * Reset. Will be restored later from 'tg' which is a local variable @@ -1121,6 +1121,7 @@ static int rav_text(GAME *g, FILE *fp, int which, BOARD o) */ g->hindex = 0; ravlevel++; + pgn_switch_turn(g); /* * Now continue as normal as if there were no RAV. Moves will be -- 2.11.4.GIT