- remove double assign values

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9044 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 3742e8086a7eb0da1e52a20397243b3aacf80ff5
Former-commit-id: 725db28a44059943b8de3eedb100ca9eeb891d8a
This commit is contained in:
torcs-ng 2023-06-25 20:44:12 +00:00
parent debccce304
commit bfc364b8ab
2 changed files with 3 additions and 17 deletions

View file

@ -88,34 +88,27 @@ bool RobotXml::ReadRobotDrivers(const char*pRobotName,std::vector<NetDriver> &ve
{
sprintf(path2, "Robots/index/%i",i);
NetDriver driver;
strncpy(driver.name,GfParmGetStr(params, path2, "name",NULL),63);
memcpy(driver.name, GfParmGetStr(params, path2, "name", NULL), sizeof(driver.name));
//strncpy(driver.name,GfParmGetStr(params, path2, "name",NULL),63);
std::string strClient = GfParmGetStr(params, path2, "client",NULL);
if (strClient == "yes")
driver.client = true;
else
driver.client = false;
memcpy(driver.name, GfParmGetStr(params, path2, "name", NULL), sizeof(driver.name));
//memcpy(driver.name, GfParmGetStr(params, path2, "name", NULL), sizeof(driver.name));
memcpy(driver.sname, GfParmGetStr(params, path2, "short name", NULL), sizeof(driver.sname));
memcpy(driver.cname, GfParmGetStr(params, path2, "code name", NULL), sizeof(driver.cname));
memcpy(driver.car,GfParmGetStr(params, path2, "car name", NULL), sizeof(driver.car));
memcpy(driver.type,GfParmGetStr(params, path2, "type", NULL), sizeof(driver.type));
memcpy(driver.skilllevel,GfParmGetStr(params, path2, "skill level", NULL), sizeof(driver.skilllevel));
/*strncpy(driver.name, GfParmGetStr(params, path2, "name", NULL), 64);
strncpy(driver.sname, GfParmGetStr(params, path2, "short name", NULL), 64);
strncpy(driver.cname, GfParmGetStr(params, path2, "code name", NULL), 4);
strncpy(driver.car,GfParmGetStr(params, path2, "car name", NULL), 64);
strncpy(driver.type,GfParmGetStr(params, path2, "type", NULL), 64);
strncpy(driver.skilllevel,GfParmGetStr(params, path2, "skill level", NULL), 64);*/
driver.racenumber = (int)GfParmGetNum(params, path2, "race number", NULL, 1.0);
driver.red = GfParmGetNum(params, path2, "red", NULL, 1.0);
driver.green = GfParmGetNum(params, path2, "green", NULL, 1.0);
driver.blue = GfParmGetNum(params, path2, "blue", NULL, 1.0);
std::string strHost = GfParmGetStr(params, path2, "host","");
//memcpy(driver.module, NETWORKROBOT, sizeof(driver.module));
strncpy(driver.module, NETWORKROBOT, 64);
vecDrivers.push_back(driver);
}

View file

@ -1139,13 +1139,6 @@ GetHumanDriver(NetDriver &driver,int index)
memcpy(driver.type,GfParmGetStr(params, path2, "type", NULL), sizeof(driver.type));
memcpy(driver.skilllevel,GfParmGetStr(params, path2, "skill level", NULL), sizeof(driver.skilllevel));
/*strncpy(driver.name, GfParmGetStr(params, path2, "name", NULL), 64);
strncpy(driver.sname, GfParmGetStr(params, path2, "short name", NULL), 64);
strncpy(driver.cname, GfParmGetStr(params, path2, "code name", NULL), 4);
strncpy(driver.car,GfParmGetStr(params, path2, "car name", NULL), 64);
strncpy(driver.type,GfParmGetStr(params, path2, "type", NULL), 64);
strncpy(driver.skilllevel,GfParmGetStr(params, path2, "skill level", NULL), 64);*/
driver.racenumber = GfParmGetNum(params, path2, "race number",NULL,1.0);
driver.red = GfParmGetNum(params, path2, "red",NULL,1.0);
driver.green = GfParmGetNum(params, path2, "green",NULL,1.0);