diff options
Diffstat (limited to 'src/game_tab/Game.cpp')
| -rw-r--r-- | src/game_tab/Game.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/game_tab/Game.cpp b/src/game_tab/Game.cpp index c7ecced..2ddd968 100644 --- a/src/game_tab/Game.cpp +++ b/src/game_tab/Game.cpp @@ -120,13 +120,28 @@ bool Game::Play(std::string move,char promotion) { m->SetCapture(capture); } if (current != nullptr) { - current->AddMove(m); + if(current->GetMainline()!=nullptr){ + HalfMove* curmainline=static_cast<HalfMove*>(current->GetMainline()); + HalfMove* movefound=curmainline->GetCurrentMoveWithFEN(arbiter.GetFEN()); + if(movefound!=nullptr){ + current=movefound; + } + else { + current->AddMove(m); + current = m; + } + } + else{ + current->AddMove(m); + current = m; + } } else if (moves != nullptr) { moves->AddVariation(m); + current = m; } - current = m; if (moves == nullptr) { moves = m; + current = m; } return (true); } |
