Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

unit Class Reference

A unit is the basic object that moves and interacts in the unitSimulation. More...

#include <unit.h>

Inheritance diagram for unit:

Inheritance graph
[legend]
Collaboration diagram for unit:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 unit (int x, int y, unit *target=0)
 Create a unit.

 unit (int x, int y, int r, int g, int b, unit *target=0)
 Create a unit.

 unit (int x, int y, float r, float g, float b, unit *target=0)
 Create a unit.

virtual ~unit ()
virtual const char * getName ()
virtual tDirection makeMove (mapProvider *mp, reservationProvider *rp, simulationInfo *simInfo)
 The new makeMove only gives a map.

void getLocation (int &x, int &y)
 get where the unit thinks it is

virtual void updateLocation (int _x, int _y, bool, simulationInfo *)
 updateLocation only tells a unit where it is located, it doesn't physically change the location in the world

virtual void logStats (statCollection *stats)
 log an stats that may have been computed during the last run

virtual void logFinalStats (statCollection *)
 log any final one-time stats before a simulation is ended

virtual double getSpeed ()
void setSpeed (double s)
virtual bool done ()
unitgetTarget ()
virtual void setTarget (unit *u)
void setColor (GLfloat _r, GLfloat _g, GLfloat _b)
void getColor (GLfloat &_r, GLfloat &_g, GLfloat &_b)
virtual void openGLDraw (mapProvider *, simulationInfo *simInfo)
 Draw the unit.

void setObjectType (tObjectType _unitType)
tObjectType getObjectType ()
unitGroup * getUnitGroup ()
void setUnitGroup (unitGroup *_group)
void getOpenGLLocation (Map *map, GLdouble &_x, GLdouble &_y, GLdouble &_z, GLdouble &radius)
 Get OpenGL coordinates of unit.

int getUnitID ()

Static Public Member Functions

void clearDisplayList ()

Protected Member Functions

void drawTriangle (GLdouble x, GLdouble y, GLdouble z, GLdouble tRadius)
 Draw a triangle for the unit.

void drawSphere (GLdouble x, GLdouble y, GLdouble z, GLdouble tRadius)
 Draw a dome for the unit.

bool mapUpdated (mapAbstraction *aMap)
 is map updated?


Protected Attributes

tObjectType unitType
int map_revision
int x
int y
GLfloat r
GLfloat g
GLfloat b
double speed
unittarget
unitGroup * group
int id

Static Protected Attributes

GLuint sphereDispList = 0
int unitID = 0

Detailed Description

A unit is the basic object that moves and interacts in the unitSimulation.


Constructor & Destructor Documentation

unit::unit int  _x,
int  _y,
unit _target = 0
 

Create a unit.

Create a unit starting at a given x/y location, with a potential target.

unit::unit int  _x,
int  _y,
int  _r,
int  _g,
int  _b,
unit _target = 0
 

Create a unit.

Create a unit starting at a given x/y location, r/g/b (0.255), with a potential target.

unit::unit int  _x,
int  _y,
float  _r,
float  _g,
float  _b,
unit _target = 0
 

Create a unit.

Create a unit starting at a given x/y location, r/g/b (0.255), with a potential target.

unit::~unit  )  [virtual]
 


Member Function Documentation

void unit::clearDisplayList  )  [inline, static]
 

virtual bool unit::done  )  [inline, virtual]
 

Reimplemented in KoenigsUnit, LRTAStarUnit, patUnit, PrioritizedUnit, PRLRTSkUnit, and searchUnit.

void unit::drawSphere GLdouble  _x,
GLdouble  _y,
GLdouble  _z,
GLdouble  tRadius
[protected]
 

Draw a dome for the unit.

Draw a dome at the coordinates specified; used for all other units by default.

void unit::drawTriangle GLdouble  _x,
GLdouble  _y,
GLdouble  _z,
GLdouble  tRadius
[protected]
 

Draw a triangle for the unit.

Draw's a pyramid at the location specified. Used for drawing kDisplayOnly objects.

