aboutsummaryrefslogtreecommitdiff
path: root/src/game_tab/right_panel
diff options
context:
space:
mode:
Diffstat (limited to 'src/game_tab/right_panel')
-rw-r--r--src/game_tab/right_panel/GameTabRightPanel.cpp10
-rw-r--r--src/game_tab/right_panel/LiveEngineDialog.cpp15
-rw-r--r--src/game_tab/right_panel/LiveEngineDialog.hpp4
3 files changed, 19 insertions, 10 deletions
diff --git a/src/game_tab/right_panel/GameTabRightPanel.cpp b/src/game_tab/right_panel/GameTabRightPanel.cpp
index 5d933b8..ff9576d 100644
--- a/src/game_tab/right_panel/GameTabRightPanel.cpp
+++ b/src/game_tab/right_panel/GameTabRightPanel.cpp
@@ -56,7 +56,7 @@ void GameTabRightPanel::OnLiveAnalysis(wxCommandEvent &event) {
ProcessEvent(notifyEvent);
live_engine = new LiveEngineDialog(
- this, engine_list->GetString(selection).ToStdString());
+ this, selection);
live_engine->SetFEN(game->GetFen());
live_engine->Show();
live_engine->Bind(wxEVT_CLOSE_WINDOW,
@@ -168,12 +168,12 @@ void GameTabRightPanel::ApplyPreferences() {
engine_list->Clear();
CONFIG_OPEN(conf);
conf->SetPath("engines/");
- wxString engine_name;
+ wxString engine_id;
long index;
- if (conf->GetFirstGroup(engine_name, index)) {
+ if (conf->GetFirstGroup(engine_id, index)) {
do {
- engine_list->Append(engine_name);
- } while (conf->GetNextGroup(engine_name, index));
+ engine_list->Append(conf->Read(engine_id+"/name"));
+ } while (conf->GetNextGroup(engine_id, index));
}
CONFIG_CLOSE(conf);
editor_canvas->ApplyPreferences();
diff --git a/src/game_tab/right_panel/LiveEngineDialog.cpp b/src/game_tab/right_panel/LiveEngineDialog.cpp
index 64d75e3..d0b1896 100644
--- a/src/game_tab/right_panel/LiveEngineDialog.cpp
+++ b/src/game_tab/right_panel/LiveEngineDialog.cpp
@@ -1,12 +1,19 @@
#include "LiveEngineDialog.hpp"
-LiveEngineDialog::LiveEngineDialog(wxWindow *parent, std::string engine_name)
- : DialogLiveEngine(parent), engine_name(engine_name), interval(1000),
+LiveEngineDialog::LiveEngineDialog(wxWindow *parent, std::uint32_t engine_id)
+ : DialogLiveEngine(parent), interval(1000),
engine(nullptr) {
lines_list->InsertColumn(0, "#", wxLIST_FORMAT_LEFT, 50);
lines_list->InsertColumn(1, "CP", wxLIST_FORMAT_LEFT, 70);
lines_list->InsertColumn(2, "Line", wxLIST_FORMAT_LEFT, 300);
+
+ // Load engine name
+ confGroup="engines/"+std::to_string(engine_id);
+ CONFIG_OPEN(conf);
+ engine_name=conf->Read(confGroup+"/name");
+ CONFIG_CLOSE(conf);
current_engine->SetLabel(engine_name);
+
InitEngine();
Bind(wxEVT_BUTTON, &LiveEngineDialog::TogglePauseEngine, this,
LIVE_ENGINE_PAUSE_BUTTON);
@@ -25,11 +32,11 @@ void LiveEngineDialog::InitEngine() {
wxLogDebug("Start engine: %s", engine_name);
CONFIG_OPEN(conf);
engine = new uciadapter::UCI(
- conf->Read("engines/" + engine_name + "/path").ToStdString());
+ conf->Read(confGroup + "/path").ToStdString());
engine->ucinewgame();
long index;
- std::string optsPath = "engines/" + engine_name + "/options";
+ std::string optsPath = confGroup + "/options";
conf->SetPath(optsPath);
wxString opt_name;
if (conf->GetFirstGroup(opt_name, index)) {
diff --git a/src/game_tab/right_panel/LiveEngineDialog.hpp b/src/game_tab/right_panel/LiveEngineDialog.hpp
index b7be674..2ba39c1 100644
--- a/src/game_tab/right_panel/LiveEngineDialog.hpp
+++ b/src/game_tab/right_panel/LiveEngineDialog.hpp
@@ -15,12 +15,14 @@ typedef struct EngineEvaluation {
class LiveEngineDialog : public DialogLiveEngine {
uciadapter::UCI *engine;
std::string engine_name;
+ std::string confGroup;
+
wxTimer timer;
/// @brief The following time interval definitely need to be configure in the user settings (set to 1s for now)
std::uint32_t interval;
public:
- LiveEngineDialog(wxWindow *parent, std::string engine_name);
+ LiveEngineDialog(wxWindow *parent, std::uint32_t engine_id);
~LiveEngineDialog();
void InitEngine();
void TogglePauseEngine(wxCommandEvent &event);