aboutsummaryrefslogtreecommitdiff
path: root/src/game_tab/editor/LiveEngineDialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game_tab/editor/LiveEngineDialog.cpp')
-rw-r--r--src/game_tab/editor/LiveEngineDialog.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/game_tab/editor/LiveEngineDialog.cpp b/src/game_tab/editor/LiveEngineDialog.cpp
index 07fd782..0fc85b0 100644
--- a/src/game_tab/editor/LiveEngineDialog.cpp
+++ b/src/game_tab/editor/LiveEngineDialog.cpp
@@ -10,6 +10,7 @@ LiveEngineDialog::LiveEngineDialog(wxWindow *parent, std::string engine_name)
InitEngine();
Bind(wxEVT_BUTTON, &LiveEngineDialog::TogglePauseEngine, this,
LIVE_ENGINE_PAUSE_BUTTON);
+ Bind(wxEVT_CLOSE_WINDOW, &LiveEngineDialog::OnClose, this);
}
void LiveEngineDialog::InitEngine() {
@@ -29,7 +30,7 @@ void LiveEngineDialog::InitEngine() {
wxString optPath = opt_name + "/";
wxString default_value_wxString = conf->Read(optPath + "value");
std::string default_value = default_value_wxString.ToStdString();
- engine->setoption(opt_name.ToStdString(),default_value);
+ engine->setoption(opt_name.ToStdString(), default_value);
} while (conf->GetNextGroup(opt_name, index));
}
@@ -39,6 +40,17 @@ void LiveEngineDialog::InitEngine() {
timer.Bind(wxEVT_TIMER, &LiveEngineDialog::OnTimerTick, this);
}
+void LiveEngineDialog::OnClose(wxCloseEvent &e) {
+ if (engine != NULL) {
+ wxLogDebug("Close live engine!!");
+ timer.Stop();
+ engine->stop();
+ engine->quit();
+ delete engine;
+ }
+ e.Skip();
+}
+
void LiveEngineDialog::SetFEN(std::string fen) {
timer.Stop();
engine->position(fen);