Go to the documentation of this file.
128 node *to = aMap->GetAbstractGraph(0)->GetNode(map->
GetNodeNum(targx, targy));
142 printf(
"SU %s: No target, doing nothing\n", this->
GetName());
154 Graph *g0 = aMap->GetAbstractGraph(0);
165 printf(
"STAY ON TARGET!\n");
166 printf(
"%p target time %1.4f\n", (
void*)
this,
targetTime);
187 printf(
"SU %s: Path returned NIL\n", this->
GetName());
195 std::cout << *p->
n << std::endl;
197 std::cout << *p->
next->
n << std::endl;
198 std::cout <<
loc.
x <<
", " <<
loc.
y << std::endl;
213 assert(
moves.size() > 0);
240 case -1: result =
kE;
break;
242 case 1: result =
kW;
break;
244 printf(
"SU: %s : The (x) nodes in the path are not next to each other!\n",
246 printf(
"Distance is %ld\n",
248 std::cout << *p->
n <<
"\n" << *p->
next->
n <<
"\n";
256 case -1: result = result|
kS;
break;
258 case 1: result = result|
kN;
break;
260 printf(
"SU: %s : The (y) nodes in the path are not next to each other!\n",
262 printf(
"Distance is %ld\n",
264 std::cout << *p->
n <<
"\n" << *p->
next->
n <<
"\n";
278 printf(
"SU %s: clearing cached moves, (%d,%d)\n", this->
GetName(),_x,_y);
285 printf(
"Drawing unit %p\n",
this);
286 GLdouble xx, yy, zz, rad;
287 Map *map = ame->GetMap();
292 glBegin(GL_LINE_STRIP);
293 glVertex3f(xx, yy, zz-rad/2);
294 for (
int t =
moves.size()-1; t >= 0; t--)
301 glVertex3f(xx, yy, zz-rad/2);
310 glColor3f(
r*perc,
g*perc,
b*perc);
324 glColor3f(
r*perc,
g*perc,
b*perc);
335 printf(
"Error; somehow nodes touched/expanded are inconsistent. t:%d e:%d\n",
bool getCachedMove(tDirection &dir)
virtual Map * GetMap() const =0
virtual void addPathToCache(path *p)
virtual void LogFinalStats(StatCollection *)
virtual void OpenGLDraw(const AbsMapEnvironment *, const AbsMapSimulationInfo *) const
int GetNodeNum(int x, int y, tCorner c=kNone)
Gets the abstract Graph node number for this tile.
virtual MapAbstraction * GetMapAbstraction()=0
uint64_t GetNodesTouched()
static const bool verbose
virtual double GetSimulationTime() const =0
uint64_t GetNodesExpanded()
void DrawSphere(GLdouble _x, GLdouble _y, GLdouble _z, GLdouble tRadius)
std::vector< tDirection > moves
node * GetNode(unsigned long num)
virtual path * think()=0
do next processing for path, returns avaliability of path moves
virtual bool makeMove(MapProvider *, reservationProvider *, AbsMapSimulationInfo *simInfo, tDirection &dir)
virtual const char * GetName()
SearchUnit(int x, int y, AbsMapUnit *target, SearchAlgorithm *alg)
virtual path * GetPath(GraphAbstraction *aMap, node *from, node *to, reservationProvider *rp=0)=0
virtual void setTargets(GraphAbstraction *_aMap, node *s, node *e, reservationProvider *_rp=0)
SearchAlgorithm * algorithm
virtual void updateLocation(int _x, int _y, bool, AbsMapSimulationInfo *)
The StatCollection class is for collecting stats across different parts of the simulation.
spreadExecSearchAlgorithm * s_algorithm
A generic algorithm which can be used for pathfinding.
void AddStat(const char *category, const char *owner, double value)
Add a new stat entry for the given category, owner and value.
bool GetOpenGLCoord(int _x, int _y, GLdouble &x, GLdouble &y, GLdouble &z, GLdouble &radius) const
Get the openGL coordinates of a given tile.
long GetLabelL(unsigned int index) const
A linked list of nodes which form a continuous path.
virtual void GetLocation(xyLoc &l)
void LogFinalStats(StatCollection *stats)
log any final one-time stats before a simulation is ended
Nodes to be stored within a Graph.
A tile-based representation of the world.
void DrawPyramid(GLfloat x, GLfloat y, GLfloat z, GLfloat height, GLfloat width)
Draw a pyramid with the tip at the given location, given height, and width from center to edge as wid...
void LogStats(StatCollection *stats)
log an stats that may have been computed during the last run