- Update Shadow's driver

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

Former-commit-id: bcb29c34ffa1f386d6555e73779d75df206f8366
Former-commit-id: 57ff49d36e1a04a8f03bc20b67ccacb005f8299f
This commit is contained in:
torcs-ng 2015-08-06 08:30:37 +00:00
parent 9a3210565f
commit c291296afb
4 changed files with 19 additions and 3 deletions

View file

@ -35,6 +35,7 @@ CarModel::CarModel()
DAMAGE(0),
NEEDSINLONG(false),
USEDACCEXIT(false),
SKILL(0),
TYRE_MU(0),
TYRE_MU_F(0),
@ -285,6 +286,8 @@ double CarModel::CalcBreaking(double k0, double kz0, double k1, double kz1, doub
double acc = Ftanroad / M;
acc = BRAKESCALE * Ftanroad / (MASS * ( 3 + SKILL) / 4);
if (TDriver::UseBrakeLimit)
{
double Radius = 1.0 / fabs(Kz);
@ -300,7 +303,14 @@ double CarModel::CalcBreaking(double k0, double kz0, double k1, double kz1, doub
break;
}
return u;
double midspd = (u + spd1)/2;
// Check brake
double brakedecel = BRAKESCALE * BRAKEFORCE / MASS;
double braketargetspd = sqrt(midspd * midspd + 2 * brakedecel * dist);
double resulttargetspd = MIN(u, braketargetspd);
return MAX(resulttargetspd, spd1);
}
double CarModel::CalcAcceleration(double k0, double kz0, double k1, double kz1, double spd0, double dist, double kFriction, double RollAngle , double TiltAngle) const

View file

@ -43,8 +43,9 @@ public:
double LENGTH; // Length of car (m)
double FUEL; // mass of fuel in car.
double DAMAGE; // damage of this car.
double NEEDSINLONG;
double USEDACCEXIT;
bool NEEDSINLONG;
bool USEDACCEXIT;
double SKILL; // skill car driver.
double TYRE_MU; // mu value of tyres (min of those avail).
double TYRE_MU_F; // mu value of front tyres.

View file

@ -511,6 +511,7 @@ void TDriver::InitTrack( tTrack* pTrack, void* pCarHandle, void** ppCarParmHandl
m_cm.BUMP_FACTOR = GfParmGetNum(hCarParm, SECT_PRIV, PRV_BUMP_FACTOR, NULL, 1.0);
m_cm.NEEDSINLONG = GfParmGetNum(hCarParm, SECT_PRIV, PRV_NEED_SIN, NULL, 0);
m_cm.USEDACCEXIT = GfParmGetNum(hCarParm, SECT_PRIV, PRV_USED_ACC, NULL, 0);
m_cm.BRAKESCALE = GfParmGetNum(hCarParm, SECT_PRIV, PRV_BRAKESCALE, NULL, 1.0);
FACTORS.RemoveAll();
@ -682,6 +683,8 @@ void TDriver::NewRace( tCarElt* pCar, tSituation* pS )
initWheelPos();
initBrake();
m_cm.BRAKEFORCE = BrakeForce;
m_cm.FUEL = 0;//pCar->_fuel;
m_cm.WIDTH = car->_dimension_y;

View file

@ -48,6 +48,8 @@
#define PRV_RAIN_MU "mu scale rain"
#define PRV_ACCEL_DELTA "accel delta"
#define PRV_ACCEL_DELTA_RAIN "accel delta rain"
#define PRV_BRAKESCALE "brake scale"
#define PRV_BRAKEFORCE "brake force"
#define PRV_FLY_HEIGHT "fly height"
#define PRV_FACTOR "factor"
#define PRV_AERO_MOD "aero mod"