- Update Shadow's driver
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6809 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: d3432ff21278923135b38b4041f0612e476f9937 Former-commit-id: a1a0828360b471b86ced0d96ed10ce7508a326d8
This commit is contained in:
parent
5b3c1bc9c7
commit
a86d50629e
3 changed files with 25 additions and 15 deletions
|
@ -231,6 +231,11 @@ static void* MergeParamFile( void* hParams, const char* fileName )
|
|||
GFPARM_MMODE_RELSRC | GFPARM_MMODE_RELDST);
|
||||
}
|
||||
|
||||
void TDriver::SetShared( Shared* pShared )
|
||||
{
|
||||
m_pShared = pShared;
|
||||
}
|
||||
|
||||
//==========================================================================*
|
||||
|
||||
//==========================================================================*
|
||||
|
@ -603,7 +608,7 @@ void TDriver::InitTrack( tTrack* pTrack, void* pCarHandle, void** ppCarParmHandl
|
|||
oCarHasESP = true;
|
||||
*/
|
||||
START_HOLD_LINE_TIME = GfParmGetNum(hCarParm, SECT_PRIV, PRV_STARTLINE, 0, 5.0f);
|
||||
m_pShared = new Shared();
|
||||
//m_pShared = new Shared();
|
||||
|
||||
MyTrack::SideMod sideMod;
|
||||
sideMod.side = -1;
|
||||
|
@ -772,15 +777,15 @@ void TDriver::NewRace( tCarElt* pCar, tSituation* pS )
|
|||
|
||||
bool TDriver::Pitting(int path, double pos) const
|
||||
{
|
||||
return m_Strategy->needPitstop(car, m_Situation) &&
|
||||
m_pitPath[path].ContainsPos(pos);
|
||||
return m_Strategy->needPitstop(car, m_Situation) &&
|
||||
m_pitPath[path].ContainsPos(pos);
|
||||
}
|
||||
|
||||
bool TDriver::Pitting(tCarElt* car) const
|
||||
{
|
||||
double pos = m_track.CalcPos(car);
|
||||
double pos = m_track.CalcPos(car);
|
||||
|
||||
return Pitting(PATH_NORMAL, pos);
|
||||
return Pitting(PATH_NORMAL, pos);
|
||||
}
|
||||
|
||||
void TDriver::GetPtInfo( int path, double pos, PtInfo& pi ) const
|
||||
|
@ -1871,18 +1876,18 @@ void TDriver::Drive( tSituation* s )
|
|||
m_LastAccel = acc;
|
||||
m_LastAbsDriftAngle = m_AbsDriftAngle;
|
||||
|
||||
const Opponent::Sit& mySit = m_opp[car->index].GetInfo().sit;
|
||||
m_stuck = NOT_STUCK;
|
||||
const Opponent::Sit& mySit = m_opp[car->index].GetInfo().sit;
|
||||
m_stuck = NOT_STUCK;
|
||||
|
||||
bool doStuckThing = true;
|
||||
bool doStuckThing = true;
|
||||
|
||||
if (Pitting(car))
|
||||
{
|
||||
doStuckThing = false;
|
||||
}
|
||||
if (Pitting(car))
|
||||
{
|
||||
doStuckThing = false;
|
||||
}
|
||||
|
||||
if (doStuckThing)
|
||||
m_stuckThing.execute(m_track, s, car, mySit);
|
||||
if (doStuckThing)
|
||||
m_stuckThing.execute(m_track, s, car, mySit);
|
||||
|
||||
m_Strategy->update(car, s);
|
||||
//m_Strategy->needPitstop(car, m_Situation);
|
||||
|
|
|
@ -188,6 +188,8 @@ public:
|
|||
TDriver(int index); // Constructor
|
||||
~TDriver(); // Destructor
|
||||
|
||||
void SetShared( Shared* pShared );
|
||||
|
||||
void InitTrack(tTrack* track, void* carHandle, void** carParmHandle, tSituation* s);
|
||||
void NewRace(tCarElt* car, tSituation* s );
|
||||
void Drive(tSituation* s);
|
||||
|
@ -363,7 +365,7 @@ private:
|
|||
|
||||
enum StuckAction
|
||||
{
|
||||
NOT_STUCK, STUCK_GO_BACKWARDS, STUCK_GO_FORWARDS,
|
||||
NOT_STUCK, STUCK_GO_BACKWARDS, STUCK_GO_FORWARDS,
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -44,6 +44,8 @@ using ::std::pair;
|
|||
// The "SHADOW" logger instance
|
||||
GfLogger* PLogSHADOW = 0;
|
||||
|
||||
static Shared s_shared;
|
||||
|
||||
// TORCS interface
|
||||
static void initTrack(int index, tTrack* track, void *carHandle, void **carParmHandle, tSituation *s);
|
||||
static void newRace(int index, tCarElt* car, tSituation *s);
|
||||
|
@ -260,6 +262,7 @@ static int InitFuncPt(int index, void *pt)
|
|||
static void initTrack(int index, tTrack* track, void *carHandle,
|
||||
void **carParmHandle, tSituation *s)
|
||||
{
|
||||
driver[index]->SetShared( &s_shared );
|
||||
driver[index]->InitTrack(track, carHandle, carParmHandle, s);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue