From 4f2c68de6013bab307b299cfd6158225475a3fc6 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Mon, 2 Jan 2023 08:15:51 +0100 Subject: [PATCH] Update CGEditor+debug --- libs/cgeditor | 2 +- src/game_tab/left_panel/GameTabLeftPanel.cpp | 2 +- src/game_tab/right_panel/editor/EditorCanvas.cpp | 8 +------- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/libs/cgeditor b/libs/cgeditor index 31c332d..5e18d43 160000 --- a/libs/cgeditor +++ b/libs/cgeditor @@ -1 +1 @@ -Subproject commit 31c332da9ab426daa73b68772d0ef9c1b0744a50 +Subproject commit 5e18d43a6ba4fd378178418de6b2ca7a67d64c21 diff --git a/src/game_tab/left_panel/GameTabLeftPanel.cpp b/src/game_tab/left_panel/GameTabLeftPanel.cpp index fd89791..fa97f6f 100644 --- a/src/game_tab/left_panel/GameTabLeftPanel.cpp +++ b/src/game_tab/left_panel/GameTabLeftPanel.cpp @@ -63,12 +63,12 @@ GameTabLeftPanel::GameTabLeftPanel(wxFrame *parent, std::shared_ptr game) void GameTabLeftPanel::OnPlay(wxCommandEvent &event) { wxLogDebug("Game tab received PLAY_MOVE_EVENT"); if (game->Play(event.GetString().ToStdString())) { - Notify(true); // Notify other classes wxCommandEvent event(GAME_CHANGE, GetId()); event.SetEventObject(this); ProcessEvent(event); } + Notify(true); // Redraw event is move failed! Otherwise piece not resets to it initial position after dragging } void GameTabLeftPanel::Notify(bool skip_animation) { diff --git a/src/game_tab/right_panel/editor/EditorCanvas.cpp b/src/game_tab/right_panel/editor/EditorCanvas.cpp index 5a0afd0..19d81ec 100644 --- a/src/game_tab/right_panel/editor/EditorCanvas.cpp +++ b/src/game_tab/right_panel/editor/EditorCanvas.cpp @@ -216,13 +216,7 @@ void EditorCanvas::MouseEvent(wxMouseEvent &event) { // Handle editor events Update(); - bool need_redraw=false; - for(auto event: status.Events){ - HandleEvent(event); - need_redraw=true; - } - if(need_redraw){ - status.Events.clear(); + if(ProcessEvents()){ Refresh(); Update(); }