- fix strategy tires on USR
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8761 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: ad49aadd883c309aeb3e15633c6e8021246c5707 Former-commit-id: 020cb8cd2942f9d3f62642a5f92ab5d7d4a3cbc6
This commit is contained in:
parent
a526e789d7
commit
0c7ea892a2
2 changed files with 24 additions and 23 deletions
|
@ -315,8 +315,8 @@ void Pit::update()
|
|||
|
||||
if(mMyCar->HASTYC)
|
||||
{
|
||||
pittyres = (mMyCar->tires()->TyreTreadDepth() < 10.00 && remaininglaps > 5.0);
|
||||
LogUSR.debug(" # Tyre depth = %.2f Pit Tyres change = %i\n", mMyCar->tires()->TyreTreadDepth(), pittyres);
|
||||
pittyres = (((mMyCar->tires()->TyreTreadDepth() < 10.00) && remaininglaps > 5.0) || (mMyCar->tires()->distLeft() / mTrack->length) < pitfuel);
|
||||
LogUSR.info(" # Tyre depth = %.2f Pit Tyres change = %i\n", mMyCar->tires()->TyreTreadDepth(), pittyres);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -332,6 +332,7 @@ void Pit::update()
|
|||
else if (pitfuel || pitdamage || pittyres)
|
||||
{
|
||||
setPitstop(true);
|
||||
LogUSR.info(" # pit update !\n");
|
||||
}
|
||||
else if (pitForPenalty())
|
||||
{
|
||||
|
@ -475,7 +476,7 @@ double Pit::calcRefuel()
|
|||
double tiresdist = mMyCar->tires()->distLeft() - 1000.0;
|
||||
double stintdist = stintfuel * (mTrack->length / mAvgFuelPerLap);
|
||||
|
||||
if (tiresdist < stintdist || (mMyCar->tires()->TyreTreadDepth() > 25.0 - ((double)mCar->_remainingLaps / 10)))
|
||||
if (tiresdist > stintdist /*|| (mMyCar->tires()->TyreTreadDepth() < 25.0 - ((double)mCar->_remainingLaps / 10))*/)
|
||||
{
|
||||
mTireChange = false;
|
||||
}
|
||||
|
@ -485,10 +486,11 @@ double Pit::calcRefuel()
|
|||
}
|
||||
|
||||
// Print infos
|
||||
LogUSR.debug("USR Fuel pitstops %i\n", fuelpitstops);
|
||||
LogUSR.debug("USR Fuel per meter %.7f\n", mAvgFuelPerLap / mTrack->length);
|
||||
LogUSR.debug("USR Tire pitstops %i\n", tirespitstops);
|
||||
LogUSR.debug("USR Tire wear per meter %.7f\n", mMyCar->tires()->avgWearPerMeter());
|
||||
LogUSR.info("USR Fuel pitstops %i\n", fuelpitstops);
|
||||
LogUSR.info("USR Fuel per meter %.7f\n", mAvgFuelPerLap / mTrack->length);
|
||||
LogUSR.info("USR Tire pitstops %i\n", tirespitstops);
|
||||
LogUSR.info("USR Tire wear per meter %.7f\n", mMyCar->tires()->avgWearPerMeter());
|
||||
LogUSR.info("USR Tire distance %.7f\n", mMyCar->tires()->distLeft());
|
||||
|
||||
return stintfuel - mCar->_fuel;
|
||||
}
|
||||
|
@ -533,10 +535,12 @@ void Pit::pitCommand()
|
|||
if (mTireChange)
|
||||
{
|
||||
mCar->pitcmd.tireChange = (tCarPitCmd::TireChange) 1;
|
||||
LogUSR.info(" # USR tire change !!!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
mCar->pitcmd.tireChange = (tCarPitCmd::TireChange) 0;
|
||||
LogUSR.info(" # USR NO tire change !!!\n");
|
||||
}
|
||||
|
||||
mCar->pitcmd.stopType = RM_PIT_REPAIR;
|
||||
|
|
|
@ -29,7 +29,7 @@ void Tires::init(const tCarElt* car)
|
|||
{
|
||||
mCar = car;
|
||||
mDistWhenNew = 0;
|
||||
mWear = 0.0;
|
||||
mWear = 100.0;
|
||||
mHotTemp = ZEROC + GfParmGetNum(mCar->_carHandle, "private", "hottemp", (char*)NULL, 120.0);
|
||||
mMuScale = GfParmGetNum(mCar->_carHandle, "private", "mu scale", (char*)NULL, 1.0);
|
||||
}
|
||||
|
@ -37,24 +37,22 @@ void Tires::init(const tCarElt* car)
|
|||
void Tires::update()
|
||||
{
|
||||
// Get tire wear
|
||||
/* mWear = 0.0;
|
||||
double currGrain = 0.0, minWear = 100.0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (mCar->priv.wheel[i].currentWear > mWear)
|
||||
// mWear = 0.0;
|
||||
double minWear = 10.0;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (mCar->priv.wheel[i].treadDepth < mWear)
|
||||
{
|
||||
mWear = mCar->priv.wheel[i].currentWear;
|
||||
mWear = mCar->priv.wheel[i].treadDepth;
|
||||
}
|
||||
|
||||
if (mCar->priv.wheel[i].currentWear < minWear)
|
||||
minWear = mCar->priv.wheel[i].currentWear;
|
||||
|
||||
currGrain += mCar->priv.wheel[i].currentGraining;
|
||||
if (mCar->priv.wheel[i].treadDepth < minWear)
|
||||
minWear = mCar->priv.wheel[i].treadDepth;
|
||||
}
|
||||
|
||||
mAvgGrain = currGrain / 4;
|
||||
|
||||
// Check if tires were changed
|
||||
if (mWear < 0.001)
|
||||
if (mWear < 99.99)
|
||||
{
|
||||
mDistWhenNew = mCar->_distRaced;
|
||||
}
|
||||
|
@ -66,9 +64,8 @@ void Tires::update()
|
|||
mAvgWearPerMeter = mWear / distused;
|
||||
}
|
||||
|
||||
double wearuntilchange = 1.0 - mWear;
|
||||
//mDistLeft = wearuntilchange / mAvgWearPerMeter;
|
||||
mDistLeft = (minWear >= 0.9 && mAvgGrain > 0.75 ? 0.0 : 100000.0);*/
|
||||
double wearuntilchange = 100.0 - mWear;
|
||||
mDistLeft = wearuntilchange / mAvgWearPerMeter;
|
||||
|
||||
mGripFactor = updateGripFactor();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue