Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | List of all members
ICmpPathfinder Class Referenceabstract

Pathfinder algorithms. More...

#include <ICmpPathfinder.h>

Inheritance diagram for ICmpPathfinder:
IComponent CCmpPathfinder

Classes

struct  Goal
 
struct  Path
 Returned path. More...
 
struct  Waypoint
 

Public Types

typedef u16 pass_class_t
 
typedef u8 cost_class_t
 

Public Member Functions

virtual std::map< std::string,
pass_class_t
GetPassabilityClasses ()=0
 Get the list of all known passability classes. More...
 
virtual pass_class_t GetPassabilityClass (const std::string &name)=0
 Get the tag for a given passability class name. More...
 
virtual cost_class_t GetCostClass (const std::string &name)=0
 Get the tag for a given movement cost class name. More...
 
virtual const Grid< u16 > & GetPassabilityGrid ()=0
 
virtual void ComputePath (entity_pos_t x0, entity_pos_t z0, const Goal &goal, pass_class_t passClass, cost_class_t costClass, Path &ret)=0
 Compute a tile-based path from the given point to the goal, and return the set of waypoints. More...
 
virtual u32 ComputePathAsync (entity_pos_t x0, entity_pos_t z0, const Goal &goal, pass_class_t passClass, cost_class_t costClass, entity_id_t notify)=0
 Asynchronous version of ComputePath. More...
 
virtual void SetDebugPath (entity_pos_t x0, entity_pos_t z0, const Goal &goal, pass_class_t passClass, cost_class_t costClass)=0
 If the debug overlay is enabled, render the path that will computed by ComputePath. More...
 
virtual void ComputeShortPath (const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t r, entity_pos_t range, const Goal &goal, pass_class_t passClass, Path &ret)=0
 Compute a precise path from the given point to the goal, and return the set of waypoints. More...
 
virtual u32 ComputeShortPathAsync (entity_pos_t x0, entity_pos_t z0, entity_pos_t r, entity_pos_t range, const Goal &goal, pass_class_t passClass, bool avoidMovingUnits, entity_id_t group, entity_id_t notify)=0
 Asynchronous version of ComputeShortPath (using ControlGroupObstructionFilter). More...
 
virtual fixed GetMovementSpeed (entity_pos_t x0, entity_pos_t z0, cost_class_t costClass)=0
 Find the speed factor (typically around 1.0) for a unit of the given cost class at the given position. More...
 
virtual CFixedVector2D GetNearestPointOnGoal (CFixedVector2D pos, const Goal &goal)=0
 Returns the coordinates of the point on the goal that is closest to pos in a straight line. More...
 
virtual bool CheckMovement (const IObstructionTestFilter &filter, entity_pos_t x0, entity_pos_t z0, entity_pos_t x1, entity_pos_t z1, entity_pos_t r, pass_class_t passClass)=0
 Check whether the given movement line is valid and doesn't hit any obstructions or impassable terrain. More...
 
virtual
ICmpObstruction::EFoundationCheck 
CheckUnitPlacement (const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t r, pass_class_t passClass)=0
 Check whether a unit placed here is valid and doesn't hit any obstructions or impassable terrain. More...
 
virtual
ICmpObstruction::EFoundationCheck 
CheckUnitPlacement (const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t r, pass_class_t passClass, bool onlyCenterPoint)=0
 Check whether a unit placed here is valid and doesn't hit any obstructions or impassable terrain. More...
 
virtual
ICmpObstruction::EFoundationCheck 
CheckBuildingPlacement (const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t a, entity_pos_t w, entity_pos_t h, entity_id_t id, pass_class_t passClass)=0
 Check whether a building placed here is valid and doesn't hit any obstructions or impassable terrain. More...
 
virtual
ICmpObstruction::EFoundationCheck 
CheckBuildingPlacement (const IObstructionTestFilter &filter, entity_pos_t x, entity_pos_t z, entity_pos_t a, entity_pos_t w, entity_pos_t h, entity_id_t id, pass_class_t passClass, bool onlyCenterPoint)=0
 Check whether a building placed here is valid and doesn't hit any obstructions or impassable terrain. More...
 
virtual void SetDebugOverlay (bool enabled)=0
 Toggle the storage and rendering of debug info. More...
 
virtual void FinishAsyncRequests ()=0
 Finish computing asynchronous path requests and send the CMessagePathResult messages. More...
 
virtual void ProcessSameTurnMoves ()=0
 Process moves during the same turn they were created in to improve responsiveness. More...
 
