X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fucioption.cpp;fp=src%2Fucioption.cpp;h=8b75eea996f36717016d1b25f2d52d15e40aef26;hp=4aa0136e4e25fc08873446a6eb608b736a2172ee;hb=784e7d91455246361871f2f950dfb05e428c2c58;hpb=9eba3583586893cb01501378eb0906d11ebce8c9
diff --git a/src/ucioption.cpp b/src/ucioption.cpp
index 4aa0136e..8b75eea9 100644
--- a/src/ucioption.cpp
+++ b/src/ucioption.cpp
@@ -18,9 +18,9 @@
along with this program. If not, see .
*/
-#include
#include
#include
+#include
#include "misc.h"
#include "search.h"
@@ -145,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);
}
@@ -162,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) {
@@ -174,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;