|
engine-mk1
|
Represents a world state property, condition or modifier in a format interpretable by the planner. More...
#include <Planner.hpp>
Public Types | |
| using | ConditionValue = std::variant< bool, int > |
Public Member Functions | |
| Condition (std::string id, std::string type, ConditionValue value, Operation op=Operation::NONE, int weight=1) | |
| bool | operator== (const Condition &rhs) const noexcept |
| void | apply (const Condition &modifier) |
| Applies a modifier to this property. More... | |
| template<typename T > | |
| void | apply (T &v, const Condition &modifier) |
| void | apply (bool &v, const Condition &modifier) |
| bool | satisfies (const Condition &condition) const |
| template<typename T > | |
| bool | satisfies (const Condition &condition) const |
| int | distToSatisfy (const Condition &condition) const |
| template<typename T > | |
| int | distToSatisfy (const Condition &condition) const |
| void | zero () noexcept |
Public Attributes | |
| std::size_t | id |
A hashed std::string denoting the property owner. More... | |
| std::size_t | type |
A hashed std::string denoting the property type. More... | |
| ConditionValue | value |
A std::variant denoting the value off the property. More... | |
| Operation | op |
| The Operation used to evaluate or apply a condition. More... | |
| int | weight |
| A weight applied to the result of distToSatisfy. More... | |
| std::string | debugID |
| std::string | debugType |
Represents a world state property, condition or modifier in a format interpretable by the planner.
Properties have an op value of Operation::NONE while all other op values denote a condition or modifier.
|
inline |
Applies a modifier to this property.
Can also be used to add conditions (e.g. x>2 + x>4 = x>6). Follows the format: this.value modifier.op modifier.value. E.g. If this.value = 5, modifier.op = Operation::PLUS and modifier.value = 2 the function would perform this.value = 5 + 2.
| modifier | The modifier to apply to this condition or property. |
| std::size_t rz::planner::Condition::id |
A hashed std::string denoting the property owner.
| Operation rz::planner::Condition::op |
The Operation used to evaluate or apply a condition.
| std::size_t rz::planner::Condition::type |
A hashed std::string denoting the property type.
| ConditionValue rz::planner::Condition::value |
A std::variant denoting the value off the property.
| int rz::planner::Condition::weight |
A weight applied to the result of distToSatisfy.
1.8.11