- Public Member Functions inherited from IComponent
virtual ~IComponent ()
 
virtual void Init (const CParamNode &paramNode)=0
 
virtual void Deinit ()=0
 
virtual void HandleMessage (const CMessage &msg, bool global)
 
CEntityHandle GetEntityHandle () const
 
void SetEntityHandle (CEntityHandle ent)
 
entity_id_t GetEntityId () const
 
CEntityHandle GetSystemEntity () const
 
const CSimContextGetSimContext () const
 
void SetSimContext (const CSimContext &context)
 
virtual void Serialize (ISerializer &serialize)=0
 
virtual void Deserialize (const CParamNode &paramNode, IDeserializer &deserialize)=0
 
virtual JSClass * GetJSClass () const
 
virtual jsval GetJSInstance () const
 

Additional Inherited Members

- Static Public Member Functions inherited from IComponent
static std::string GetSchema ()
 
static u8 GetSerializationVersion ()
 

Detailed Description

Pathfinder algorithms.

There are two different modes: a tile-based pathfinder that works over long distances and accounts for terrain costs but ignore units, and a 'short' vertex-based pathfinder that provides precise paths and avoids other units.

Both use the same concept of a Goal: either a point, circle or square. (If the starting point is inside the goal shape then the path will move outwards to reach the shape's outline.)

The output is a list of waypoints.

Definition at line 48 of file ICmpPathfinder.h.

Member Typedef Documentation

Definition at line 52 of file ICmpPathfinder.h.

Definition at line 51 of file ICmpPathfinder.h.

Member Function Documentation

virtual ICmpObstruction::EFoundationCheck ICmpPathfinder::CheckBuildingPlacement ( const IObstructionTestFilter filter,
entity_pos_t  x,
entity_pos_t  z,
entity_pos_t  a,
entity_pos_t  w,
entity_pos_t  h,
entity_id_t  id,
pass_class_t  passClass 
)
pure virtual

Check whether a building placed here is valid and doesn't hit any obstructions or impassable terrain.

Returns
ICmpObstruction::FOUNDATION_CHECK_SUCCESS if the placement is okay, else a value describing the type of failure.

Implemented in CCmpPathfinder.

virtual ICmpObstruction::EFoundationCheck ICmpPathfinder::CheckBuildingPlacement ( const IObstructionTestFilter filter,
entity_pos_t  x,
entity_pos_t  z,
entity_pos_t  a,
entity_pos_t  w,
entity_pos_t  h,
entity_id_t  id,
pass_class_t  passClass,
bool  onlyCenterPoint 
)
pure virtual

Check whether a building placed here is valid and doesn't hit any obstructions or impassable terrain.

when onlyCenterPoint = true, only check the center tile of the building

Returns
ICmpObstruction::FOUNDATION_CHECK_SUCCESS if the placement is okay, else a value describing the type of failure.

Implemented in CCmpPathfinder.

virtual bool ICmpPathfinder::CheckMovement ( const IObstructionTestFilter filter,
entity_pos_t  x0,
entity_pos_t  z0,
entity_pos_t  x1,
entity_pos_t  z1,
entity_pos_t  r,
pass_class_t  passClass 
)
pure virtual

Check whether the given movement line is valid and doesn't hit any obstructions or impassable terrain.

Returns true if the movement is okay.

Implemented in CCmpPathfinder.

virtual ICmpObstruction::EFoundationCheck ICmpPathfinder::CheckUnitPlacement ( const IObstructionTestFilter filter,
entity_pos_t  x,
entity_pos_t  z,
entity_pos_t  r,
pass_class_t  passClass 
)
pure virtual

Check whether a unit placed here is valid and doesn't hit any obstructions or impassable terrain.

Returns
ICmpObstruction::FOUNDATION_CHECK_SUCCESS if the placement is okay, else a value describing the type of failure.

Implemented in CCmpPathfinder.

virtual ICmpObstruction::EFoundationCheck ICmpPathfinder::CheckUnitPlacement ( const IObstructionTestFilter filter,
entity_pos_t  x,
entity_pos_t  z,
entity_pos_t  r,
pass_class_t  passClass,
bool  onlyCenterPoint 
)
pure virtual

Check whether a unit placed here is valid and doesn't hit any obstructions or impassable terrain.

When onlyCenterPoint = true, only check the center tile of the unit

Returns
ICmpObstruction::FOUNDATION_CHECK_SUCCESS if the placement is okay, else a value describing the type of failure.

Implemented in CCmpPathfinder.

virtual void ICmpPathfinder::ComputePath ( entity_pos_t  x0,
entity_pos_t  z0,
const Goal goal,
pass_class_t  passClass,
cost_class_t  costClass,
Path ret 
)
pure virtual

Compute a tile-based path from the given point to the goal, and return the set of waypoints.

The waypoints correspond to the centers of horizontally/vertically adjacent tiles along the path.

virtual u32 ICmpPathfinder::ComputePathAsync ( entity_pos_t  x0,
entity_pos_t  z0,
const Goal goal,
pass_class_t  passClass,
cost_class_t  costClass,
entity_id_t  notify 
)
pure virtual

Asynchronous version of ComputePath.

The result will be sent as CMessagePathResult to 'notify'. Returns a unique non-zero number, which will match the 'ticket' in the result, so callers can recognise each individual request they make.

Implemented in CCmpPathfinder.

virtual void ICmpPathfinder::ComputeShortPath ( const IObstructionTestFilter filter,
entity_pos_t  x0,
entity_pos_t  z0,
entity_pos_t  r,
entity_pos_t  range,
const Goal goal,
pass_class_t  passClass,
Path ret 
)
pure virtual

Compute a precise path from the given point to the goal, and return the set of waypoints.

The path is based on the full set of obstructions that pass the filter, such that a unit of radius 'r' will be able to follow the path with no collisions. The path is restricted to a box of radius 'range' from the starting point.

virtual u32 ICmpPathfinder::ComputeShortPathAsync ( entity_pos_t  x0,
entity_pos_t  z0,
entity_pos_t  r,
entity_pos_t  range,
const Goal goal,
pass_class_t  passClass,
bool  avoidMovingUnits,
entity_id_t  group,
entity_id_t  notify 
)
pure virtual

Asynchronous version of ComputeShortPath (using ControlGroupObstructionFilter).

The result will be sent as CMessagePathResult to 'notify'. Returns a unique non-zero number, which will match the 'ticket' in the result, so callers can recognise each individual request they make.

Implemented in CCmpPathfinder.

virtual void ICmpPathfinder::FinishAsyncRequests ( )
pure virtual

Finish computing asynchronous path requests and send the CMessagePathResult messages.

Implemented in CCmpPathfinder.

virtual cost_class_t ICmpPathfinder::GetCostClass ( const std::string &  name)
pure virtual

Get the tag for a given movement cost class name.

Logs an error and returns something acceptable if the name is unrecognised.

Implemented in CCmpPathfinder.

virtual fixed ICmpPathfinder::GetMovementSpeed ( entity_pos_t  x0,
entity_pos_t  z0,
cost_class_t  costClass 
)
pure virtual

Find the speed factor (typically around 1.0) for a unit of the given cost class at the given position.

Implemented in CCmpPathfinder.

virtual CFixedVector2D ICmpPathfinder::GetNearestPointOnGoal ( CFixedVector2D  pos,
const Goal goal 
)
pure virtual

Returns the coordinates of the point on the goal that is closest to pos in a straight line.

Implemented in CCmpPathfinder.

virtual pass_class_t ICmpPathfinder::GetPassabilityClass ( const std::string &  name)
pure virtual

Get the tag for a given passability class name.

Logs an error and returns something acceptable if the name is unrecognised.

Implemented in CCmpPathfinder.

virtual std::map<std::string, pass_class_t> ICmpPathfinder::GetPassabilityClasses ( )
pure virtual

Get the list of all known passability classes.

Implemented in CCmpPathfinder.

virtual const Grid<u16>& ICmpPathfinder::GetPassabilityGrid ( )
pure virtual

Implemented in CCmpPathfinder.

virtual void ICmpPathfinder::ProcessSameTurnMoves ( )
pure virtual

Process moves during the same turn they were created in to improve responsiveness.

Implemented in CCmpPathfinder.

virtual void ICmpPathfinder::SetDebugOverlay ( bool  enabled)
pure virtual

Toggle the storage and rendering of debug info.

Implemented in CCmpPathfinder.

virtual void ICmpPathfinder::SetDebugPath ( entity_pos_t  x0,
entity_pos_t  z0,
const Goal goal,
pass_class_t  passClass,
cost_class_t  costClass 
)
pure virtual

If the debug overlay is enabled, render the path that will computed by ComputePath.

Implemented in CCmpPathfinder.


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