Creates an object for A* path finding.
More...
#include <AStar.h>
Creates an object for A* path finding.
- Author
- Jamie Slowgrove Reference ~ This is a modified version of my A* path-finding from my AI assignment.
| JAM_AStar::JAM_AStar |
( |
int |
xNodes, |
|
|
int |
yNodes, |
|
|
float |
nodeWidth, |
|
|
float |
nodeHeight |
|
) |
| |
Constructs the AStar object.
- Parameters
-
| xNodes | The number of nodes in a row. |
| yNodes | The number of rows in the map. |
| nodeWidth | The width of a node. |
| nodeHeight | The height of a node. |
| JAM_AStar::~JAM_AStar |
( |
| ) |
|
Destructs the AStar object.
| void JAM_AStar::checkNodes |
( |
int |
parentX, |
|
|
int |
parentY |
|
) |
| |
|
private |
Check the surrounding nodes.
- Parameters
-
| parentX | The parent node x index value. |
| parentY | The parent node y index value. |
| void JAM_AStar::drawLists |
( |
SDL_Renderer * |
renderer | ) |
|
Displays the open and closed lists.
- Parameters
-
| renderer | A pointer to the renderer. |
| void JAM_AStar::findBestPath |
( |
| ) |
|
|
private |
| void JAM_AStar::findNewPath |
( |
int |
startX, |
|
|
int |
startY, |
|
|
int |
endX, |
|
|
int |
endY |
|
) |
| |
Finds a new path to follow.
- Parameters
-
| startX | The start x index value. |
| startY | The start y index value. |
| endX | The end x index value. |
| endY | The end y index value. |
| void JAM_AStar::findNextNode |
( |
| ) |
|
|
private |
Getter # Gets the position of the next node in the path.
- Returns
- The Node position.
| void JAM_AStar::nodeTest |
( |
int |
parentX, |
|
|
int |
parentY, |
|
|
int |
testX, |
|
|
int |
testY, |
|
|
int |
cost |
|
) |
| |
|
private |
Test the node for the open list setup.
- Parameters
-
| parentX | The parent x index value. |
| parentY | The parent y index value. |
| testX | The test x index value. |
| testY | The test y index value. |
| cost | The cost to add to the node. |
| void JAM_AStar::setDangerNode |
( |
int |
nodeXIndex, |
|
|
int |
nodeYIndex |
|
) |
| |
Setter # Sets the Node at the inputed index to a danger Node.
- Parameters
-
| nodeXIndex | The x index of the Node. |
| nodeYIndex | The y index of the Node. |
| void JAM_AStar::setSafeNode |
( |
int |
nodeXIndex, |
|
|
int |
nodeYIndex |
|
) |
| |
Setter # Sets the Node at the inputed index to a safe Node.
- Parameters
-
| nodeXIndex | The x index of the Node. |
| nodeYIndex | The y index of the Node. |
| std::vector<JAM_Node> JAM_AStar::bestPath |
|
private |
The array of Nodes for the best path.
| std::vector<JAM_Node> JAM_AStar::closedList |
|
private |
The closed list of Nodes.
The Dimensions of a node.
| std::vector<std::vector<JAM_Node*> > JAM_AStar::nodes |
|
private |
| std::vector<JAM_Node> JAM_AStar::openList |
|
private |
The documentation for this class was generated from the following files: