XII Release 0.1.0
Loading...
Searching...
No Matches
xiiPathStateGenerator< PathStateType > Class Template Referenceabstract

The base class for all path state generates. More...

#include <PathState.h>

Public Member Functions

virtual void GenerateAdjacentStates (xiiInt64 iNodeIndex, const PathStateType &StartState, xiiPathSearch< PathStateType > *pPathSearch)=0
 Called by a xiiPathSearch object to generate the adjacent states from graph node iNodeIndex.
 
virtual void StartSearchForClosest (xiiInt64 iStartNodeIndex, const PathStateType *pStartState)
 Automatically called by xiiPathSearch objects when a new path search is about to start (xiiPathSearch::FindClosest). Allows the generator to do some initial setup.
 
virtual void StartSearch (xiiInt64 iStartNodeIndex, const PathStateType *pStartState, xiiInt64 iTargetNodeIndex)
 Automatically called by xiiPathSearch objects when a new path search is about to start (xiiPathSearch::FindPath). Allows the generator to do some initial setup.
 
virtual void SearchFinished (xiiResult res)
 Automatically called by xiiPathSearch objects when a path search was finished. Allows the generator to do some cleanup.
 

Detailed Description

template<typename PathStateType>
class xiiPathStateGenerator< PathStateType >

The base class for all path state generates.

A path state generator is a class that takes one 'path state' (typically a node in a graph) and generates all the adjacent nodes that can be reached from there. It carries state, which allows to expand nodes only in certain directions, depending on what actions are possible at some graph node.

This can be used to do path searches where the capabilities of a unit are taken into account, such as limited turning speeds. The 'state' that is then carried is the current orientation of the unit at that point along the path, which determines into which directions the path search can be expanded.

PathStateType needs to be derived from xiiPathState.

Member Function Documentation

◆ GenerateAdjacentStates()

template<typename PathStateType>
virtual void xiiPathStateGenerator< PathStateType >::GenerateAdjacentStates ( xiiInt64 iNodeIndex,
const PathStateType & StartState,
xiiPathSearch< PathStateType > * pPathSearch )
pure virtual

Called by a xiiPathSearch object to generate the adjacent states from graph node iNodeIndex.

On a 2D grid the iNodeIndex would just be the grid cell index (GridHeight * Cell.y + Cell.x). This function would then 'expand' the 4 or 8 direct neighbor cells by creating a new PathStateType object for each and then passing that to the xiiPathSearch object pPathSearch by calling xiiPathSearch::AddPathNode.


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