- fix bug with path
- added two values for better setting car (mu scale & brake scale) git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@7494 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: ff771a1a97ab4d700e65f91717bc5aa21b6e8170 Former-commit-id: 3cc9511332d3603860c2212807c5db3f8502ffd6
This commit is contained in:
parent
78a87ff458
commit
7fe44b7439
2 changed files with 20 additions and 7 deletions
|
@ -108,7 +108,7 @@ void TDriver::InitTrack(PTrack Track, PCarHandle CarHandle, PCarSettings *CarPar
|
||||||
|
|
||||||
// Get file handles
|
// Get file handles
|
||||||
char* trackname = strrchr(Track->filename, '/') + 1;
|
char* trackname = strrchr(Track->filename, '/') + 1;
|
||||||
char buffer[256];
|
char buffer[1024];
|
||||||
|
|
||||||
// Discover the car type used
|
// Discover the car type used
|
||||||
void* handle = NULL;
|
void* handle = NULL;
|
||||||
|
@ -119,7 +119,7 @@ void TDriver::InitTrack(PTrack Track, PCarHandle CarHandle, PCarSettings *CarPar
|
||||||
|
|
||||||
// Parameters that are the same for all tracks
|
// Parameters that are the same for all tracks
|
||||||
handle = NULL;
|
handle = NULL;
|
||||||
sprintf(buffer, "drivers/%s/%s/_all_tracks.xml", MyBotName, mCarType.c_str());
|
sprintf(buffer, "%sdrivers/%s/%s/_all_tracks.xml", GetDataDir(), MyBotName, mCarType.c_str());
|
||||||
handle = GfParmReadFile(buffer, GFPARM_RMODE_STD);
|
handle = GfParmReadFile(buffer, GFPARM_RMODE_STD);
|
||||||
|
|
||||||
if (handle == NULL)
|
if (handle == NULL)
|
||||||
|
@ -131,6 +131,7 @@ void TDriver::InitTrack(PTrack Track, PCarHandle CarHandle, PCarSettings *CarPar
|
||||||
mDriverMsgCarIndex = 0;
|
mDriverMsgCarIndex = 0;
|
||||||
mFRONTCOLL_MARGIN = 4.0;
|
mFRONTCOLL_MARGIN = 4.0;
|
||||||
mSTARTCLUTCHRATE = 0.01;
|
mSTARTCLUTCHRATE = 0.01;
|
||||||
|
LogDANDROID.info("# Dandroid handle NULL\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -143,6 +144,7 @@ void TDriver::InitTrack(PTrack Track, PCarHandle CarHandle, PCarSettings *CarPar
|
||||||
mDriverMsgCarIndex = (int)GfParmGetNum(handle, "private", "driver message car index", (char*)NULL, 0.0);
|
mDriverMsgCarIndex = (int)GfParmGetNum(handle, "private", "driver message car index", (char*)NULL, 0.0);
|
||||||
mFRONTCOLL_MARGIN = GfParmGetNum(handle, "private", "frontcollmargin", (char*)NULL, 4.0);
|
mFRONTCOLL_MARGIN = GfParmGetNum(handle, "private", "frontcollmargin", (char*)NULL, 4.0);
|
||||||
mSTARTCLUTCHRATE = GfParmGetNum(handle, "private", "startclutchrate", (char*)NULL, 0.01);
|
mSTARTCLUTCHRATE = GfParmGetNum(handle, "private", "startclutchrate", (char*)NULL, 0.01);
|
||||||
|
LogDANDROID.info("# Dandroid handle loaded\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
LogDANDROID.info("# mLearning = %i\n", mLearning);
|
LogDANDROID.info("# mLearning = %i\n", mLearning);
|
||||||
|
@ -159,8 +161,9 @@ void TDriver::InitTrack(PTrack Track, PCarHandle CarHandle, PCarSettings *CarPar
|
||||||
switch (Situation->_raceType)
|
switch (Situation->_raceType)
|
||||||
{
|
{
|
||||||
case RM_TYPE_QUALIF:
|
case RM_TYPE_QUALIF:
|
||||||
sprintf(buffer, "drivers/%s/%s/qualifying/%s", MyBotName, mCarType.c_str(), trackname);
|
sprintf(buffer, "%sdrivers/%s/%s/qualifying/%s", GetDataDir(), MyBotName, mCarType.c_str(), trackname);
|
||||||
*CarParmHandle = GfParmReadFile(buffer, GFPARM_RMODE_STD);
|
*CarParmHandle = GfParmReadFile(buffer, GFPARM_RMODE_STD);
|
||||||
|
LogDANDROID.info("# Dandroid setting track qualify path = %s\n", buffer);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -168,16 +171,20 @@ void TDriver::InitTrack(PTrack Track, PCarHandle CarHandle, PCarSettings *CarPar
|
||||||
|
|
||||||
if (*CarParmHandle == NULL)
|
if (*CarParmHandle == NULL)
|
||||||
{
|
{
|
||||||
sprintf(buffer, "drivers/%s/%s/%s", MyBotName, mCarType.c_str(), trackname);
|
sprintf(buffer, "%sdrivers/%s/%s/%s", GetDataDir(), MyBotName, mCarType.c_str(), trackname);
|
||||||
*CarParmHandle = GfParmReadFile(buffer, GFPARM_RMODE_STD);
|
*CarParmHandle = GfParmReadFile(buffer, GFPARM_RMODE_STD);
|
||||||
|
LogDANDROID.info("# Dandroid setting track path = %s\n", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*CarParmHandle == NULL)
|
if (*CarParmHandle == NULL)
|
||||||
{
|
{
|
||||||
sprintf(buffer, "drivers/%s/%s/default.xml", MyBotName, mCarType.c_str());
|
sprintf(buffer, "%sdrivers/%s/%s/default.xml", GetDataDir(), MyBotName, mCarType.c_str());
|
||||||
*CarParmHandle = GfParmReadFile(buffer, GFPARM_RMODE_STD);
|
*CarParmHandle = GfParmReadFile(buffer, GFPARM_RMODE_STD);
|
||||||
|
LogDANDROID.info("# Dandroid setting path default = %s\n", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
readPrivateSection(CarParmHandle);
|
readPrivateSection(CarParmHandle);
|
||||||
readConstSpecs(CarHandle);
|
readConstSpecs(CarHandle);
|
||||||
|
|
||||||
|
@ -245,8 +252,8 @@ void TDriver::NewRace(PtCarElt Car, PSituation Situation)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < (int)mSect.size(); i++)
|
for (int i = 0; i < (int)mSect.size(); i++)
|
||||||
{
|
{
|
||||||
mSect[i].brakedistfactor = 1.9;
|
mSect[i].brakedistfactor = mBRAKESCALE;
|
||||||
mSect[i].speedfactor = 0.9;
|
mSect[i].speedfactor = mMUSCALE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1481,6 +1488,8 @@ void TDriver::readPrivateSection(PCarSettings *CarParmHandle)
|
||||||
{
|
{
|
||||||
mBRAKEFORCEFACTOR = GfParmGetNum(*CarParmHandle, "private", "brakeforcefactor", (char*)NULL, 1.0);
|
mBRAKEFORCEFACTOR = GfParmGetNum(*CarParmHandle, "private", "brakeforcefactor", (char*)NULL, 1.0);
|
||||||
mBRAKEFORCEMIN = GfParmGetNum(*CarParmHandle, "private", "brakeforcemin", (char*)NULL, 0.0);
|
mBRAKEFORCEMIN = GfParmGetNum(*CarParmHandle, "private", "brakeforcemin", (char*)NULL, 0.0);
|
||||||
|
mMUSCALE = GfParmGetNum(*CarParmHandle,"private", "muscale", (char*)NULL, 0.7);
|
||||||
|
mBRAKESCALE = GfParmGetNum(*CarParmHandle, "private", "brakescale", (char*)NULL, 1.9);
|
||||||
mBUMPSPEEDFACTOR = GfParmGetNum(*CarParmHandle, "private", "bumpspeedfactor", (char*)NULL, 3.0);
|
mBUMPSPEEDFACTOR = GfParmGetNum(*CarParmHandle, "private", "bumpspeedfactor", (char*)NULL, 3.0);
|
||||||
mFUELPERMETER = GfParmGetNum(*CarParmHandle, "private", "fuelpermeter", (char*)NULL, 0.001f);
|
mFUELPERMETER = GfParmGetNum(*CarParmHandle, "private", "fuelpermeter", (char*)NULL, 0.001f);
|
||||||
mFUELWEIGHTFACTOR = GfParmGetNum(*CarParmHandle, "private", "fuelweightfactor", (char*)NULL, 1.0);
|
mFUELWEIGHTFACTOR = GfParmGetNum(*CarParmHandle, "private", "fuelweightfactor", (char*)NULL, 1.0);
|
||||||
|
@ -1525,6 +1534,8 @@ void TDriver::printSetup()
|
||||||
|
|
||||||
LogDANDROID.info("%s: brakeforcefactor = %g\n", oCar->_name, mBRAKEFORCEFACTOR);
|
LogDANDROID.info("%s: brakeforcefactor = %g\n", oCar->_name, mBRAKEFORCEFACTOR);
|
||||||
LogDANDROID.info("%s: brakeforcemin = %g\n", oCar->_name, mBRAKEFORCEMIN);
|
LogDANDROID.info("%s: brakeforcemin = %g\n", oCar->_name, mBRAKEFORCEMIN);
|
||||||
|
LogDANDROID.info("%s: muscale = %g\n", oCar->_name, mMUSCALE);
|
||||||
|
LogDANDROID.info("%s: brakescale = %g\n", oCar->_name, mBRAKESCALE);
|
||||||
LogDANDROID.info("%s: bumpspeedfactor = %g\n", oCar->_name, mBUMPSPEEDFACTOR);
|
LogDANDROID.info("%s: bumpspeedfactor = %g\n", oCar->_name, mBUMPSPEEDFACTOR);
|
||||||
LogDANDROID.info("%s: fuelpermeter = %g\n", oCar->_name, mFUELPERMETER);
|
LogDANDROID.info("%s: fuelpermeter = %g\n", oCar->_name, mFUELPERMETER);
|
||||||
LogDANDROID.info("%s: fuelweightfactor = %g\n", oCar->_name, mFUELWEIGHTFACTOR);
|
LogDANDROID.info("%s: fuelweightfactor = %g\n", oCar->_name, mFUELWEIGHTFACTOR);
|
||||||
|
|
|
@ -315,6 +315,8 @@ class TDriver
|
||||||
double mCW; // aerodynamic drag coefficient
|
double mCW; // aerodynamic drag coefficient
|
||||||
double mBRAKEFORCEFACTOR;
|
double mBRAKEFORCEFACTOR;
|
||||||
double mBRAKEFORCEMIN;
|
double mBRAKEFORCEMIN;
|
||||||
|
double mMUSCALE;
|
||||||
|
double mBRAKESCALE;
|
||||||
double mBUMPSPEEDFACTOR;
|
double mBUMPSPEEDFACTOR;
|
||||||
double mFUELPERMETER;
|
double mFUELPERMETER;
|
||||||
double mFUELWEIGHTFACTOR;
|
double mFUELWEIGHTFACTOR;
|
||||||
|
|
Loading…
Reference in a new issue