forked from speed-dreams/speed-dreams-code
Re #313 (Windows installer split-scheme) Make human driver selectable even when default car is not, which may happen when install/uninstalling packages and not resetting user settings folder
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@3420 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: c9dd4e84fb5a47301a3fbbd68c6dab52633d2802 Former-commit-id: 43abe0b9dccd5b7205d32d67705c6acf66d2bf3d
This commit is contained in:
parent
6dbb3bf7dd
commit
7acf9ed5c2
1 changed files with 20 additions and 1 deletions
|
@ -128,7 +128,26 @@ GfDrivers::GfDrivers()
|
|||
GfDriver* pDriver = new GfDriver(strModName, pCurModule->modInfo[nItfInd].index,
|
||||
pCurModule->modInfo[nItfInd].name, hparmRobot);
|
||||
|
||||
// Keep the driver only if its car exists and is usable.
|
||||
// For human drivers, if the car was not found, select the 1st possible one.
|
||||
if (!pDriver->getCar() && pDriver->isHuman())
|
||||
{
|
||||
GfCar* pSubstCar = GfCars::self()->getCarsInCategory()[0]; // Should never fail.
|
||||
if (pSubstCar)
|
||||
{
|
||||
std::ostringstream ossDrvSecPath;
|
||||
ossDrvSecPath << ROB_SECT_ROBOTS << '/' << ROB_LIST_INDEX << '/'
|
||||
<< pCurModule->modInfo[nItfInd].index;
|
||||
const char* pszCarId =
|
||||
GfParmGetStr(hparmRobot, ossDrvSecPath.str().c_str(), ROB_ATTR_CAR, "");
|
||||
GfLogWarning("Changing '%s' driver '%s' (#%d) 's car to %s (default one %s not available)\n",
|
||||
strModName.c_str(), pCurModule->modInfo[nItfInd].name,
|
||||
pCurModule->modInfo[nItfInd].index, pSubstCar->getId().c_str(),
|
||||
pszCarId);
|
||||
pDriver->setCar(pSubstCar);
|
||||
}
|
||||
}
|
||||
|
||||
// Keep the driver only if he drives an existing car.
|
||||
if (pDriver->getCar())
|
||||
{
|
||||
// Update the GfDrivers singleton.
|
||||
|
|
Loading…
Reference in a new issue