aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-01-01 14:46:04 +0100
committerLoic Guegan <manzerbredes@mailbox.org>2023-01-01 14:46:04 +0100
commit0c64a5f9567b23fde5480975bf393d46f3203786 (patch)
tree2c665cceb041bcff5694d6d11bcb5629c9e16e01 /src
parent0cb695a22bf7371511893963a4896167d8c16ae1 (diff)
Update animation trigger
Diffstat (limited to 'src')
-rw-r--r--src/game_tab/left_panel/GameTabLeftPanel.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/game_tab/left_panel/GameTabLeftPanel.cpp b/src/game_tab/left_panel/GameTabLeftPanel.cpp
index 2553d30..8b44e28 100644
--- a/src/game_tab/left_panel/GameTabLeftPanel.cpp
+++ b/src/game_tab/left_panel/GameTabLeftPanel.cpp
@@ -84,20 +84,22 @@ void GameTabLeftPanel::Notify(bool animate, bool backward) {
backward=false;
if (m != nullptr) {
captures = m->GetLineCaptures();
- std::string absolute_move= m->GetAbsoluteMove();
// Check if we should animate
if(m->GetParent()==last_move){
- wxLogDebug("Animate animate next");
- animate=true;
- src=absolute_move.substr(0,2);
- dst=absolute_move.substr(2,2);
+ wxLogDebug("Animate animate next");
+ std::string absolute_move= m->GetAbsoluteMove();
+ animate=true;
+ src=absolute_move.substr(0,2);
+ dst=absolute_move.substr(2,2);
} else if (m->GetMainline()==last_move){
wxLogDebug("Animate Previous");
+ std::string absolute_move= last_move->GetAbsoluteMove();
animate=true;
backward=true;
src=absolute_move.substr(2,2);
dst=absolute_move.substr(0,2);
} else {
+ std::string absolute_move= last_move->GetAbsoluteMove();
wxLogDebug("Animate Previous");
for(auto v: m->GetVariations()){
if(v==last_move){
@@ -108,6 +110,15 @@ void GameTabLeftPanel::Notify(bool animate, bool backward) {
}
}
}
+ }else if(last_move!=nullptr) {
+ if(last_move->GetParent()==nullptr){
+ wxLogDebug("Animate Previous");
+ std::string absolute_move= last_move->GetAbsoluteMove();
+ animate=true;
+ backward=true;
+ src=absolute_move.substr(2,2);
+ dst=absolute_move.substr(0,2);
+ }
}
// Update board canvas:
@@ -115,7 +126,7 @@ void GameTabLeftPanel::Notify(bool animate, bool backward) {
board_canvas->SetupBoard(chessarbiter::FENParser::Parse(fen).board,
game->IsBlackToPlay(), captures,
game->GetTag("White"),game->GetTag("Black"));
- }
+}
else{
board_canvas->Animate(chessarbiter::FENParser::Parse(fen).board,
game->IsBlackToPlay(), captures,src,dst,repeat);