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

#include <PathState.h>

Public Member Functions

virtual void GenerateAdjacentStates (xiiInt64 iNodeIndex, const PathStateType &StartState, xiiPathSearch< PathStateType > *pPathSearch)=0
virtual void StartSearchForClosest (xiiInt64 iStartNodeIndex, const PathStateType *pStartState)
virtual void StartSearch (xiiInt64 iStartNodeIndex, const PathStateType *pStartState, xiiInt64 iTargetNodeIndex)
virtual void SearchFinished (xiiResult res)

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.

◆ SearchFinished()

template<typename PathStateType>
virtual void xiiPathStateGenerator< PathStateType >::SearchFinished ( xiiResult res)
inlinevirtual

Automatically called by xiiPathSearch objects when a path search was finished. Allows the generator to do some cleanup.

◆ StartSearch()

template<typename PathStateType>
virtual void xiiPathStateGenerator< PathStateType >::StartSearch ( xiiInt64 iStartNodeIndex,
const PathStateType * pStartState,
xiiInt64 iTargetNodeIndex )
inlinevirtual

Automatically called by xiiPathSearch objects when a new path search is about to start (xiiPathSearch::FindPath). Allows the generator to do some initial setup.

◆ StartSearchForClosest()

template<typename PathStateType>
virtual void xiiPathStateGenerator< PathStateType >::StartSearchForClosest ( xiiInt64 iStartNodeIndex,
const PathStateType * pStartState )
inlinevirtual

Automatically called by xiiPathSearch objects when a new path search is about to start (xiiPathSearch::FindClosest). Allows the generator to do some initial setup.


The documentation for this class was generated from the following file:
  • /home/runner/work/XII/XII/Source/Engine/Utilities/PathFinding/PathState.h