forked from speed-dreams/speed-dreams-code
Re #139 (Task D30) Save human car choice also in <module>.xml as a default in case no human in race + Re #138 (Task D29) Fixed crash on ESC in Car Selection / Settings menu + cosmetic on some trace messages
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2666 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: bda1a31c5eff77f502bf8a523e60157878b2830e Former-commit-id: 681347b4b998d3cff39e2a829d386ba0e1f41627
This commit is contained in:
parent
49e586fc15
commit
90e1ece910
9 changed files with 85 additions and 56 deletions
|
@ -321,7 +321,8 @@ int moduleWelcomeV1_00
|
||||||
memset(DriverNames, 0, MAXNBBOTS*DRIVERLEN);
|
memset(DriverNames, 0, MAXNBBOTS*DRIVERLEN);
|
||||||
memset(DriverDescs, 0, MAXNBBOTS*DRIVERLEN);
|
memset(DriverDescs, 0, MAXNBBOTS*DRIVERLEN);
|
||||||
|
|
||||||
GfOut("\n#Interface Version: %d.%d\n",
|
GfOut("\n");
|
||||||
|
GfOut("#Interface Version: %d.%d\n",
|
||||||
welcomeIn->itfVerMajor,welcomeIn->itfVerMinor);
|
welcomeIn->itfVerMajor,welcomeIn->itfVerMinor);
|
||||||
|
|
||||||
// Get filehandle for robot's xml-file
|
// Get filehandle for robot's xml-file
|
||||||
|
@ -422,7 +423,8 @@ extern "C" int moduleWelcome
|
||||||
return moduleWelcomeV1_00(welcomeIn, welcomeOut);
|
return moduleWelcomeV1_00(welcomeIn, welcomeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
GfOut("\n#Unhandled Interface Version: %d.%d\n",
|
GfOut("\n");
|
||||||
|
GfOut("#Unhandled Interface Version: %d.%d\n",
|
||||||
welcomeIn->itfVerMajor,welcomeIn->itfVerMinor);
|
welcomeIn->itfVerMajor,welcomeIn->itfVerMinor);
|
||||||
welcomeOut->maxNbItf = 0;
|
welcomeOut->maxNbItf = 0;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -438,7 +440,8 @@ extern "C" int moduleWelcome
|
||||||
//--------------------------------------------------------------------------*
|
//--------------------------------------------------------------------------*
|
||||||
extern "C" int moduleInitialize(tModInfo *ModInfo)
|
extern "C" int moduleInitialize(tModInfo *ModInfo)
|
||||||
{
|
{
|
||||||
GfOut("\n#Initialize from %s ...\n",RobPathXML);
|
GfOut("\n");
|
||||||
|
GfOut("#Initialize from %s ...\n",RobPathXML);
|
||||||
GfOut("#NBBOTS: %d (of %d)\n",NBBOTS,MAXNBBOTS);
|
GfOut("#NBBOTS: %d (of %d)\n",NBBOTS,MAXNBBOTS);
|
||||||
|
|
||||||
#ifdef ROB_SECT_ARBITRARY
|
#ifdef ROB_SECT_ARBITRARY
|
||||||
|
@ -485,7 +488,8 @@ extern "C" int moduleInitialize(tModInfo *ModInfo)
|
||||||
//--------------------------------------------------------------------------*
|
//--------------------------------------------------------------------------*
|
||||||
extern "C" int moduleTerminate()
|
extern "C" int moduleTerminate()
|
||||||
{
|
{
|
||||||
GfOut("\n#Terminated %s\n",RobName);
|
GfOut("\n");
|
||||||
|
GfOut("#Terminated %s\n",RobName);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -496,7 +500,8 @@ extern "C" int moduleTerminate()
|
||||||
//--------------------------------------------------------------------------*
|
//--------------------------------------------------------------------------*
|
||||||
int simplixEntryPoint(tModInfo *ModInfo, void *RobotSettings)
|
int simplixEntryPoint(tModInfo *ModInfo, void *RobotSettings)
|
||||||
{
|
{
|
||||||
GfOut("\n#Torcs backward compatibility scheme used\n");
|
GfOut("\n");
|
||||||
|
GfOut("#Torcs backward compatibility scheme used\n");
|
||||||
NBBOTS = MIN(10,NBBOTS);
|
NBBOTS = MIN(10,NBBOTS);
|
||||||
|
|
||||||
memset(ModInfo, 0, NBBOTS*sizeof(tModInfo));
|
memset(ModInfo, 0, NBBOTS*sizeof(tModInfo));
|
||||||
|
@ -781,7 +786,9 @@ static void Shutdown(int Index)
|
||||||
tInstanceInfo *copy;
|
tInstanceInfo *copy;
|
||||||
#endif //ROB_SECT_ARBITRARY
|
#endif //ROB_SECT_ARBITRARY
|
||||||
|
|
||||||
GfOut("\n\n#Clock\n");
|
GfOut("\n");
|
||||||
|
GfOut("\n");
|
||||||
|
GfOut("#Clock\n");
|
||||||
GfOut("#Total Time used: %g sec\n",cInstances[Index-IndexOffset].cTicks/1000.0);
|
GfOut("#Total Time used: %g sec\n",cInstances[Index-IndexOffset].cTicks/1000.0);
|
||||||
GfOut("#Min Time used: %g msec\n",cInstances[Index-IndexOffset].cMinTicks);
|
GfOut("#Min Time used: %g msec\n",cInstances[Index-IndexOffset].cMinTicks);
|
||||||
GfOut("#Max Time used: %g msec\n",cInstances[Index-IndexOffset].cMaxTicks);
|
GfOut("#Max Time used: %g msec\n",cInstances[Index-IndexOffset].cMaxTicks);
|
||||||
|
@ -789,8 +796,8 @@ static void Shutdown(int Index)
|
||||||
GfOut("#Long Time Steps: %d\n",cInstances[Index-IndexOffset].cLongSteps);
|
GfOut("#Long Time Steps: %d\n",cInstances[Index-IndexOffset].cLongSteps);
|
||||||
GfOut("#Critical Steps : %d\n",cInstances[Index-IndexOffset].cCriticalSteps);
|
GfOut("#Critical Steps : %d\n",cInstances[Index-IndexOffset].cCriticalSteps);
|
||||||
GfOut("#Unused Steps : %d\n",cInstances[Index-IndexOffset].cUnusedCount);
|
GfOut("#Unused Steps : %d\n",cInstances[Index-IndexOffset].cUnusedCount);
|
||||||
|
GfOut("\n");
|
||||||
GfOut("\n\n#");
|
GfOut("\n");
|
||||||
|
|
||||||
cInstances[Index-IndexOffset].cRobot->Shutdown();
|
cInstances[Index-IndexOffset].cRobot->Shutdown();
|
||||||
delete cInstances[Index-IndexOffset].cRobot;
|
delete cInstances[Index-IndexOffset].cRobot;
|
||||||
|
|
|
@ -181,7 +181,8 @@ extern "C" int moduleWelcome(const tModWelcomeIn* welcomeIn, tModWelcomeOut* wel
|
||||||
// Module entry point (new fixed name scheme).
|
// Module entry point (new fixed name scheme).
|
||||||
extern "C" int moduleInitialize(tModInfo *modInfo)
|
extern "C" int moduleInitialize(tModInfo *modInfo)
|
||||||
{
|
{
|
||||||
GfOut("\n\n\nInitialize from %s ...\n",pathXml);
|
GfOut("\n\n");
|
||||||
|
GfOut("Initialize from %s ...\n",pathXml);
|
||||||
GfOut("NBBOTS: %d (of %d)\n",NBBOTS,MAXNBBOTS);
|
GfOut("NBBOTS: %d (of %d)\n",NBBOTS,MAXNBBOTS);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,8 @@ extern "C" int moduleWelcome(const tModWelcomeIn* welcomeIn, tModWelcomeOut* wel
|
||||||
// Module entry point (new fixed name scheme).
|
// Module entry point (new fixed name scheme).
|
||||||
extern "C" int moduleInitialize(tModInfo *modInfo)
|
extern "C" int moduleInitialize(tModInfo *modInfo)
|
||||||
{
|
{
|
||||||
GfOut("\n\n\nInitialize from %s ...\n",pathXml);
|
GfOut("\n\n");
|
||||||
|
GfOut("Initialize from %s ...\n",pathXml);
|
||||||
GfOut("NBBOTS: %d (of %d)\n",NBBOTS,MAXNBBOTS);
|
GfOut("NBBOTS: %d (of %d)\n",NBBOTS,MAXNBBOTS);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,8 @@ extern "C" int moduleWelcome(const tModWelcomeIn* welcomeIn, tModWelcomeOut* wel
|
||||||
// Module entry point (new fixed name scheme).
|
// Module entry point (new fixed name scheme).
|
||||||
extern "C" int moduleInitialize(tModInfo *modInfo)
|
extern "C" int moduleInitialize(tModInfo *modInfo)
|
||||||
{
|
{
|
||||||
GfOut("\n\n\nInitialize from %s ...\n",pathXml);
|
GfOut("\n\n");
|
||||||
|
GfOut("Initialize from %s ...\n",pathXml);
|
||||||
GfOut("NBBOTS: %d (of %d)\n",NBBOTS,MAXNBBOTS);
|
GfOut("NBBOTS: %d (of %d)\n",NBBOTS,MAXNBBOTS);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,8 @@ extern "C" int moduleWelcome(const tModWelcomeIn* welcomeIn, tModWelcomeOut* wel
|
||||||
// Module entry point (new fixed name scheme).
|
// Module entry point (new fixed name scheme).
|
||||||
extern "C" int moduleInitialize(tModInfo *modInfo)
|
extern "C" int moduleInitialize(tModInfo *modInfo)
|
||||||
{
|
{
|
||||||
GfOut("\n\n\nInitialize from %s ...\n",pathXml);
|
GfOut("\n\n");
|
||||||
|
GfOut("Initialize from %s ...\n",pathXml);
|
||||||
GfOut("NBBOTS: %d (of %d)\n",NBBOTS,MAXNBBOTS);
|
GfOut("NBBOTS: %d (of %d)\n",NBBOTS,MAXNBBOTS);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
|
@ -191,8 +191,8 @@ void RmCarSelectMenu::resetCarCategoryComboBox(const std::string& strSelectedCat
|
||||||
// Select the requested category in the combo-box.
|
// Select the requested category in the combo-box.
|
||||||
GfuiComboboxSetSelectedIndex(GetMenuHandle(), nCategoryComboId, nCurrentCategoryIndex);
|
GfuiComboboxSetSelectedIndex(GetMenuHandle(), nCategoryComboId, nCurrentCategoryIndex);
|
||||||
|
|
||||||
GfLogDebug("resetCarCategoryComboBox(%s) : cur=%d\n",
|
//GfLogDebug("resetCarCategoryComboBox(%s) : cur=%d\n",
|
||||||
strSelectedCategoryName.c_str(), nCurrentCategoryIndex);
|
// strSelectedCategoryName.c_str(), nCurrentCategoryIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RmCarSelectMenu::resetCarModelComboBox(const std::string& strCategoryName,
|
void RmCarSelectMenu::resetCarModelComboBox(const std::string& strCategoryName,
|
||||||
|
@ -222,18 +222,15 @@ void RmCarSelectMenu::resetCarModelComboBox(const std::string& strCategoryName,
|
||||||
// Select the right car in the combo-box.
|
// Select the right car in the combo-box.
|
||||||
GfuiComboboxSetSelectedIndex(GetMenuHandle(), nModelComboId, nCurrentCarIndexInCategory);
|
GfuiComboboxSetSelectedIndex(GetMenuHandle(), nModelComboId, nCurrentCarIndexInCategory);
|
||||||
|
|
||||||
GfLogDebug("resetCarModelComboBox(cat=%s, selCar=%s) : cur=%d (nCarsInCat=%d)\n",
|
//GfLogDebug("resetCarModelComboBox(cat=%s, selCar=%s) : cur=%d (nCarsInCat=%d)\n",
|
||||||
strCategoryName.c_str(), strSelectedCarRealName.c_str(),
|
// strCategoryName.c_str(), strSelectedCarRealName.c_str(),
|
||||||
nCurrentCarIndexInCategory, vecCarsInCat.size());
|
// nCurrentCarIndexInCategory, vecCarsInCat.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RmCarSelectMenu::resetCarDataSheet(const std::string& strSelectedCarName)
|
void RmCarSelectMenu::resetCarDataSheet(const std::string& strSelectedCarName)
|
||||||
{
|
{
|
||||||
// TODO : Merge params with category / user settings ?
|
// TODO : Merge params with category / user settings ?
|
||||||
|
|
||||||
// Close old car params.
|
|
||||||
GfParmReleaseHandle(getSelectedCarParamsHandle());
|
|
||||||
|
|
||||||
// Open new car params.
|
// Open new car params.
|
||||||
std::ostringstream ossCarXMLFileName;
|
std::ostringstream ossCarXMLFileName;
|
||||||
ossCarXMLFileName << "cars/" << strSelectedCarName << '/' << strSelectedCarName << ".xml";
|
ossCarXMLFileName << "cars/" << strSelectedCarName << '/' << strSelectedCarName << ".xml";
|
||||||
|
@ -347,7 +344,6 @@ void RmCarSelectMenu::RunMenu(trmdDrvElt* pDriver)
|
||||||
|
|
||||||
bool RmCarSelectMenu::Initialize()
|
bool RmCarSelectMenu::Initialize()
|
||||||
{
|
{
|
||||||
GfLogDebug("RmCarSelectMenu::Init\n");
|
|
||||||
//CarInfo::self()->print();
|
//CarInfo::self()->print();
|
||||||
|
|
||||||
// Create the menu and all its controls.
|
// Create the menu and all its controls.
|
||||||
|
@ -403,6 +399,15 @@ void RmCarSelectMenu::setDriver(trmdDrvElt* pDriver)
|
||||||
|
|
||||||
void RmCarSelectMenu::setSelectedCarParamsHandle(void* hdle)
|
void RmCarSelectMenu::setSelectedCarParamsHandle(void* hdle)
|
||||||
{
|
{
|
||||||
|
if (!hdle)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Close old car params if not null and not the current driver's one
|
||||||
|
// (and if it really changes).
|
||||||
|
if (_hCarParams && _hCarParams != _pDriver->carParmHdle && _hCarParams != hdle)
|
||||||
|
GfParmReleaseHandle(_hCarParams);
|
||||||
|
|
||||||
|
// Store the new one.
|
||||||
_hCarParams = hdle;
|
_hCarParams = hdle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ static const char* pszSkinFileExt = ".png";
|
||||||
static const char* pszPreviewFileSuffix = "-preview.jpg";
|
static const char* pszPreviewFileSuffix = "-preview.jpg";
|
||||||
|
|
||||||
static const char* apszExcludedSkinFileSuffixes[] =
|
static const char* apszExcludedSkinFileSuffixes[] =
|
||||||
{ "-rpm.png", "-speed.png", pszPreviewFileSuffix };
|
{ "-rpm.png", "-speed.png" , "-int.png" };
|
||||||
static const int nExcludedSkinFileSuffixes = sizeof(apszExcludedSkinFileSuffixes) / sizeof(char*);
|
static const int nExcludedSkinFileSuffixes = sizeof(apszExcludedSkinFileSuffixes) / sizeof(char*);
|
||||||
|
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ void rmdGetCarSkinsInFolder(const char* pszCarName, const char* pszFolderPath,
|
||||||
//struct stat st;
|
//struct stat st;
|
||||||
tFList *pSkinFileList, *pCurSkinFile;
|
tFList *pSkinFileList, *pCurSkinFile;
|
||||||
|
|
||||||
//GfOut("rmdGetCarSkinsInFolder(%s) :\n", pszFolderPath);
|
//GfLogDebug("rmdGetCarSkinsInFolder(%s) :\n", pszFolderPath);
|
||||||
|
|
||||||
pCurSkinFile = pSkinFileList =
|
pCurSkinFile = pSkinFileList =
|
||||||
GfDirGetListFiltered(pszFolderPath, pszCarName, pszSkinFileExt);
|
GfDirGetListFiltered(pszFolderPath, pszCarName, pszSkinFileExt);
|
||||||
|
@ -133,10 +133,10 @@ void rmdGetCarSkinsInFolder(const char* pszCarName, const char* pszFolderPath,
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (stat(ossPreviewName.str().c_str(), &st))
|
if (stat(ossPreviewName.str().c_str(), &st))
|
||||||
GfError("No preview file %s found for '%s' skin\n",
|
GfLogWarning("No preview file %s found for '%s' skin\n",
|
||||||
ossPreviewName.str().c_str(), strSkinName.c_str());
|
ossPreviewName.str().c_str(), strSkinName.c_str());
|
||||||
|
|
||||||
//GfOut("* found skin=%s, preview=%s\n",
|
//GfLogDebug("* found skin=%s, preview=%s\n",
|
||||||
// strSkinName.c_str(), ossPreviewName.str().c_str());
|
// strSkinName.c_str(), ossPreviewName.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ void rmdGetCarSkinsInSearchPath(const trmdDrvElt *pDriver, const char* pszForced
|
||||||
std::ostringstream ossDirPath;
|
std::ostringstream ossDirPath;
|
||||||
std::string strPreviewName;
|
std::string strPreviewName;
|
||||||
|
|
||||||
//GfOut("rmdGetCarSkinsInSearchPath : module=%s, idx=%d, car=%s ...\n",
|
//GfLogDebug("rmdGetCarSkinsInSearchPath : module=%s, idx=%d, car=%s ...\n",
|
||||||
// pDriver->moduleName, pDriver->interfaceIndex, pszCarName);
|
// pDriver->moduleName, pDriver->interfaceIndex, pszCarName);
|
||||||
|
|
||||||
// Clear the skin and preview lists.
|
// Clear the skin and preview lists.
|
||||||
|
@ -214,7 +214,7 @@ void rmdGetCarSkinsInSearchPath(const trmdDrvElt *pDriver, const char* pszForced
|
||||||
// (that way, the skin list will never be empty, and that's safer)
|
// (that way, the skin list will never be empty, and that's safer)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GfError("No skin found for '%s/%d/%s' : adding dummy '%s' one\n",
|
GfLogWarning("No skin found for '%s/%d/%s' : adding dummy '%s' one\n",
|
||||||
pDriver->moduleName, pDriver->interfaceIndex, pszCarName, rmdStdSkinName);
|
pDriver->moduleName, pDriver->interfaceIndex, pszCarName, rmdStdSkinName);
|
||||||
|
|
||||||
// Skin.
|
// Skin.
|
||||||
|
@ -228,7 +228,7 @@ void rmdGetCarSkinsInSearchPath(const trmdDrvElt *pDriver, const char* pszForced
|
||||||
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (stat(ossPreviewName.str().c_str(), &st))
|
if (stat(ossPreviewName.str().c_str(), &st))
|
||||||
GfError("No preview file %s found for '%s' skin\n",
|
GfLogWarning("No preview file %s found for '%s' skin\n",
|
||||||
ossPreviewName.str().c_str(), rmdStdSkinName);
|
ossPreviewName.str().c_str(), rmdStdSkinName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,18 +206,17 @@ rmdsSetFocus(void * /* dummy */)
|
||||||
static void
|
static void
|
||||||
rmdsNextMenu(void * /* dummy */)
|
rmdsNextMenu(void * /* dummy */)
|
||||||
{
|
{
|
||||||
char drvSec[256];
|
char drvSec[32];
|
||||||
char buffer[256];
|
char drvInfoSec[64];
|
||||||
const char *name;
|
const char *name;
|
||||||
trmdDrvElt *curDrv;
|
trmdDrvElt *curDrv;
|
||||||
int index;
|
|
||||||
|
|
||||||
// Clear the race starting grid.
|
// Clear the race starting grid.
|
||||||
GfParmListClean(MenuData->param, RM_SECT_DRIVERS);
|
GfParmListClean(MenuData->param, RM_SECT_DRIVERS);
|
||||||
|
|
||||||
// And then rebuild it from the current Competitors scroll list state
|
// And then rebuild it from the current Competitors scroll list state
|
||||||
// (for each competitor, module name, interface index, car name if human, skin name if any).
|
// (for each competitor, module name, interface index, car name if human, skin name if any).
|
||||||
index = 1;
|
int index = 1;
|
||||||
while ((name = GfuiScrollListExtractElement(ScrHandle, CompetitorsScrollListId,
|
while ((name = GfuiScrollListExtractElement(ScrHandle, CompetitorsScrollListId,
|
||||||
0, (void**)&curDrv))) {
|
0, (void**)&curDrv))) {
|
||||||
sprintf(drvSec, "%s/%d", RM_SECT_DRIVERS, index);
|
sprintf(drvSec, "%s/%d", RM_SECT_DRIVERS, index);
|
||||||
|
@ -225,14 +224,27 @@ rmdsNextMenu(void * /* dummy */)
|
||||||
GfParmSetStr(MenuData->param, drvSec, RM_ATTR_MODULE, curDrv->moduleName);
|
GfParmSetStr(MenuData->param, drvSec, RM_ATTR_MODULE, curDrv->moduleName);
|
||||||
if (curDrv->carName && curDrv->isHuman)
|
if (curDrv->carName && curDrv->isHuman)
|
||||||
{
|
{
|
||||||
// TODO: Save chosen car as the default/prefered one in human.xml ?
|
|
||||||
GfParmSetNum(MenuData->param, drvSec, RM_ATTR_EXTENDED, NULL, 1); /* Set extended */
|
GfParmSetNum(MenuData->param, drvSec, RM_ATTR_EXTENDED, NULL, 1); /* Set extended */
|
||||||
sprintf( buffer, "%s/%s/%d/%d", RM_SECT_DRIVERINFO, curDrv->moduleName, 1 /*extended*/, curDrv->interfaceIndex );
|
sprintf(drvInfoSec, "%s/%s/%d/%d", RM_SECT_DRIVERINFO, curDrv->moduleName,
|
||||||
GfParmSetStr(MenuData->param, buffer, RM_ATTR_CARNAME, curDrv->carName);
|
1 /*extended*/, curDrv->interfaceIndex );
|
||||||
|
GfParmSetStr(MenuData->param, drvInfoSec, RM_ATTR_CARNAME, curDrv->carName);
|
||||||
|
|
||||||
|
// Save also the chosen car as the default one for this human driver
|
||||||
|
// (may be needed later for races where it is not specified in <race>.xml)
|
||||||
|
char robParamsPath[256];
|
||||||
|
sprintf(robParamsPath, "%sdrivers/%s/%s.xml",
|
||||||
|
GetLocalDir(), curDrv->moduleName, curDrv->moduleName);
|
||||||
|
void* robHdle = GfParmReadFile(robParamsPath, GFPARM_RMODE_STD);
|
||||||
|
char robSec[32];
|
||||||
|
sprintf(robSec, "%s/%s/%d", ROB_SECT_ROBOTS, ROB_LIST_INDEX, curDrv->interfaceIndex);
|
||||||
|
GfParmSetStr(robHdle, robSec, ROB_ATTR_CAR, curDrv->carName);
|
||||||
|
GfParmWriteFile(NULL, robHdle, curDrv->moduleName);
|
||||||
|
GfParmReleaseHandle(robHdle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GfParmSetNum(MenuData->param, drvSec, RM_ATTR_EXTENDED, NULL, 0); /*No extended for robots yet in driverconfig*/
|
/* Not extended for robots yet in driverconfig */
|
||||||
|
GfParmSetNum(MenuData->param, drvSec, RM_ATTR_EXTENDED, NULL, 0);
|
||||||
}
|
}
|
||||||
if ((curDrv->skinName && strcmp(curDrv->skinName, rmdStdSkinName))
|
if ((curDrv->skinName && strcmp(curDrv->skinName, rmdStdSkinName))
|
||||||
|| GfParmGetStr(MenuData->param, drvSec, RM_ATTR_SKINNAME, 0))
|
|| GfParmGetStr(MenuData->param, drvSec, RM_ATTR_SKINNAME, 0))
|
||||||
|
@ -562,7 +574,8 @@ RmDriversSelect(void *vs)
|
||||||
robhdle = GfParmReadFile(buf, GFPARM_RMODE_STD);
|
robhdle = GfParmReadFile(buf, GFPARM_RMODE_STD);
|
||||||
}
|
}
|
||||||
if (!robhdle) {
|
if (!robhdle) {
|
||||||
GfError("No driver '%s' selected because no readable '%s.xml' found\n", modName, modName);
|
GfLogError("No driver '%s' selected because no readable '%s.xml' found\n",
|
||||||
|
modName, modName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (i = 0; i < curmod->modInfoSize; i++) {
|
for (i = 0; i < curmod->modInfoSize; i++) {
|
||||||
|
@ -577,7 +590,7 @@ RmDriversSelect(void *vs)
|
||||||
curDrv = (trmdDrvElt*)calloc(1, sizeof(trmdDrvElt));
|
curDrv = (trmdDrvElt*)calloc(1, sizeof(trmdDrvElt));
|
||||||
curDrv->interfaceIndex = curmod->modInfo[i].index;
|
curDrv->interfaceIndex = curmod->modInfo[i].index;
|
||||||
curDrv->moduleName = strdup(modName);
|
curDrv->moduleName = strdup(modName);
|
||||||
curDrv->carName = strdup(carName);
|
curDrv->carName = strdup(carName); // Default one if not specified in race file.
|
||||||
curDrv->skinName = 0; // Initialized later if needed from race params.
|
curDrv->skinName = 0; // Initialized later if needed from race params.
|
||||||
curDrv->name = strdup(curmod->modInfo[i].name);
|
curDrv->name = strdup(curmod->modInfo[i].name);
|
||||||
curDrv->carParmHdle = carhdle;
|
curDrv->carParmHdle = carhdle;
|
||||||
|
@ -670,12 +683,12 @@ RmDriversSelect(void *vs)
|
||||||
free(curDrv->carName);
|
free(curDrv->carName);
|
||||||
curDrv->carName = strdup(carName);
|
curDrv->carName = strdup(carName);
|
||||||
} else {
|
} else {
|
||||||
GfError("Falling back to default car '%s' "
|
GfLogError("Falling back to default car '%s' "
|
||||||
"for %s because '%s' is not readable\n",
|
"for %s because '%s' is not readable\n",
|
||||||
curDrv->carName, curDrv->name, path);
|
curDrv->carName, curDrv->name, path);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GfError("Falling back to default car '%s' "
|
GfLogError("Falling back to default car '%s' "
|
||||||
"for %s because '%s' was not found\n",
|
"for %s because '%s' was not found\n",
|
||||||
curDrv->carName, curDrv->name, path);
|
curDrv->carName, curDrv->name, path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ CarInfo::CarInfo()
|
||||||
ossCarFileName << "cars/" << pszCarName << '/' << pszCarName << ".xml";
|
ossCarFileName << "cars/" << pszCarName << '/' << pszCarName << ".xml";
|
||||||
carParmHdle = GfParmReadFile(ossCarFileName.str().c_str(), GFPARM_RMODE_STD);
|
carParmHdle = GfParmReadFile(ossCarFileName.str().c_str(), GFPARM_RMODE_STD);
|
||||||
if (!carParmHdle) {
|
if (!carParmHdle) {
|
||||||
GfError("CarInfo : Ignoring car %s (failed to read from %s)\n",
|
GfLogWarning("CarInfo : Ignoring car %s (failed to read from %s)\n",
|
||||||
pszCarName, ossCarFileName.str().c_str());
|
pszCarName, ossCarFileName.str().c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -182,19 +182,19 @@ CarData* CarInfo::GetCarData(const std::string& strCarName) const
|
||||||
|
|
||||||
void CarInfo::print() const
|
void CarInfo::print() const
|
||||||
{
|
{
|
||||||
GfOut("CarInfo : %d cars, %d categories\n",
|
GfLogDebug("CarInfo : %d cars, %d categories\n",
|
||||||
m_priv->vecCars.size(), m_priv->setCategoryNames.size());
|
m_priv->vecCars.size(), m_priv->setCategoryNames.size());
|
||||||
std::set<std::string>::const_iterator iterCat;
|
std::set<std::string>::const_iterator iterCat;
|
||||||
for (iterCat = m_priv->setCategoryNames.begin();
|
for (iterCat = m_priv->setCategoryNames.begin();
|
||||||
iterCat != m_priv->setCategoryNames.end(); iterCat++)
|
iterCat != m_priv->setCategoryNames.end(); iterCat++)
|
||||||
{
|
{
|
||||||
GfOut(" %s category :\n", iterCat->c_str());
|
GfLogDebug(" %s category :\n", iterCat->c_str());
|
||||||
const std::vector<CarData> vecCarsInCat = GetCarsInCategory(iterCat->c_str());
|
const std::vector<CarData> vecCarsInCat = GetCarsInCategory(iterCat->c_str());
|
||||||
std::vector<CarData>::const_iterator iterCar;
|
std::vector<CarData>::const_iterator iterCar;
|
||||||
for (iterCar = vecCarsInCat.begin(); iterCar != vecCarsInCat.end(); iterCar++)
|
for (iterCar = vecCarsInCat.begin(); iterCar != vecCarsInCat.end(); iterCar++)
|
||||||
{
|
{
|
||||||
GfOut(" %s (%s) : %s\n",
|
GfLogDebug(" %s (%s) : %s\n", iterCar->strRealName.c_str(),
|
||||||
iterCar->strRealName.c_str(), iterCar->strName.c_str(), iterCar->strXMLPath.c_str());
|
iterCar->strName.c_str(), iterCar->strXMLPath.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue