mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 00:56:39 +08:00
Add user-defined conversions to UCIOption
Greatly improves the usage. User defined conversions are a novelity for SF, another amazing C++ facility at work ! No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
12
src/uci.cpp
12
src/uci.cpp
@@ -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.count(name))
|
||||
Options[name] = (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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user