X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fucioption.cpp;h=8b75eea996f36717016d1b25f2d52d15e40aef26;hp=1c6ef777257dda39e24753674f801ddbbe905d0d;hb=298cf150958212e3270182644fd87f5489823b27;hpb=cf5d683408a2ef8a1c80be9bf7d6790a38b16277
diff --git a/src/ucioption.cpp b/src/ucioption.cpp
index 1c6ef777..8b75eea9 100644
--- a/src/ucioption.cpp
+++ b/src/ucioption.cpp
@@ -18,20 +18,22 @@
along with this program. If not, see .
*/
-#include
#include
#include
+#include
#include "misc.h"
#include "search.h"
#include "thread.h"
#include "tt.h"
#include "uci.h"
+#include "hashprobe.h"
#include "syzygy/tbprobe.h"
using std::string;
UCI::OptionsMap Options; // Global object
+std::unique_ptr hash_probe_thread;
namespace UCI {
@@ -41,7 +43,13 @@ void on_hash_size(const Option& o) { TT.resize(o); }
void on_logger(const Option& o) { start_logger(o); }
void on_threads(const Option& o) { Threads.set(o); }
void on_tb_path(const Option& o) { Tablebases::init(o); }
-
+void on_rpc_server_address(const Option& o) {
+ if (hash_probe_thread) {
+ hash_probe_thread->Shutdown();
+ }
+ std::string addr = o;
+ hash_probe_thread.reset(new HashProbeThread(addr));
+}
/// Our case insensitive less() function as required by UCI protocol
bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const {
@@ -77,6 +85,7 @@ void init(OptionsMap& o) {
o["SyzygyProbeDepth"] << Option(1, 1, 100);
o["Syzygy50MoveRule"] << Option(true);
o["SyzygyProbeLimit"] << Option(7, 0, 7);
+ o["RPCServerAddress"] << Option("", on_rpc_server_address);
}
@@ -136,8 +145,8 @@ Option::operator std::string() const {
bool Option::operator==(const char* s) const {
assert(type == "combo");
- return !CaseInsensitiveLess()(currentValue, s)
- && !CaseInsensitiveLess()(s, currentValue);
+ return !CaseInsensitiveLess()(currentValue, s)
+ && !CaseInsensitiveLess()(s, currentValue);
}
@@ -153,8 +162,8 @@ void Option::operator<<(const Option& o) {
/// operator=() updates currentValue and triggers on_change() action. It's up to
-/// the GUI to check for option's limits, but we could receive the new value from
-/// the user by console window, so let's check the bounds anyway.
+/// the GUI to check for option's limits, but we could receive the new value
+/// from the user by console window, so let's check the bounds anyway.
Option& Option::operator=(const string& v) {
@@ -165,6 +174,17 @@ Option& Option::operator=(const string& v) {
|| (type == "spin" && (stof(v) < min || stof(v) > max)))
return *this;
+ if (type == "combo")
+ {
+ OptionsMap comboMap; // To have case insensitive compare
+ string token;
+ std::istringstream ss(defaultValue);
+ while (ss >> token)
+ comboMap[token] << Option();
+ if (!comboMap.count(v) || v == "var")
+ return *this;
+ }
+
if (type != "button")
currentValue = v;