FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::IPather Class Referenceabstract

#include <ipather.h>

+ Inheritance diagram for FIFE::IPather:
+ Collaboration diagram for FIFE::IPather:

Public Member Functions

virtual ~IPather ()
 
virtual RoutecreateRoute (const Location &start, const Location &end, bool immediate=false, const std::string &cost_id="")=0
 Creates a route between the start and end location that needs be solved. More...
 
virtual bool solveRoute (Route *route, int32_t priority=MEDIUM_PRIORITY, bool immediate=false)=0
 Solves the route to create a path. More...
 
virtual bool followRoute (const Location &current, Route *route, double speed, Location &nextLocation)=0
 Follows the path of the route. More...
 
virtual void update ()=0
 Updates the pather (should it need updating). More...
 
virtual bool cancelSession (const int32_t sessionId)=0
 Cancels a given session. More...
 
virtual void setMaxTicks (int32_t ticks)=0
 Sets maximal ticks (update steps) to solve routes. More...
 
virtual int32_t getMaxTicks ()=0
 Returns maximal ticks (update steps) to solve routes. More...
 
virtual std::string getName () const =0
 Gets the name of this pather. More...
 

Detailed Description

Definition at line 49 of file ipather.h.

Constructor & Destructor Documentation

◆ ~IPather()

virtual FIFE::IPather::~IPather ( )
inlinevirtual

Member Function Documentation

◆ cancelSession()

virtual bool FIFE::IPather::cancelSession ( const int32_t  sessionId)
pure virtual

Cancels a given session.

This function is called when (for instance) the user changes their mind about a destination while the agent is already moving, the old session needs to be cancelled and a new one created.

Parameters
sessionIdThe id of the session to cancel.
Returns
A boolean to signify whether the session was successfully found and cancelled.

Implemented in FIFE::RoutePather.

Referenced by FIFE::ActionInfo::~ActionInfo(), and ~IPather().

+ Here is the caller graph for this function:

◆ createRoute()

virtual Route* FIFE::IPather::createRoute ( const Location start,
const Location end,
bool  immediate = false,
const std::string &  cost_id = "" 
)
pure virtual

Creates a route between the start and end location that needs be solved.

Parameters
startA const reference to the start location.
endA const reference to the target location.
immediateA optional boolean, if true the route bypass the max. ticks limit and solves the path immediately, otherwise false.
cost_idA const reference to the string that holds the cost identifier. You can use it optional then this cost id is used instead of the default cost.

Implemented in FIFE::RoutePather.

Referenced by ~IPather().

+ Here is the caller graph for this function:

◆ followRoute()

virtual bool FIFE::IPather::followRoute ( const Location current,
Route route,
double  speed,
Location nextLocation 
)
pure virtual

Follows the path of the route.

Parameters
currentA const reference to the current location.
routeA pointer to the route which should be followed.
speedA double which holds the speed.
nextLocationA reference to the next location returned by the pather.
Returns
A boolean, if true the route could be followed, otherwise false.

Implemented in FIFE::RoutePather.

Referenced by FIFE::Instance::processMovement(), and ~IPather().

+ Here is the caller graph for this function:

◆ getMaxTicks()

virtual int32_t FIFE::IPather::getMaxTicks ( )
pure virtual

Returns maximal ticks (update steps) to solve routes.

See also
update()
Returns
A integer which holds the steps. default is 1000

Implemented in FIFE::RoutePather.

Referenced by ~IPather().

+ Here is the caller graph for this function:

◆ getName()

virtual std::string FIFE::IPather::getName ( ) const
pure virtual

Gets the name of this pather.

Implemented in FIFE::RoutePather.

Referenced by ~IPather().

+ Here is the caller graph for this function:

◆ setMaxTicks()

virtual void FIFE::IPather::setMaxTicks ( int32_t  ticks)
pure virtual

Sets maximal ticks (update steps) to solve routes.

See also
update()
Parameters
ticksA integer which holds the steps. default is 1000

Implemented in FIFE::RoutePather.

Referenced by ~IPather().

+ Here is the caller graph for this function:

◆ solveRoute()

virtual bool FIFE::IPather::solveRoute ( Route route,
int32_t  priority = MEDIUM_PRIORITY,
bool  immediate = false 
)
pure virtual

Solves the route to create a path.

Parameters
routeA pointer to the route which should be solved.
priorityThe priority to assign to search (high are pushed to the front of the queue).
See also
PriorityType
Parameters
immediateA optional boolean, if true the route bypass the max. ticks limit and solves the path immediately, otherwise false.
Returns
A boolean, if true the route could be solved, otherwise false.

Implemented in FIFE::RoutePather.

Referenced by FIFE::Instance::move(), FIFE::Instance::processMovement(), and ~IPather().

+ Here is the caller graph for this function:

◆ update()

virtual void FIFE::IPather::update ( )
pure virtual

Updates the pather (should it need updating).

The update method is called by the model. Pathfinders which require per loop updating (in the case of pathfinders which implement A* for instance) should use this method as an oppurtunity to update the search. Generally the method should be constrained to a maximum amount of search updating to prevent this method from stalling the application.

Implemented in FIFE::RoutePather.

Referenced by ~IPather().

+ Here is the caller graph for this function:

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