1
This commit is contained in:
parent
2b021debe3
commit
bb70c6cffe
@ -9,15 +9,12 @@ class BtContext : public std::enable_shared_from_this<BtContext>
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
virtual ~BtContext();
|
virtual ~BtContext();
|
||||||
void SetOwner(CreatureWeakPtr owner) { owner_ = owner;}
|
|
||||||
CreatureWeakPtr GetOwner() { return owner_; }
|
|
||||||
void AddHandler(CreatureWeakPtr target, std::weak_ptr<EventHandlerPtr> handler);
|
void AddHandler(CreatureWeakPtr target, std::weak_ptr<EventHandlerPtr> handler);
|
||||||
void AddEvent(std::shared_ptr<BtEvent> event);
|
void AddEvent(std::shared_ptr<BtEvent> event);
|
||||||
bool HasEvent();
|
bool HasEvent();
|
||||||
void FireEvent(BaseAgent* agent);
|
void FireEvent(BaseAgent* agent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CreatureWeakPtr owner_;
|
|
||||||
std::vector<std::shared_ptr<BtEvent>> events_;
|
std::vector<std::shared_ptr<BtEvent>> events_;
|
||||||
std::vector<std::tuple<CreatureWeakPtr, std::weak_ptr<EventHandlerPtr>>> handlers_;
|
std::vector<std::tuple<CreatureWeakPtr, std::weak_ptr<EventHandlerPtr>>> handlers_;
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ class Context : public BtContext \
|
|||||||
~Context() { if (_destory_cb) { _destory_cb(); };}; \
|
~Context() { if (_destory_cb) { _destory_cb(); };}; \
|
||||||
}; \
|
}; \
|
||||||
auto context = std::make_shared<Context>(); \
|
auto context = std::make_shared<Context>(); \
|
||||||
context->SetOwner(owner); \
|
|
||||||
context->frameno = owner.Get()->room->GetFrameNo(); \
|
context->frameno = owner.Get()->room->GetFrameNo(); \
|
||||||
return context; \
|
return context; \
|
||||||
}(owner_->GetWeakPtrRef(), this)
|
}(owner_->GetWeakPtrRef(), this)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user