![]() |
Plasma Engine
2.0
|
The base class for all path state generates. More...
#include <PathState.h>
Public Member Functions | |
virtual void | GenerateAdjacentStates (plInt64 iNodeIndex, const PathStateType &StartState, plPathSearch< PathStateType > *pPathSearch)=0 |
Called by a plPathSearch object to generate the adjacent states from graph node iNodeIndex. | |
virtual void | StartSearchForClosest (plInt64 iStartNodeIndex, const PathStateType *pStartState) |
Automatically called by plPathSearch objects when a new path search is about to start (plPathSearch::FindClosest). Allows the generator to do some initial setup. | |
virtual void | StartSearch (plInt64 iStartNodeIndex, const PathStateType *pStartState, plInt64 iTargetNodeIndex) |
Automatically called by plPathSearch objects when a new path search is about to start (plPathSearch::FindPath). Allows the generator to do some initial setup. | |
virtual void | SearchFinished (plResult res) |
Automatically called by plPathSearch objects when a path search was finished. Allows the generator to do some cleanup. | |
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 plPathState.
|
pure virtual |
Called by a plPathSearch 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 plPathSearch object pPathSearch by calling plPathSearch::AddPathNode.