Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
WorldState.h
Go to the documentation of this file.
1
9#pragma once
10
11namespace Divide {
12namespace goap {
13 struct WorldState {
14 F32 priority_; // useful if this is a goal state, to distinguish from other possible goals
15 string name_; // the human-readable name of the state
16 hashMap<I32, bool> vars_; // the variables that in aggregate describe a worldstate
17
18 explicit WorldState(const Divide::string& name="") noexcept;
19
25 void setVariable(const int var_id, const bool value);
26
32 bool getVariable(const int var_id) const;
33
41 bool meetsGoal(const WorldState& goal_state) const;
42
49 int distanceTo(const WorldState& goal_state) const;
50
56 bool operator==(const WorldState& other) const;
57
58 [[nodiscard]] string toString() const;
59 };
60} //namespace goap
61} //namespace Divide
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
hashAlg::unordered_map< K, V, HashFun, Predicate > hashMap
Definition: HashMap.h:55
std::basic_string< char, std::char_traits< char >, dvd_allocator< char > > string
Definition: STLString.h:41
int distanceTo(const WorldState &goal_state) const
Definition: WorldState.cpp:44
string toString() const
Definition: WorldState.cpp:58
bool meetsGoal(const WorldState &goal_state) const
Definition: WorldState.cpp:29
bool getVariable(const int var_id) const
Definition: WorldState.cpp:20
void setVariable(const int var_id, const bool value)
Definition: WorldState.cpp:15
hashMap< I32, bool > vars_
Definition: WorldState.h:16