void unit::getColor GLfloat &  _r,
GLfloat &  _g,
GLfloat &  _b
[inline]
 

void unit::getLocation int &  _x,
int &  _y
 

get where the unit thinks it is

returns the current unit location by reference

virtual const char* unit::getName  )  [inline, virtual]
 

Reimplemented in KoenigsUnit, PrioritizedUnit, PRLRTSkUnit, patrolUnit, praStarUnit, rewardUnit, rewardSeekingUnit, searchUnit, randomUnit, billiardBallUnit, and randomerUnit.

tObjectType unit::getObjectType  )  [inline]
 

void unit::getOpenGLLocation Map map,
GLdouble &  _x,
GLdouble &  _y,
GLdouble &  _z,
GLdouble &  radius
 

Get OpenGL coordinates of unit.

Returns the x/y/z open GL coordinates of a unit, as well as the radius of the unit in the world.

virtual double unit::getSpeed  )  [inline, virtual]
 

unit* unit::getTarget  )  [inline]
 

Reimplemented in patrolUnit.

unitGroup* unit::getUnitGroup  )  [inline]
 

int unit::getUnitID  )  [inline]
 

virtual void unit::logFinalStats statCollection  )  [inline, virtual]
 

log any final one-time stats before a simulation is ended

Reimplemented in patrolUnit, and searchUnit.

void unit::logStats statCollection stats  )  [virtual]
 

log an stats that may have been computed during the last run

No stats collected by default.

Reimplemented in KoenigsUnit, PrioritizedUnit, PRLRTSkUnit, patrolUnit, and searchUnit.

tDirection unit::makeMove mapProvider mp,
reservationProvider rp,
simulationInfo simInfo
[virtual]
 

The new makeMove only gives a map.

The unit simulation won't calculate an mapAbstraction unless it has to. Thus, in simple pathfinding tests, the overhead is saved.

Reimplemented in KoenigsUnit, LRTAStarUnit, PrioritizedUnit, PRLRTSkUnit, humanUnit, patrolUnit, praStarUnit, rewardSeekingUnit, searchUnit, randomUnit, billiardBallUnit, randomerUnit, rhrUnit, and teleportUnit.

bool unit::mapUpdated mapAbstraction aMap  )  [protected]
 

is map updated?

returns true if the map has been udpated from the last time we checked.

void unit::openGLDraw mapProvider mp,
simulationInfo simInfo
[virtual]
 

Draw the unit.

Draw the unit using openGL. Overload this if you want a custom look for the unit.

Reimplemented in patrolUnit, rewardUnit, rewardSeekingUnit, and searchUnit.

void unit::setColor GLfloat  _r,
GLfloat  _g,
GLfloat  _b
[inline]
 

void unit::setObjectType tObjectType  _unitType  )  [inline]
 

void unit::setSpeed double  s  )  [inline]
 

virtual void unit::setTarget unit u  )  [inline, virtual]
 

void unit::setUnitGroup unitGroup *  _group  ) 
 

virtual void unit::updateLocation int  _x,
int  _y,
bool  ,
simulationInfo
[inline, virtual]
 

updateLocation only tells a unit where it is located, it doesn't physically change the location in the world

Reimplemented in patrolUnit, searchUnit, randomUnit, billiardBallUnit, rhrUnit, and teleportUnit.


Member Data Documentation

GLfloat unit::b [protected]
 

GLfloat unit::g [protected]
 

unitGroup* unit::group [protected]
 

int unit::id [protected]
 

int unit::map_revision [protected]
 

GLfloat unit::r [protected]
 

double unit::speed [protected]
 

GLuint unit::sphereDispList = 0 [static, protected]
 

unit* unit::target [protected]
 

int unit::unitID = 0 [static, protected]
 

tObjectType unit::unitType [protected]
 

int unit::x [protected]
 

int unit::y [protected]
 


The documentation for this class was generated from the following files:
Generated on Tue Aug 18 03:45:59 2009 for HOG by doxygen 1.3.4