diff --git a/server/gameserver/ai/android/do_random_shot.cc b/server/gameserver/ai/android/do_random_shot.cc index a5c7f7b1..98b97528 100644 --- a/server/gameserver/ai/android/do_random_shot.cc +++ b/server/gameserver/ai/android/do_random_shot.cc @@ -50,7 +50,7 @@ behaviac::EBTStatus AndroidAgent::DoRandomShot() GetOwner()->GetTrigger()->AddListener ( kAttacked, - [context_wp = context->GetWp()] (const a8::Args& args) + [context_wp = a8::SpToWp(context)] (const a8::Args& args) { if (!context_wp.expired()) { auto context = context_wp.lock(); diff --git a/server/gameserver/ai/hero/do_attack.cc b/server/gameserver/ai/hero/do_attack.cc index a4bbb0ae..3dd3cdab 100644 --- a/server/gameserver/ai/hero/do_attack.cc +++ b/server/gameserver/ai/hero/do_attack.cc @@ -54,7 +54,7 @@ behaviac::EBTStatus HeroAgent::DoAttack() GetOwner()->AsHero()->master.Get()->GetTrigger()->AddListener ( kBulletHitEvent, - [context_wp = context->GetWp()] (const a8::Args& args) + [context_wp = a8::SpToWp(context)] (const a8::Args& args) { if (!context_wp.expired()) { auto context = context_wp.lock(); diff --git a/server/gameserver/ai/hero/do_random_shot.cc b/server/gameserver/ai/hero/do_random_shot.cc index cced9d77..bce946f8 100644 --- a/server/gameserver/ai/hero/do_random_shot.cc +++ b/server/gameserver/ai/hero/do_random_shot.cc @@ -37,7 +37,7 @@ behaviac::EBTStatus HeroAgent::DoRandomShot() GetOwner()->GetTrigger()->AddListener ( kAttacked, - [context_wp = context->GetWp()] (const a8::Args& args) + [context_wp = a8::SpToWp(context)] (const a8::Args& args) { if (!context_wp.expired()) { auto context = context_wp.lock(); diff --git a/server/gameserver/ai/hero/do_random_walk.cc b/server/gameserver/ai/hero/do_random_walk.cc index b6b416d6..eaf43210 100644 --- a/server/gameserver/ai/hero/do_random_walk.cc +++ b/server/gameserver/ai/hero/do_random_walk.cc @@ -36,7 +36,7 @@ behaviac::EBTStatus HeroAgent::DoRandomWalk() GetOwner()->GetTrigger()->AddListener ( kAttacked, - [context_wp = context->GetWp()] (const a8::Args& args) + [context_wp = a8::SpToWp(context)] (const a8::Args& args) { if (!context_wp.expired()) { auto context = context_wp.lock(); diff --git a/server/gameserver/btcontext.h b/server/gameserver/btcontext.h index ac20dfe0..f99de572 100644 --- a/server/gameserver/btcontext.h +++ b/server/gameserver/btcontext.h @@ -13,7 +13,6 @@ public: virtual ~BtContext(); void AddHandler(CreatureWeakPtr target, std::weak_ptr handler); - std::weak_ptr GetWp() { return shared_from_this();}; private: };