14 #define TASK_CLASS_CTOR(TaskName) \
15 TaskName(const std::string& name, const std::string& parameters, const ::ai::ConditionPtr& condition) : \
16 ::ai::ITask(name, parameters, condition)
20 #define TASK_CLASS_DTOR(TaskName) virtual ~TaskName()
25 #define TASK_CLASS(TaskName) \
26 TASK_CLASS_CTOR(TaskName) {}\
27 TASK_CLASS_DTOR(TaskName) {}
35 TreeNodeStatus
execute(
const AIPtr& entity, int64_t deltaMillis)
override {
43 return state(entity,
doAction(entity, deltaMillis));
46 ai_log_error(
"Exception while running task %s of type %s", _name.c_str(), _type.c_str());
48 return state(entity, EXCEPTION);
52 ITask(
const std::string& name,
const std::string& parameters,
const ConditionPtr& condition) :
53 TreeNode(name, parameters, condition) {
63 virtual TreeNodeStatus
doAction(
const AIPtr& entity, int64_t deltaMillis) = 0;
65 bool addChild(
const TreeNodePtr& )
override {
A node for your real actions in the behaviour tree.
Definition: ITask.h:33
TreeNodeStatus execute(const AIPtr &entity, int64_t deltaMillis) override
Definition: ITask.h:35
#define ai_log_error(...)
Logging macro to provide your own loggers.
Definition: Types.h:23
virtual TreeNodeStatus execute(const AIPtr &entity, int64_t deltaMillis)
Definition: TreeNodeImpl.h:184
The base class for all behaviour tree actions.
Definition: TreeNode.h:88
virtual TreeNodeStatus doAction(const AIPtr &entity, int64_t deltaMillis)=0