gHitData Class Reference

Collaboration diagram for gHitData:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 gHitData ()
bool Hit () const
void AddHit (const eCoord &origin, const eCoord &dir, const gSensor &sensor, int winding)

Public Attributes

const eHalfEdgeedge
gSensorWallType wallType
int lr
REAL distance
gCycleotherCycle
REAL driveDistance
int windingNumber


Detailed Description

Definition at line 591 of file gAIBase.cpp.


Constructor & Destructor Documentation

gHitData::gHitData (  )  [inline]

Definition at line 603 of file gAIBase.cpp.


Member Function Documentation

bool gHitData::Hit (  )  const [inline]

Definition at line 605 of file gAIBase.cpp.

00605 {return edge;}

void gHitData::AddHit ( const eCoord &  origin,
const eCoord &  dir,
const gSensor sensor,
int  winding 
) [inline]

Definition at line 607 of file gAIBase.cpp.

References eSensor::before_hit, gPlayerWall::Cycle(), EPS, eSensor::lr, gPlayerWall::Pos(), REAL, gSensor::type, and gPlayerWall::WindingNumber().

00608     {
00609         if (!sensor.ehit)
00610             return; // no hit, nothing to do
00611 
00612         /*
00613         REAL otherDist = eCoord::F(*sensor.ehit->Point(), dir)
00614                          - eCoord::F(origin, dir);
00615 
00616         {
00617             REAL otherDist2 = eCoord::F(*sensor.ehit->Other()->Point(), dir)
00618                               - eCoord::F(origin, dir);
00619             if (otherDist2 < otherDist)
00620                 otherDist = otherDist2;
00621         }
00622         */
00623         REAL otherDist = eCoord::F( dir, sensor.before_hit - origin );
00624 
00625         if (otherDist < EPS)
00626             return; // the new hit is a wall we apparently drive along; nothing to do
00627 
00628         if (Hit() && distance < otherDist)
00629             return; // the hit that is already stored is more relevant. Ignore the new hit.
00630 
00631         // copy the relevant data
00632         edge     = sensor.ehit;
00633         wallType = sensor.type;
00634         lr       = sensor.lr;
00635         distance = otherDist;
00636 
00637         REAL alpha = edge->Ratio(sensor.before_hit);
00638 
00639         // get the extra information from the wall we hit:
00640         gPlayerWall *w = dynamic_cast<gPlayerWall*>(edge->GetWall());
00641         if (!w)
00642         {
00643             alpha = 1-alpha;
00644             w = dynamic_cast<gPlayerWall*>(edge->Other()->GetWall());
00645         }
00646 
00647         if (w)
00648         {
00649             otherCycle     = w->Cycle();
00650             driveDistance  = w->Pos(alpha);
00651             windingNumber  = w->WindingNumber() - winding;
00652         }
00653     }

Here is the call graph for this function:


Member Data Documentation

const eHalfEdge* gHitData::edge

Definition at line 593 of file gAIBase.cpp.

Referenced by gAIPlayer::ThinkTrace().

gSensorWallType gHitData::wallType

Definition at line 594 of file gAIBase.cpp.

Referenced by gAIPlayer::EmergencySurvive(), gAIPlayer::ThinkSurvive(), and gAIPlayer::ThinkTrace().

int gHitData::lr

Definition at line 595 of file gAIBase.cpp.

Referenced by gAISensor::DetectLoop(), and gAIPlayer::EmergencySurvive().

REAL gHitData::distance

Definition at line 596 of file gAIBase.cpp.

gCycle* gHitData::otherCycle

Definition at line 599 of file gAIBase.cpp.

Referenced by gAISensor::DetectLoop(), and gAIPlayer::EmergencySurvive().

REAL gHitData::driveDistance

Definition at line 600 of file gAIBase.cpp.

Referenced by gAISensor::DetectLoop().

int gHitData::windingNumber

Definition at line 601 of file gAIBase.cpp.

Referenced by gAISensor::DetectLoop().


The documentation for this class was generated from the following file:
Generated on Sat Mar 15 23:39:55 2008 for Armagetron Advanced by  doxygen 1.5.4