]> git.sesse.net Git - stockfish/blobdiff - src/uci.cpp
Add user-defined conversions to UCIOption
[stockfish] / src / uci.cpp
index b875eaf7f1840bd3d3b41553dbeed55538dc1730..02a3c30c79f5ea338d611f0b399ef796b57b9b53 100644 (file)
@@ -124,7 +124,7 @@ void uci_loop() {
       else if (token == "uci")
           cout << "id name "     << engine_name()
                << "\nid author " << engine_authors()
-               << "\n"           << Options.print_all()
+               << "\n"           << Options
                << "\nuciok"      << endl;
       else
           cout << "Unknown command: " << cmd << endl;
@@ -157,7 +157,7 @@ namespace {
     else
         return;
 
-    pos.from_fen(fen, Options["UCI_Chess960"].value<bool>());
+    pos.from_fen(fen, Options["UCI_Chess960"]);
 
     // Parse move list (if any)
     while (is >> token && (m = move_from_uci(pos, token)) != MOVE_NONE)
@@ -188,10 +188,14 @@ namespace {
     while (is >> token)
         value += string(" ", !value.empty()) + token;
 
-    if (Options.find(name) != Options.end())
-        Options[name].set_value(value.empty() ? "true" : value); // UCI buttons don't have "value"
-    else
+    if (!Options.count(name))
         cout << "No such option: " << name << endl;
+
+    else if (value.empty()) // UCI buttons don't have a value
+        Options[name] = true;
+
+    else
+        Options[name] = value;
   }