Improve LiveEngineDialog

This commit is contained in:
Loic Guegan 2023-01-31 10:52:55 +01:00
parent 1618113e61
commit 35caa1aa4c
5 changed files with 410 additions and 387 deletions

View file

@ -46,7 +46,8 @@ void LiveEngineDialog::InitEngine() {
std::string default_value = default_value_wxString.ToStdString();
engine->setoption(opt_name.ToStdString(), default_value);
if (opt_name.Lower() == "multipv") {
multipv->SetLabel(default_value_wxString);
optmultipv=opt_name;
multipv->SetValue(std::stoi(default_value_wxString.ToStdString()));
} else if (opt_name.Lower() == "threads") {
threads->SetLabel(default_value_wxString);
}
@ -55,6 +56,8 @@ void LiveEngineDialog::InitEngine() {
CONFIG_CLOSE(conf);
}
depth->Enable(false);
multipv->Enable(false);
timer.Start(interval);
timer.Bind(wxEVT_TIMER, &LiveEngineDialog::OnTimerTick, this);
}
@ -84,9 +87,11 @@ void LiveEngineDialog::TogglePauseEngine(wxCommandEvent &event) {
StopEngine();
engine_stop_button->SetLabel("Restart");
depth->Enable(true);
multipv->Enable(true);
} else {
engine_stop_button->SetLabel("Stop");
depth->Enable(false);
multipv->Enable(false);
StartEngine();
}
}
@ -101,6 +106,8 @@ void LiveEngineDialog::StopEngine() {
void LiveEngineDialog::StartEngine() {
uciadapter::Go args;
args.depth = depth->GetValue();
if(optmultipv.size()>0)
engine->setoption(optmultipv, std::to_string(multipv->GetValue()));
engine->go(args);
if (!timer.IsRunning()) {
timer.Start(interval);

View file

@ -16,6 +16,7 @@ class LiveEngineDialog : public DialogLiveEngine {
uciadapter::UCI *engine;
std::string engine_name;
std::string confGroup;
std::string optmultipv;
wxTimer timer;
/// @brief The following time interval definitely need to be configure in the user settings (set to 1s for now)