ProtoBot
Loading...
Searching...
No Matches
Node Struct Reference

Public Member Functions

 Node (BWAPI::TilePosition tile, BWAPI::TilePosition parent, int gCost, int hCost, double fCost)
bool operator< (const Node &rhs) const
bool operator> (const Node &rhs) const
bool operator== (const Node &rhs) const

Public Attributes

BWAPI::TilePosition tile
BWAPI::TilePosition parent
double gCost
double hCost
double fCost

Detailed Description

Definition at line 28 of file A-StarPathfinding.h.

Constructor & Destructor Documentation

◆ Node() [1/2]

Node::Node ( BWAPI::TilePosition tile,
BWAPI::TilePosition parent,
int gCost,
int hCost,
double fCost )
inline

Definition at line 32 of file A-StarPathfinding.h.

32 {
33 this->tile = tile;
34 this->parent = parent;
35 this->gCost = gCost;
36 this->hCost = hCost;
37 this->fCost = fCost;
38 };

◆ Node() [2/2]

Node::Node ( )
inline

Definition at line 41 of file A-StarPathfinding.h.

41 {
42 tile = BWAPI::TilePosition(-1, -1);
43 };

Member Function Documentation

◆ operator<()

bool Node::operator< ( const Node & rhs) const
inline

Definition at line 45 of file A-StarPathfinding.h.

45 {
46 // Tie-breaker
47 if (this->fCost == rhs.fCost) {
48 return this->hCost < rhs.hCost;
49 }
50 return this->fCost < rhs.fCost;
51 }

◆ operator==()

bool Node::operator== ( const Node & rhs) const
inline

Definition at line 58 of file A-StarPathfinding.h.

58 {
59 return tile == rhs.tile;
60 }

◆ operator>()

bool Node::operator> ( const Node & rhs) const
inline

Definition at line 52 of file A-StarPathfinding.h.

52 {
53 if (this->fCost == rhs.fCost) {
54 return this->hCost > rhs.hCost;
55 }
56 return this->fCost > rhs.fCost;
57 }

Member Data Documentation

◆ fCost

double Node::fCost

Definition at line 30 of file A-StarPathfinding.h.

◆ gCost

double Node::gCost

Definition at line 30 of file A-StarPathfinding.h.

◆ hCost

double Node::hCost

Definition at line 30 of file A-StarPathfinding.h.

◆ parent

BWAPI::TilePosition Node::parent

Definition at line 29 of file A-StarPathfinding.h.

◆ tile

BWAPI::TilePosition Node::tile

Definition at line 29 of file A-StarPathfinding.h.


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