1
This commit is contained in:
parent
ab8db13131
commit
e5f524d1c8
@ -16,12 +16,6 @@
|
||||
|
||||
#include "mt/Robot.h"
|
||||
|
||||
template<typename T>
|
||||
static auto SpToWp(std::shared_ptr<T> sp)
|
||||
{
|
||||
return std::weak_ptr<T>(sp);
|
||||
}
|
||||
|
||||
AndroidAgent::AndroidAgent():BaseAgent()
|
||||
{
|
||||
|
||||
@ -67,7 +61,7 @@ behaviac::EBTStatus AndroidAgent::DoRandomWalk()
|
||||
GetOwner()->GetTrigger()->AddListener
|
||||
(
|
||||
kAttacked,
|
||||
[context_wp = SpToWp(context)] (const a8::Args& args)
|
||||
[context_wp = a8::SpToWp(context)] (const a8::Args& args)
|
||||
{
|
||||
if (!context_wp.expired()) {
|
||||
auto context = context_wp.lock();
|
||||
|
@ -19,12 +19,6 @@
|
||||
#include "mt/Hero.h"
|
||||
#include "mt/Param.h"
|
||||
|
||||
template<typename T>
|
||||
static auto SpToWp(std::shared_ptr<T> sp)
|
||||
{
|
||||
return std::weak_ptr<T>(sp);
|
||||
}
|
||||
|
||||
void DumpBt(BaseAgent* agent)
|
||||
{
|
||||
static std::string last_bt_name;
|
||||
@ -264,7 +258,7 @@ behaviac::EBTStatus BaseAgent::DoIdle(int min_time, int max_time)
|
||||
GetOwner()->GetTrigger()->AddListener
|
||||
(
|
||||
kAttacked,
|
||||
[context_wp = SpToWp(context)] (const a8::Args& args)
|
||||
[context_wp = a8::SpToWp(context)] (const a8::Args& args)
|
||||
{
|
||||
if (!context_wp.expired()) {
|
||||
auto context = context_wp.lock();
|
||||
|
@ -18,6 +18,15 @@ context->owner = owner; \
|
||||
return context; \
|
||||
}(GetOwner()->GetWeakPtrRef(), this)
|
||||
|
||||
namespace a8
|
||||
{
|
||||
template<typename T>
|
||||
static auto SpToWp(std::shared_ptr<T> sp)
|
||||
{
|
||||
return std::weak_ptr<T>(sp);
|
||||
}
|
||||
}
|
||||
|
||||
struct BtCoroutine;
|
||||
class Creature;
|
||||
class BaseAgent : public behaviac::Agent
|
||||
|
@ -18,12 +18,6 @@
|
||||
#include "mt/Map.h"
|
||||
#include "mt/Hero.h"
|
||||
|
||||
template<typename T>
|
||||
static auto SpToWp(std::shared_ptr<T> sp)
|
||||
{
|
||||
return std::weak_ptr<T>(sp);
|
||||
}
|
||||
|
||||
HeroAgent::HeroAgent():BaseAgent()
|
||||
{
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user