mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
Standardize set_option function
Previously input like "setoption name Use Search Log value true " (note space at the end of the line) didn't work. Now parse value same way as option name. This way we implicitly left- and right-trim value. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
committed by
Marco Costalba
parent
32bd6e44f0
commit
2360c8aa2f
11
src/uci.cpp
11
src/uci.cpp
@@ -224,7 +224,7 @@ namespace {
|
|||||||
|
|
||||||
void set_option(UCIInputParser& uip) {
|
void set_option(UCIInputParser& uip) {
|
||||||
|
|
||||||
string token, name;
|
string token, name, value;
|
||||||
|
|
||||||
if (!(uip >> token)) // operator>>() skips any whitespace
|
if (!(uip >> token)) // operator>>() skips any whitespace
|
||||||
return;
|
return;
|
||||||
@@ -234,13 +234,12 @@ namespace {
|
|||||||
while (uip >> token && token != "value")
|
while (uip >> token && token != "value")
|
||||||
name += (" " + token);
|
name += (" " + token);
|
||||||
|
|
||||||
if (token == "value")
|
if (token == "value" && uip >> value)
|
||||||
{
|
{
|
||||||
// Reads until end of line and left trim white space
|
while (uip >> token)
|
||||||
getline(uip, token);
|
value += (" " + token);
|
||||||
token.erase(0, token.find_first_not_of(" \n\r\t"));
|
|
||||||
|
|
||||||
set_option_value(name, token);
|
set_option_value(name, value);
|
||||||
} else
|
} else
|
||||||
push_button(name);
|
push_button(name);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user