fix for Trac ticket #63: Blank / empty (human) player names in the Driver Select menu try#2
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2078 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: e59af930a05a0cb9fd5e7c9392b8eed7b063a8ea Former-commit-id: 495b94b536bb8b451e7aa003aad73faaa2f23fd3
This commit is contained in:
parent
8a86de5c3d
commit
9b9bff67fb
1 changed files with 6 additions and 9 deletions
|
@ -86,7 +86,8 @@ static double lastKeyUpdate = -10.0;
|
|||
static bool firstTime = false;
|
||||
|
||||
// Human drivers names.
|
||||
static std::vector<std::string> vecNames;
|
||||
#define MAXPLAYERS 64
|
||||
static char Names[MAXPLAYERS][256];
|
||||
|
||||
// Number of human drivers (initialized by moduleMaxInterfaces).
|
||||
static int nbDrivers = -1;
|
||||
|
@ -105,8 +106,6 @@ shutdown(const int index)
|
|||
{
|
||||
int idx = index - 1;
|
||||
|
||||
vecNames.erase(vecNames.begin() + idx);
|
||||
|
||||
free (HCtx[idx]);
|
||||
HCtx[idx] = 0;
|
||||
|
||||
|
@ -236,9 +235,6 @@ moduleInitialize(tModInfo *modInfo)
|
|||
// Reset module interfaces info.
|
||||
memset(modInfo, 0, nbDrivers*sizeof(tModInfo));
|
||||
|
||||
// Clear the local driver name vector
|
||||
vecNames.clear();
|
||||
|
||||
// Open and load the human drivers params file
|
||||
sprintf(buf, "%sdrivers/human/human.xml", GetLocalDir());
|
||||
void *drvInfo = GfParmReadFile(buf, GFPARM_RMODE_REREAD | GFPARM_RMODE_CREAT);
|
||||
|
@ -249,8 +245,9 @@ moduleInitialize(tModInfo *modInfo)
|
|||
sprintf(sstring, "Robots/index/%d", i+1);
|
||||
const std::string strDriverName = GfParmGetStr(drvInfo, sstring, "name", "");
|
||||
if (strDriverName.size() > 0) {
|
||||
vecNames.push_back(strDriverName); // Don't rely on GfParm allocated data
|
||||
modInfo->name = vecNames[i].c_str(); /* name of the module (short) */
|
||||
memset((void*)&Names[i][0],0,256);
|
||||
strncpy(&Names[i][0],strDriverName.c_str(),256);
|
||||
modInfo->name = &Names[i][0]; /* name of the module (short) */
|
||||
modInfo->desc = "Joystick controlable driver"; /* description of the module (can be long) */
|
||||
modInfo->fctInit = InitFuncPt; /* init function */
|
||||
modInfo->gfId = ROB_IDENT; /* supported framework version */
|
||||
|
@ -276,7 +273,7 @@ moduleInitialize(tModInfo *modInfo)
|
|||
extern "C" int
|
||||
moduleTerminate()
|
||||
{
|
||||
vecNames.clear(); //Free local copy of driver names
|
||||
|
||||
return 0;
|
||||
}//moduleTerminate
|
||||
|
||||
|
|
Loading…
Reference in a new issue