16 Conditions _conditions;
17 CONDITION_PRINT_SUBCONDITIONS_GETCONDITIONNAMEWITHVALUE
20 explicit And(
const Conditions& conditions) :
21 ICondition(
"And",
""), _conditions(conditions) {
29 for (ConditionsIter i = _conditions.begin(); i != _conditions.end(); ++i) {
30 if (!(*i)->evaluate(entity)) {
39 inline ConditionPtr And::Factory::create(
const ConditionFactoryContext *ctx)
const {
40 if (ctx->conditions.size() < 2) {
41 return ConditionPtr();
43 return std::make_shared<And>(ctx->conditions);
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: And.h:28
This condition will logically and all contained conditions.
Definition: And.h:14