From 69d1b4a276b51c94df6054f34bab667799ea13fe Mon Sep 17 00:00:00 2001 From: Jean Bovet Date: Fri, 7 May 2021 20:07:44 -0700 Subject: [PATCH] Fixed issue with multiple variations --- BChessTests/PGNTests.cpp | 2 +- Shared/Engine/Engine/ChessGame.cpp | 6 ++---- Shared/Engine/Engine/ChessGame.hpp | 11 ++++++++++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/BChessTests/PGNTests.cpp b/BChessTests/PGNTests.cpp index 912c398..e0ff569 100644 --- a/BChessTests/PGNTests.cpp +++ b/BChessTests/PGNTests.cpp @@ -296,7 +296,7 @@ TEST_F(PGN, PGNWithVariation2) { ChessGame game; ASSERT_TRUE(FPGN::setGame(pgn, game)); - ASSERT_EQ(12, game.getNumberOfMoves()); + ASSERT_EQ(3, game.getNumberOfMoves()); auto pgnAgain = FPGN::getGame(game); ASSERT_EQ("1. e4 e5 2. Nc3 (2. Nf3 Nc6 3. Nc3 Nf6) *", pgnAgain); diff --git a/Shared/Engine/Engine/ChessGame.cpp b/Shared/Engine/Engine/ChessGame.cpp index 389e8a4..3f9daf2 100644 --- a/Shared/Engine/Engine/ChessGame.cpp +++ b/Shared/Engine/Engine/ChessGame.cpp @@ -79,8 +79,7 @@ void ChessGame::move(Move move, bool replace) { // the player is playing a series of move that correspond to that PGN. for (int index=0; index