ScummVM API documentation
hpl::cAINodeContainer Class Reference

Public Member Functions

 cAINodeContainer (const tString &asName, const tString &asNodeName, cWorld3D *apWorld, const cVector3f &avCollideSize)
 
const tStringGetNodeName ()
 
const tStringGetName ()
 
const cVector3fGetCollideSize ()
 
void ReserveSpace (size_t alReserveSpace)
 
void AddNode (const tString &asName, const cVector3f &avPosition, void *apUserData=NULL)
 
int GetNodeNum () const
 
cAINodeGetNode (int alIdx)
 
cAINodeGetNodeFromName (const tString &asName)
 
void Compile ()
 
void BuildNodeGridMap ()
 
cAINodeIterator GetNodeIterator (const cVector3f &avPosition, float afRadius)
 
bool FreePath (const cVector3f &avStart, const cVector3f &avEnd, int alRayNum=-1, tAIFreePathFlag aFlags=0, iAIFreePathCallback *apCallback=NULL)
 
void SetMaxEdges (int alX)
 
void SetMinEdges (int alX)
 
void SetMaxEdgeDistance (float afX)
 
float GetMaxEdgeDistance () const
 
void SetMaxHeight (float afX)
 
float GetMaxHeight () const
 
void SetNodeIsAtCenter (bool abX)
 
bool GetNodeIsAtCenter ()
 
void SaveToFile (const tString &asFile)
 
void LoadFromFile (const tString &asFile)
 

Member Function Documentation

◆ ReserveSpace()

void hpl::cAINodeContainer::ReserveSpace ( size_t  alReserveSpace)

Reserves spaces for nodes.

Parameters
alReserveSpaceNumber of nodes to reserve space for.

◆ AddNode()

void hpl::cAINodeContainer::AddNode ( const tString asName,
const cVector3f avPosition,
void *  apUserData = NULL 
)

Adds a new node to the container.

Parameters
&asNameName of the node
&avPositionPosition of the node.
*apUserDataData supplied by user.

◆ GetNodeNum()

int hpl::cAINodeContainer::GetNodeNum ( ) const

Get the number of nodes.

◆ GetNode()

cAINode* hpl::cAINodeContainer::GetNode ( int  alIdx)
inline

Get a node.

Parameters
alIdxindex of node.

◆ GetNodeFromName()

cAINode* hpl::cAINodeContainer::GetNodeFromName ( const tString asName)

Gets a node based on the name.

Parameters
&asNameName of the node.

◆ Compile()

void hpl::cAINodeContainer::Compile ( )

Compile the added nodes.

◆ BuildNodeGridMap()

void hpl::cAINodeContainer::BuildNodeGridMap ( )

Build a grid map for nodes. (Used internally mostly)

◆ GetNodeIterator()

cAINodeIterator hpl::cAINodeContainer::GetNodeIterator ( const cVector3f avPosition,
float  afRadius 
)

Returns a node iterator. Note that the radius is not checked, some nodes may lie outside.

Parameters
&avPosition
afRadius
Returns

◆ FreePath()

bool hpl::cAINodeContainer::FreePath ( const cVector3f avStart,
const cVector3f avEnd,
int  alRayNum = -1,
tAIFreePathFlag  aFlags = 0,
iAIFreePathCallback apCallback = NULL 
)

Checks for a free path using the containers collide size.

Parameters
&avStart
&avEnd
alRayNumThe max number of rays cast, -1 = maximum
alFlagsSet Flags for the ray casting.
apCallbackCheck for every body and overrides alFlags.
Returns

◆ SetMaxEdges()

void hpl::cAINodeContainer::SetMaxEdges ( int  alX)
inline

Sets the max number of end node added to a node.

Parameters
alXThe max number, -1 = unlimited

◆ SetMinEdges()

void hpl::cAINodeContainer::SetMinEdges ( int  alX)
inline

Sets the min number of end node added to a node. This overrides max distance when needed.

◆ SetMaxEdgeDistance()

void hpl::cAINodeContainer::SetMaxEdgeDistance ( float  afX)
inline

Sets the max distance for an end node.

Parameters
afX

◆ SetNodeIsAtCenter()

void hpl::cAINodeContainer::SetNodeIsAtCenter ( bool  abX)
inline

When calculating if there is a free path between two nodes. Is the node position the center of the collider. If not the position is the feet position.

◆ SaveToFile()

void hpl::cAINodeContainer::SaveToFile ( const tString asFile)

Saves all the node connections to file.

◆ LoadFromFile()

void hpl::cAINodeContainer::LoadFromFile ( const tString asFile)

Loads all node connections from file. Only to be done after all nodes are loaded.


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