#include <AIPathfind.h>
Inherits MemoryPoolObject, and Snapshot.
Public Member Functions | |
| Path () | |
| PathNode * | getFirstNode (void) |
| PathNode * | getLastNode (void) |
| void | updateLastNode (const Coord3D *pos) |
| void | prependNode (const Coord3D *pos, PathfindLayerEnum layer) |
| Create a new node at the head of the path. | |
| void | appendNode (const Coord3D *pos, PathfindLayerEnum layer) |
| Create a new node at the end of the path. | |
| void | setBlockedByAlly (Bool blocked) |
| Bool | getBlockedByAlly (void) |
| void | optimize (const Object *obj, LocomotorSurfaceTypeMask acceptableSurfaces, Bool blocked) |
| Optimize the path to discard redundant nodes. | |
| void | optimizeGroundPath (Bool crusher, Int diameter) |
| Optimize the ground path to discard redundant nodes. | |
| void | computePointOnPath (const Object *obj, const LocomotorSet &locomotorSet, const Coord3D &pos, ClosestPointOnPathInfo &out) |
| Given a location, return nearest location on path, and along-path dist to end as function result. | |
| void | peekCachedPointOnPath (Coord3D &pos) const |
| Given a location, return nearest location on path, and along-path dist to end as function result. | |
| Real | computeFlightDistToGoal (const Coord3D *pos, Coord3D &goalPos) |
| Given a flight path, compute the distance to goal (0 if we are past it) & return the goal pos. | |
| void | markOptimized (void) |
| Given a location, return closest location on path, and along-path dist to end as function result. | |
Public Member Functions inherited from MemoryPoolObject | |
| void | deleteInstance () |
Public Member Functions inherited from Snapshot | |
| Snapshot (void) | |
| ~Snapshot (void) | |
Protected Types | |
| enum | { MAX_CPOP =20 } |
Protected Member Functions | |
| virtual void | crc (Xfer *xfer) |
| virtual void | xfer (Xfer *xfer) |
| virtual void | loadPostProcess () |
| MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE (Path, "PathPool") | |
Protected Member Functions inherited from MemoryPoolObject | |
| virtual | ~MemoryPoolObject () |
| void * | operator new (size_t s) |
| void | operator delete (void *p) |
| virtual MemoryPool * | getObjectMemoryPool ()=0 |
Protected Attributes | |
| PathNode * | m_path |
| The list of PathNode objects that define the path. | |
| PathNode * | m_pathTail |
| Bool | m_isOptimized |
| True if the path has been optimized. | |
| Bool | m_blockedByAlly |
| An ally needs to move off of this path. | |
| Bool | m_cpopValid |
| Int | m_cpopCountdown |
| We only return the same cpop MAX_CPOP times. It is occasionally possible to get stuck. | |
| Coord3D | m_cpopIn |
| ClosestPointOnPathInfo | m_cpopOut |
| const PathNode * | m_cpopRecentStart |
This class encapsulates a "path" returned by the Pathfinder.
Definition at line 147 of file AIPathfind.h.
|
protected |
| Enumerator | |
|---|---|
| MAX_CPOP | |
Definition at line 184 of file AIPathfind.h.
| Path::Path | ( | ) |
Definition at line 243 of file AIPathfind.cpp.
| void Path::appendNode | ( | const Coord3D * | pos, |
| PathfindLayerEnum | layer ) |
Create a new node at the end of the path.
Create a new node at the tail of the path
Definition at line 421 of file AIPathfind.cpp.
Given a flight path, compute the distance to goal (0 if we are past it) & return the goal pos.
Given a position, computes the distance to the goal. Returns 0 if we are past the goal. Returns the goal position in goalPos. This is intended for use with flying paths, that go directly to the goal and don't consider obstacles. jba.
Definition at line 1046 of file AIPathfind.cpp.
| void Path::computePointOnPath | ( | const Object * | obj, |
| const LocomotorSet & | locomotorSet, | ||
| const Coord3D & | pos, | ||
| ClosestPointOnPathInfo & | out ) |
Given a location, return nearest location on path, and along-path dist to end as function result.
Given a location, return the closest position on the path. If 'allowBacktrack' is true, the entire path is considered. If it is false, the point computed cannot be prior to previously returned non-backtracking points on this path. Because the path "knows" the direction of travel, it will "lead" the given position a bit to ensure the path is followed in the inteded direction.
Note: The path cleanup does not take into account rolling terrain, so we can end up with these situations:
B ###### ##########
A-##-------—##—C #######################
When an agent gets to B, he seems far off of the path, but it really not. There are similar problems with valleys.
Since agents track the closest path, if a high hill gets close to the underside of a bridge, an agent may 'jump' to the higher path. This must be avoided in maps.
return along-path distance to the end will be returned as function result
Definition at line 756 of file AIPathfind.cpp.
|
protectedvirtual |
|
inline |
Definition at line 160 of file AIPathfind.h.
|
inline |
Definition at line 152 of file AIPathfind.h.
|
inline |
Definition at line 153 of file AIPathfind.h.
|
protectedvirtual |
|
inline |
Given a location, return closest location on path, and along-path dist to end as function result.
Definition at line 175 of file AIPathfind.h.
|
protected |
| void Path::optimize | ( | const Object * | obj, |
| LocomotorSurfaceTypeMask | acceptableSurfaces, | ||
| Bool | blocked ) |
Optimize the path to discard redundant nodes.
Optimize the path by checking line of sight
Definition at line 474 of file AIPathfind.cpp.
Optimize the ground path to discard redundant nodes.
Optimize the path by checking line of sight
Definition at line 602 of file AIPathfind.cpp.
|
inline |
Given a location, return nearest location on path, and along-path dist to end as function result.
Definition at line 169 of file AIPathfind.h.
| void Path::prependNode | ( | const Coord3D * | pos, |
| PathfindLayerEnum | layer ) |
Create a new node at the head of the path.
Create a new node at the head of the path
Definition at line 399 of file AIPathfind.cpp.
|
inline |
Definition at line 159 of file AIPathfind.h.
| void Path::updateLastNode | ( | const Coord3D * | pos | ) |
Create a new node at the tail of the path
Definition at line 452 of file AIPathfind.cpp.
|
protectedvirtual |
|
protected |
An ally needs to move off of this path.
Definition at line 190 of file AIPathfind.h.
|
protected |
We only return the same cpop MAX_CPOP times. It is occasionally possible to get stuck.
Definition at line 193 of file AIPathfind.h.
|
protected |
Definition at line 194 of file AIPathfind.h.
|
protected |
Definition at line 195 of file AIPathfind.h.
|
protected |
Definition at line 196 of file AIPathfind.h.
|
protected |
Definition at line 192 of file AIPathfind.h.
|
protected |
True if the path has been optimized.
Definition at line 189 of file AIPathfind.h.
|
protected |
The list of PathNode objects that define the path.
Definition at line 187 of file AIPathfind.h.
|
protected |
Definition at line 188 of file AIPathfind.h.