- Update Shadow's driver

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6016 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 7ee8586444b73b1ffcbe594d41fcaeabe62df004
Former-commit-id: a999a9d1dfba1b6e618c4388bc314d8fa3796719
This commit is contained in:
torcs-ng 2015-06-07 22:34:55 +00:00
parent 66d7be4a38
commit 01419ba47c
2 changed files with 43 additions and 0 deletions

View file

@ -2067,6 +2067,8 @@ int TDriver::CalcGear( tCarElt* car, double& acc )
// Compute the clutch value.
float TDriver::getClutch()
{
float m_Clutch;
#if 0
float speedr;
float omega;
float wr = wheelRadius;
@ -2128,6 +2130,46 @@ float TDriver::getClutch()
return clutcht;
}
}
#else
if(m_Clutch > 0)
{
if (car->_gear < 2)
m_Clutch = startAutomatic();
m_Clutch = MIN(m_ClutchMax, m_Clutch);
if(m_Clutch == m_ClutchMax)
{
if((car->_gear + car->_gearOffset)* car->_speed_x
/ (wheelRadius * car->_enginerpm) > m_ClutchRange)
{
m_Clutch = m_ClutchMax - 0.01;
}
else
m_Clutch -= m_ClutchDelta / 10;
}
else
{
m_Clutch -= m_ClutchDelta;
m_Clutch = MAX(0.0, m_Clutch);
}
}
return m_Clutch;
#endif
}
float TDriver::startAutomatic()
{
float m_Clutch;
if ((car->_gearCmd == 1) && (TDriver::CurrSimTime < 20))
{
if (car->_enginerpm < 0.94)
m_Clutch += m_ClutchDelta;
else if (car->_enginerpm > 1.1 * 0.94)
m_Clutch -= m_ClutchDelta * m_ClutchRelease;
}
return m_Clutch;
}
double TDriver::filterBrake(double Brake)

View file

@ -277,6 +277,7 @@ private:
void AvoidOtherCars( int index, tCarElt* car, double k, double& carTargetSpd, tSituation* s, bool& inTraffic, bool& lapper );
int CalcGear( tCarElt* car, double& acc );
float getClutch();
float startAutomatic();
double ApplyAbs( tCarElt* car, double brake );
double filterBrake(double Brake);
void Meteorology();