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
5
#include "
Core/Headers/StringHelper.h
"
6
7
namespace
Divide::goap
8
{
9
10
I32
Node::last_id_
= 0;
11
12
Node::Node
() noexcept : parent_id_(-1), g_(0), h_(0), action_(
nullptr
)
13
{
14
id_
= ++
last_id_
;
15
}
16
17
Node::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
27
bool
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
35
string
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
Node.h
StringHelper.h
Divide::goap::Action
Definition:
Action.h:15
Divide::Util::StringFormat
Str StringFormat(const char *fmt, Args &&...args)
Definition:
StringHelper.inl:358
Divide::goap
Definition:
Action.cpp:7
Divide::goap::operator<
bool operator<(const Node &lhs, const Node &rhs) noexcept
Definition:
Node.cpp:27
Divide::I32
int32_t I32
Definition:
PlatformDataTypes.h:50
Divide::goap::Node
Definition:
Node.h:17
Divide::goap::Node::g_
I32 g_
Definition:
Node.h:23
Divide::goap::Node::id_
I32 id_
Definition:
Node.h:21
Divide::goap::Node::parent_id_
I32 parent_id_
Definition:
Node.h:22
Divide::goap::Node::h_
I32 h_
Definition:
Node.h:24
Divide::goap::Node::Node
Node() noexcept
Definition:
Node.cpp:12
Divide::goap::Node::toString
string toString() const
Definition:
Node.cpp:35
Divide::goap::Node::ws_
WorldState ws_
Definition:
Node.h:20
Divide::goap::Node::f
I32 f() const noexcept
Definition:
Node.h:31
Divide::goap::Node::last_id_
static I32 last_id_
Definition:
Node.h:18
Divide::goap::WorldState
Definition:
WorldState.h:13
Divide::goap::WorldState::toString
string toString() const
Definition:
WorldState.cpp:58
Source
AI
ActionInterface
CustomGOAP
Node.cpp
Generated on Fri May 17 2024 16:59:48 for Divide Framework by
1.9.6