34
34
tGfParm CarParm { get; }
36
36
/// <summary>Prepare for new track</summary>
37
void NewTrack(tTrack track, tSituation situ);
37
void NewTrack(UTI track, tSituation situ);
38
38
/// <summary>Prepare for new race</summary>
39
39
void NewRace(tSituation situ);
40
40
/// <summary>Update own car's controllers</summary>
53
53
/// <value>Either "robot" or "human"</value>
54
54
string Type { get; }
57
/// <summary>Implementation of a driving robot which uses a Torcs C robot plugin</summary>
58
public class LegacyRobot : IRobot
60
private tRobotItf mcRobotItf;
61
private tModInfo mcModInfo;
63
private tGfParm mCarParm;
64
private tGfParm mRobParm;
65
private tCarElt mCar = null;
67
public tRobotItf RobotItf;
69
#region IRobot implementation
70
public tGfParm RobParm { get { return mRobParm; } }
71
public tGfParm CarParm { get { return mCarParm; } }
72
public int Index { get { return mcRobotItf.Index; } }
73
public void SetCar(tCarElt car) {
76
public string Name { get { return RobParm.GetStr("Robots/index/" + Index, "name", "<none>"); } }
77
public string Team { get { return RobParm.GetStr("Robots/index/" + Index, "team", "<none>"); } }
78
public string CarName { get { return RobParm.GetStr("Robots/index/" + Index, "car name", "<none>"); } }
79
public int RaceNumber { get { return (int)RobParm.GetNum("Robots/index/" + Index, "race number", null, 0); } }
80
public string Type { get { return RobParm.GetStr("Robots/index/" + Index, "type", "robot"); } }
83
public LegacyRobot(tModInfo cModInfo, tRobotItf cRobotItf, string name) {
84
TorcsItf.DriverInit(cModInfo, cRobotItf);
86
mcRobotItf = cRobotItf;
87
mRobParm = new tGfParm("drivers/" + name + "/" + name + ".xml", tGfParm.RMode.STD);
90
public void Shutdown() {
91
// DriverShutdown(mcRobotItf); TODO: not to be called before initrace and inittrack
94
public void NewTrack(tTrack track, tSituation situ) {
95
// XXX carHandle is not used by Olethros, I don't know what it should contain for now... (and maybe it's just useless).
96
mCarParm = new tGfParm(TorcsItf.DriverNewTrack(mcRobotItf, track, situ));
99
public void NewRace(tSituation situ) {
100
TorcsItf.DriverNewRace(mcRobotItf, mCar, situ);
103
public void Drive(tSituation situ) {
104
// Sometimes enters into infinite loop... we should not allow that!
105
TorcsItf.DriverDrive(mcRobotItf, mCar, situ);