16 Conditions _conditions;
17 CONDITION_PRINT_SUBCONDITIONS_GETCONDITIONNAMEWITHVALUE
20 explicit Or(
const Conditions& conditions) :
21 ICondition(
"Or",
""), _conditions(conditions) {
29 for (ConditionsIter i = _conditions.begin(); i != _conditions.end(); ++i) {
30 if ((*i)->evaluate(entity)) {
39 inline ConditionPtr Or::Factory::create(
const ConditionFactoryContext *ctx)
const {
40 if (ctx->conditions.size() < 2) {
41 return ConditionPtr();
43 return std::make_shared<Or>(ctx->conditions);
This condition will logically or all contained conditions.
Definition: Or.h:14
A condition can be placed on a TreeNode to decide which node is going to get executed. In general they are stateless. If they are not, it should explicitly get noted.
Definition: ICondition.h:124
#define CONDITION_FACTORY_NO_IMPL(ConditionName)
A condition factory macro to ease and unify the registration at AIRegistry. You still have to impleme...
Definition: ICondition.h:41
bool evaluate(const AIPtr &entity) override
Checks whether the condition evaluates to true for the given entity.
Definition: Or.h:28