Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
clintbellanger committed Sep 28, 2012
2 parents 54a3987 + cd47f9b commit 97b7e39
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
55 changes: 29 additions & 26 deletions src/AStarNode.cpp
Expand Up @@ -19,39 +19,31 @@ FLARE. If not, see http://www.gnu.org/licenses/
#include "AStarNode.h"

AStarNode::AStarNode()
: x(0)
, y(0)
, g(0)
, h(0)
, parent(Point())
{}
{
this->x = 0;
this->y = 0;
}

AStarNode::AStarNode(const int a, const int b)
: x(a)
, y(b)
, g(0)
, h(0)
, parent(Point())
{}
{
this->x = a;
this->y = b;
}

AStarNode::AStarNode(const Point &p)
: x(0)
, y(0)
, g(0)
, h(0)
, parent(Point())
AStarNode::AStarNode(const Point p)
{
parent.x = p.x;
parent.y = p.y;
this->x = p.x;
this->y = p.y;
}

AStarNode::AStarNode(const AStarNode& copy)
: x(copy.x)
, y(copy.y)
, g(copy.g)
, h(copy.h)
, parent(Point(copy.parent))
{}
{
x = copy.x;
y = copy.y;
g = copy.g;
h = copy.h;
parent = copy.parent;
}

int AStarNode::getX() const
{
Expand All @@ -63,6 +55,12 @@ int AStarNode::getY() const
return y;
}

Point AStarNode::getCoordinate() const
{
Point coord = {x,y};
return coord;
}

Point AStarNode::getParent() const
{
return parent;
Expand Down Expand Up @@ -140,6 +138,11 @@ void AStarNode::setActualCost(const float G)
g = G;
}

float AStarNode::getEstimatedCost() const
{
return h;
}

void AStarNode::setEstimatedCost(const float H)
{
h = H;
Expand Down
2 changes: 1 addition & 1 deletion src/AStarNode.h
Expand Up @@ -47,7 +47,7 @@ class AStarNode
public:
AStarNode();
AStarNode(const int a, const int b);
AStarNode(const Point &p);
AStarNode(const Point p);
AStarNode(const AStarNode& copy);

int getX() const;
Expand Down

0 comments on commit 97b7e39

Please sign in to comment.