ChessEngine: profile and binary should be private

This commit is contained in:
Michael Catanzaro 2013-05-11 19:49:23 -05:00
parent 8cfa88758e
commit f4b137e318
4 changed files with 15 additions and 9 deletions

View file

@ -4,8 +4,9 @@ public class ChessEngineCECP : ChessEngine
private bool moving = false;
private string[] options;
public ChessEngineCECP (string[] options)
public ChessEngineCECP (string binary, string args, string[] options)
{
base (binary, args);
this.options = options;
starting.connect (start_cb);
}

View file

@ -5,8 +5,9 @@ public class ChessEngineUCI : ChessEngine
private string[] options;
private bool waiting_for_move;
public ChessEngineUCI (string[] options)
public ChessEngineUCI (string binary, string args, string[] options)
{
base (binary, args);
this.options = options;
buffer = new char[0];
moves = "";

View file

@ -1,7 +1,7 @@
public abstract class ChessEngine : Object
{
public string binary;
public string args;
private string binary;
private string args;
private Pid pid;
private int stdin_fd;
@ -29,7 +29,13 @@ public abstract class ChessEngine : Object
return _ready;
}
}
public ChessEngine (string binary, string args)
{
this.binary = binary;
this.args = args;
}
public bool start ()
{
string[] argv = { binary, args, null };

View file

@ -527,16 +527,14 @@ public class Application : Gtk.Application
}
if (profile.protocol == "cecp")
engine = new ChessEngineCECP (options);
engine = new ChessEngineCECP (profile.binary, profile.args, options);
else if (profile.protocol == "uci")
engine = new ChessEngineUCI (options);
engine = new ChessEngineUCI (profile.binary, profile.args, options);
else
{
warning ("Unknown AI protocol %s", profile.protocol);
return null;
}
engine.binary = profile.binary;
engine.args = profile.args;
return engine;
}