![]() |
Divide Framework 0.1
A free and open-source 3D Framework under heavy development
|
#include <WorldState.h>
Public Member Functions | |
WorldState (const Divide::string &name="") noexcept | |
void | setVariable (const int var_id, const bool value) |
bool | getVariable (const int var_id) const |
bool | meetsGoal (const WorldState &goal_state) const |
int | distanceTo (const WorldState &goal_state) const |
bool | operator== (const WorldState &other) const |
string | toString () const |
Public Attributes | |
F32 | priority_ |
string | name_ |
hashMap< I32, bool > | vars_ |
Definition at line 13 of file WorldState.h.
|
explicitnoexcept |
Definition at line 8 of file WorldState.cpp.
I32 WorldState::distanceTo | ( | const WorldState & | goal_state | ) | const |
Given the other state – and what 'matters' to the other state – how many of our state variables differ from the other?
goal_state | the goal state to compare against |
Definition at line 44 of file WorldState.cpp.
bool WorldState::getVariable | ( | const int | var_id | ) | const |
Retrieve the current value of the given variable.
var_id | the unique ID of the state variable |
Definition at line 20 of file WorldState.cpp.
bool WorldState::meetsGoal | ( | const WorldState & | goal_state | ) | const |
Useful if this state is a goal state. It asks, does state 'other' meet the requirements of this goal? Takes into account not only this goal's state variables, but which variables matter to this goal state.
goal_state | the state you are testing as having met this goal state |
Definition at line 29 of file WorldState.cpp.
bool WorldState::operator== | ( | const WorldState & | other | ) | const |
Equality operator
other | the other worldstate to compare to |
Definition at line 25 of file WorldState.cpp.
void WorldState::setVariable | ( | const int | var_id, |
const bool | value | ||
) |
Set a world state variable, e.g. "gunLoaded" / true
var_id | the unique ID of the state variable |
value | the boolean value of the variable |
Definition at line 15 of file WorldState.cpp.
string WorldState::toString | ( | ) | const |
Definition at line 58 of file WorldState.cpp.
string Divide::goap::WorldState::name_ |
Definition at line 15 of file WorldState.h.
F32 Divide::goap::WorldState::priority_ |
Definition at line 14 of file WorldState.h.
Definition at line 16 of file WorldState.h.