Rewrite options handling in an object oriented fashion

Big rewrite and about 100 lines removed.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2010-11-04 08:03:27 +01:00
parent fb50e16cdd
commit bacb645939
9 changed files with 181 additions and 280 deletions

View File

@@ -122,7 +122,7 @@ namespace {
}
else if (token == "ucinewgame")
{
set_option_value("New Game", "true");
Options["New Game"].set_value("true");
pos.from_fen(StartPositionFEN);
}
else if (token == "isready")
@@ -233,16 +233,22 @@ namespace {
while (uip >> token && token != "value")
name += (" " + token);
if (Options.find(name) == Options.end())
{
cout << "No such option: " << name << endl;
return;
}
if (token != "value" || !(uip >> value))
{
set_option_value(name, "true");
Options[name].set_value("true");
return;
}
while (uip >> token)
value += (" " + token);
set_option_value(name, value);
Options[name].set_value(value);
}