aboutsummaryrefslogtreecommitdiff
path: root/src/game_tab/left_panel/GameTabLeftPanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game_tab/left_panel/GameTabLeftPanel.cpp')
-rw-r--r--src/game_tab/left_panel/GameTabLeftPanel.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/game_tab/left_panel/GameTabLeftPanel.cpp b/src/game_tab/left_panel/GameTabLeftPanel.cpp
index 5a7877d..d034115 100644
--- a/src/game_tab/left_panel/GameTabLeftPanel.cpp
+++ b/src/game_tab/left_panel/GameTabLeftPanel.cpp
@@ -72,14 +72,15 @@ void GameTabLeftPanel::OnPlay(wxCommandEvent &event) {
}
void GameTabLeftPanel::SetEngineArrows(std::vector<std::string> arrows){
- engine_arrows=arrows;
- int min_size=5, max_size=80;
- int steps=(max_size-min_size)/arrows.size();
- int current_size=max_size;
- for(std::string &arrow:engine_arrows){
- wxLogDebug("%s",arrow);
- arrow+="#000000%"+std::to_string(current_size);
- current_size-=steps;
+ engine_arrows.clear();
+ float scale=1;
+ unsigned char color=0;
+ for(auto const &arrow:arrows){
+ std::string src=arrow.substr(0,2);
+ std::string dst=arrow.substr(2,2);
+ engine_arrows.push_back({src,dst,wxColour(color,color,color),scale});
+ scale=std::max(0.1,scale-0.25);
+ color=std::min(255,color+70);
}
Notify(true);
}
@@ -94,16 +95,14 @@ void GameTabLeftPanel::Notify(bool skip_animation) {
// Update capture and check if we should to animations during moves change:
if (m){
captures = m->GetLineCaptures();
- if(!m->IsVariation()){ // Animations can lead to segfault when clicking on CGEditor move
- if(m->HasParent(last_move)){
- m->GetAbsoluteMove(src,dst);
- animate=true;
- }else if(m->HasChild(last_move)){
- // Accessing last_move here is safe since it is still
- // in the tree of moves (since HasChild found it so not deleted)
- last_move->GetAbsoluteMove(dst,src);
- animate=true;
- }
+ if(m->HasParent(last_move) && !m->IsVariation()){
+ m->GetAbsoluteMove(src,dst);
+ animate=true;
+ }else if(m->HasChild(last_move) && !last_move->IsVariation()){ // call to IsVariation is safe because of HasChild() before! cf below
+ // Accessing last_move here is safe since it is still
+ // in the tree of moves (since HasChild found it so not deleted)
+ last_move->GetAbsoluteMove(dst,src);
+ animate=true;
}
} else if(game->GetNextMove()){ // First move animation
HalfMove *next=game->GetNextMove();
@@ -128,8 +127,8 @@ void GameTabLeftPanel::Notify(bool skip_animation) {
std::string src_hl, dst_hl;
m->GetAbsoluteMove(src_hl,dst_hl);
if(src_hl.size()>0){ // Just in case
- gs.squares_hl.push_back(src_hl+"d");
- gs.squares_hl.push_back(dst_hl+"a");
+ gs.squares_hl.push_back({src_hl,wxColour(255,190,190)});
+ gs.squares_hl.push_back({dst_hl,wxColour(255,100,100)});
}
}
if(skip_animation || !animate){