Quick and dirty pit stop bug fix for kilo
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@4635 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: df284c94fd5cb0e563ae9a1779beb67595f993df Former-commit-id: eb2e81c6bfe1cb32e16cf2ea7ac90da37f30b4b6
This commit is contained in:
parent
af3fdd34f2
commit
fca1a42bd1
3 changed files with 14 additions and 3 deletions
|
@ -131,6 +131,8 @@ static int current_light = RM_LIGHT_HEAD1 | RM_LIGHT_HEAD2;
|
||||||
KDriver::KDriver(int index)
|
KDriver::KDriver(int index)
|
||||||
: mode_(NORMAL) {
|
: mode_(NORMAL) {
|
||||||
INDEX = index;
|
INDEX = index;
|
||||||
|
forcePitStop = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -716,6 +718,8 @@ void KDriver::initTrack(tTrack * t, void *carHandle,
|
||||||
KILO_ATT_PITOFFSET, NULL, 10.0);
|
KILO_ATT_PITOFFSET, NULL, 10.0);
|
||||||
brake_delay_ = GfParmGetNum(*carParmHandle, KILO_SECT_PRIV,
|
brake_delay_ = GfParmGetNum(*carParmHandle, KILO_SECT_PRIV,
|
||||||
KILO_ATT_BRDELAY, NULL, 10.0);
|
KILO_ATT_BRDELAY, NULL, 10.0);
|
||||||
|
forcePitStop = GfParmGetNum(*carParmHandle, KILO_SECT_PRIV,
|
||||||
|
KILO_FORCE_PITSTOP, NULL, 0) == 1;
|
||||||
|
|
||||||
// Create a pit stop strategy object & initialize fuel.
|
// Create a pit stop strategy object & initialize fuel.
|
||||||
strategy_ = new KStrategy();
|
strategy_ = new KStrategy();
|
||||||
|
@ -774,7 +778,7 @@ void KDriver::CheckPitStatus(tSituation *s) {
|
||||||
if ((car_->_distFromStartLine < pit_->n_entry()
|
if ((car_->_distFromStartLine < pit_->n_entry()
|
||||||
|| car_->_distFromStartLine > pit_->n_end())
|
|| car_->_distFromStartLine > pit_->n_end())
|
||||||
|| car_->_fuel < 5.0) {
|
|| car_->_fuel < 5.0) {
|
||||||
pit_->set_pitstop(strategy_->NeedPitstop());
|
pit_->set_pitstop(strategy_->NeedPitstop() || forcePitStop);
|
||||||
}
|
}
|
||||||
} // if no pit planned
|
} // if no pit planned
|
||||||
|
|
||||||
|
@ -823,6 +827,7 @@ double KDriver::FilterBColl(const double brake) {
|
||||||
double mu = car_->_trkPos.seg->surface->kFriction;
|
double mu = car_->_trkPos.seg->surface->kFriction;
|
||||||
Opponent *o = opponents_->GetOppByState(OPP_COLL);
|
Opponent *o = opponents_->GetOppByState(OPP_COLL);
|
||||||
if (o != NULL) { // Endangered species nearby
|
if (o != NULL) { // Endangered species nearby
|
||||||
|
// if (BrakeDist(o->speed(), mu)
|
||||||
if (BrakeDist(o->speed(), mu)
|
if (BrakeDist(o->speed(), mu)
|
||||||
+ MIN(1.0, 0.5 + MAX(0.0, (speed() - o->speed()) / 4.0))
|
+ MIN(1.0, 0.5 + MAX(0.0, (speed() - o->speed()) / 4.0))
|
||||||
> o->distance()) { // Damn, too close, brake hard!!!
|
> o->distance()) { // Damn, too close, brake hard!!!
|
||||||
|
@ -1256,7 +1261,8 @@ double KDriver::FilterBPit(double brake) {
|
||||||
tdble dl, dw;
|
tdble dl, dw;
|
||||||
RtDistToPit(car_, track_, &dl, &dw);
|
RtDistToPit(car_, track_, &dl, &dw);
|
||||||
if (dl < PIT_BRAKE_AHEAD) {
|
if (dl < PIT_BRAKE_AHEAD) {
|
||||||
if (BrakeDist(0.0, mu) > dl)
|
// if (BrakeDist(0.0, mu) > dl)
|
||||||
|
if (BrakeDist(0.0, 0.5f * mu) > dl)
|
||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@ class LRaceLine;
|
||||||
#define KILO_SECT_SKILL "skill"
|
#define KILO_SECT_SKILL "skill"
|
||||||
#define KILO_SKILL_LEVEL "level"
|
#define KILO_SKILL_LEVEL "level"
|
||||||
#define KILO_SKILL_AGGRO "aggression"
|
#define KILO_SKILL_AGGRO "aggression"
|
||||||
|
#define KILO_FORCE_PITSTOP "force pit"
|
||||||
|
|
||||||
|
|
||||||
enum { NORMAL = 1, AVOIDING, CORRECTING, PITTING, BEING_OVERLAPPED };
|
enum { NORMAL = 1, AVOIDING, CORRECTING, PITTING, BEING_OVERLAPPED };
|
||||||
|
@ -233,6 +234,9 @@ class KDriver {
|
||||||
double MU_FACTOR; // [-]
|
double MU_FACTOR; // [-]
|
||||||
double (KDriver::*GET_DRIVEN_WHEEL_SPEED)();
|
double (KDriver::*GET_DRIVEN_WHEEL_SPEED)();
|
||||||
|
|
||||||
|
// DEBUG
|
||||||
|
bool forcePitStop;
|
||||||
|
|
||||||
// Class constants.
|
// Class constants.
|
||||||
static const double MAX_UNSTUCK_ANGLE;
|
static const double MAX_UNSTUCK_ANGLE;
|
||||||
static const double UNSTUCK_TIME_LIMIT;
|
static const double UNSTUCK_TIME_LIMIT;
|
||||||
|
|
|
@ -84,7 +84,8 @@ Pit::Pit(const tSituation * s, KDriver * driver, const double pitoffset) {
|
||||||
points_[i].y *= sign;
|
points_[i].y *= sign;
|
||||||
} // for i
|
} // for i
|
||||||
|
|
||||||
points_[3].y = fabs(pitinfo_->driversPits->pos.toMiddle + 1.0) * sign;
|
// points_[3].y = fabs(pitinfo_->driversPits->pos.toMiddle + 1.0) * sign;
|
||||||
|
points_[3].y = fabs(pitinfo_->driversPits->pos.toMiddle + 2.0) * sign;
|
||||||
spline_ = new Spline(NPOINTS, points_);
|
spline_ = new Spline(NPOINTS, points_);
|
||||||
} // if pit not null
|
} // if pit not null
|
||||||
} // Pit::Pit
|
} // Pit::Pit
|
||||||
|
|
Loading…
Reference in a new issue