Advanced Strategic Command
Public Member Functions | List of all members
PathFinder Class Reference
Inheritance diagram for PathFinder:
Inheritance graph
[legend]

Public Member Functions

 PathFinder (Vehicle *veh, int maxDistance)
 
void getMovementFields (set< MapCoordinate3D > &reachableFields, set< MapCoordinate3D > &reachableFieldsIndirect, int height)
 searches for all fields that are within the range of maxDist and marks them. More...
 
- Public Member Functions inherited from AStar3D
 AStar3D (GameMap *actmap, Vehicle *veh, bool markTemps_=true, int maxDistance=maxint)
 
void registerOperationLimiter (OperationLimiter *ol)
 the search can be restricted to certain operations More...
 
bool findPath (const MapCoordinate3D &dest)
 searches for a path from the unit's current position to dest More...
 
bool findPath (const vector< MapCoordinate3D > &dest)
 searches for a path from the units current position to one of the dest fields More...
 
void findPath (Path &path, const MapCoordinate3D &dest)
 searches for a path from the unit's current position to dest and stores it in path More...
 
bool findPath (Path &path, const vector< MapCoordinate3D > &dest)
 searches for a path from the units current position to one of the dest fields and stores it in path More...
 
void findAllAccessibleFields ()
 searches for all fields that are within the range of maxDist and marks them. More...
 
bool constructPath (Path &path, const Node *n)
 construct a path from a pointer to a visited node, return false if pointer is NULL, else true More...
 
bool constructPath (Path &path, const MapCoordinate3D &pos)
 construct a path from a pointer to a visited node; return false if position doesn't exist, else true More...
 
int getDistance ()
 returns the distance of the last found path, or -1 on any error More...
 
int getTravelTime ()
 returns the number of turns that the unit will need to travel along the last found path More...
 
int getFieldAccess (int x, int y)
 
int getFieldAccess (const MapCoordinate &mc)
 
void dumpVisited ()
 for debugging: dumps the contents of the visited node to stdout More...
 
virtual ~AStar3D ()
 

Additional Inherited Members

- Public Types inherited from AStar3D
typedef float DistanceType
 
typedef deque< PathPointPath
 
- Public Attributes inherited from AStar3D
VisitedContainer visited
 
- Static Public Attributes inherited from AStar3D
static const DistanceType longestPath = 1e9
 
- Protected Types inherited from AStar3D
typedef boost::unordered_map
< MapCoordinate, int,
hash_MapCoordinate
fieldAccessType
 
- Protected Member Functions inherited from AStar3D
virtual DistanceType getMoveCost (const MapCoordinate3D &start, const MapCoordinate3D &dest, const Vehicle *vehicle, bool &hasAttacked)
 
DistanceType dist (const MapCoordinate3D &a, const MapCoordinate3D &b)
 
DistanceType dist (const MapCoordinate3D &a, const vector< MapCoordinate3D > &b)
 
int initNode (Node &newN, const Node *oldN_ptr, const MapCoordinate3D &newpos, const vector< MapCoordinate3D > &B, bool disableAttack=false, bool enter=false, bool dock=false)
 
- Protected Attributes inherited from AStar3D
OperationLimiteroperationLimiter
 
int MAXIMUM_PATH_LENGTH
 
GameMaptempsMarked
 
Path_path
 
Vehicleveh
 
GameMapactmap
 
float vehicleSpeedFactor [8]
 
float maxVehicleSpeedFactor
 
bool markTemps
 
WindMovementwind
 
fieldAccessType fieldAccess
 

Detailed Description

Definition at line 132 of file moveunitcommand.cpp.

Constructor & Destructor Documentation

PathFinder::PathFinder ( Vehicle veh,
int  maxDistance 
)
inline

Definition at line 134 of file moveunitcommand.cpp.

Member Function Documentation

void PathFinder::getMovementFields ( set< MapCoordinate3D > &  reachableFields,
set< MapCoordinate3D > &  reachableFieldsIndirect,
int  height 
)

searches for all fields that are within the range of maxDist and marks them.

On each field one bit for each level of height will be set. The Destructor removes all marks.

Definition at line 144 of file moveunitcommand.cpp.

References AStar3D::actmap, AStar3D::VisitedContainer::begin(), AStar3D::Node::canStop, AStar3D::VisitedContainer::end(), AStar3D::findPath(), GameMap::getField(), MapCoordinate3D::getNumericalHeight(), Vehicle::getPosition(), AStar3D::Node::gval, AStar3D::Node::h, Vehicle::height, maxint, move(), MapCoordinate3D::setnum(), AStar3D::veh, AStar3D::visited, MapCoordinate::x, and MapCoordinate::y.

Referenced by MoveUnitCommand::searchFields().


The documentation for this class was generated from the following file: