Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Node.cpp
Go to the documentation of this file.
1
2
3#include "Node.h"
4
6
7namespace Divide::goap
8{
9
11
12Node::Node() noexcept : parent_id_(-1), g_(0), h_(0), action_(nullptr)
13{
14 id_ = ++last_id_;
15}
16
17Node::Node(const WorldState& state, I32 g, I32 h, I32 parent_id, const Action* action)
18 : ws_(state)
19 , parent_id_(parent_id)
20 , g_(g)
21 , h_(h)
22 , action_(action)
23{
24 id_ = ++last_id_;
25}
26
27bool operator<(const Node& lhs, const Node& rhs) noexcept {
28 return lhs.f() < rhs.f();
29}
30
31//bool Node::operator<(const Node& other) {
32// return f() < other.f();
33//}
34
35string Node::toString() const
36{
37 return Util::StringFormat("Node { id: {} parent: {} F: {} G: {} H: {}, {}\n", id_, parent_id_, f(), g_, h_, ws_.toString());
38}
39
40} //namespace Divide::goap
Str StringFormat(const char *fmt, Args &&...args)
bool operator<(const Node &lhs, const Node &rhs) noexcept
Definition: Node.cpp:27
int32_t I32
I32 parent_id_
Definition: Node.h:22
Node() noexcept
Definition: Node.cpp:12
string toString() const
Definition: Node.cpp:35
WorldState ws_
Definition: Node.h:20
I32 f() const noexcept
Definition: Node.h:31
static I32 last_id_
Definition: Node.h:18
string toString() const
Definition: WorldState.cpp:58