mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00: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:
parent
32bd6e44f0
commit
2360c8aa2f
1 changed files with 5 additions and 6 deletions
11
src/uci.cpp
11
src/uci.cpp
|
@ -224,7 +224,7 @@ namespace {
|
|||
|
||||
void set_option(UCIInputParser& uip) {
|
||||
|
||||
string token, name;
|
||||
string token, name, value;
|
||||
|
||||
if (!(uip >> token)) // operator>>() skips any whitespace
|
||||
return;
|
||||
|
@ -234,13 +234,12 @@ namespace {
|
|||
while (uip >> token && token != "value")
|
||||
name += (" " + token);
|
||||
|
||||
if (token == "value")
|
||||
if (token == "value" && uip >> value)
|
||||
{
|
||||
// Reads until end of line and left trim white space
|
||||
getline(uip, token);
|
||||
token.erase(0, token.find_first_not_of(" \n\r\t"));
|
||||
while (uip >> token)
|
||||
value += (" " + token);
|
||||
|
||||
set_option_value(name, token);
|
||||
set_option_value(name, value);
|
||||
} else
|
||||
push_button(name);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue