This commit is contained in:
aozhiwei 2023-11-04 21:50:12 +08:00
parent 3d9d01a0f1
commit 19f31f7dea
12 changed files with 33 additions and 17 deletions

View File

@ -7,7 +7,7 @@ class AndroidAgent : public HeroAgent
public: public:
AndroidAgent(); AndroidAgent();
virtual ~AndroidAgent(); virtual ~AndroidAgent() override;
BEHAVIAC_DECLARE_AGENTTYPE(AndroidAgent, HeroAgent) BEHAVIAC_DECLARE_AGENTTYPE(AndroidAgent, HeroAgent)

View File

@ -5,14 +5,16 @@
#include <f8/btmgr.h> #include <f8/btmgr.h>
#include "room.h" #include "room.h"
#include "perft.h"
BaseAgent::BaseAgent():behaviac::Agent() BaseAgent::BaseAgent():behaviac::Agent()
{ {
++Perf::Instance()->agent_num;
} }
BaseAgent::~BaseAgent() BaseAgent::~BaseAgent()
{ {
--Perf::Instance()->agent_num;
} }
bool BaseAgent::IsGameOver() bool BaseAgent::IsGameOver()

View File

@ -6,6 +6,21 @@
#include "base_agent.h" #include "base_agent.h"
#include "btcontext.h" #include "btcontext.h"
#include "btevent.h" #include "btevent.h"
#include "perft.h"
BtCoroutine::BtCoroutine(std::shared_ptr<BtContext> context, int id, const char* name)
{
context_ = context;
id_ = id;
name_ = name;
INIT_LIST_HEAD(&entry);
++Perf::Instance()->bt_co_num;
}
BtCoroutine::~BtCoroutine()
{
--Perf::Instance()->bt_co_num;
}
void BtCoroutine::Abort(long long frameno) void BtCoroutine::Abort(long long frameno)
{ {

View File

@ -17,13 +17,8 @@ class BtCoroutine
long long abort_frameno = 0; long long abort_frameno = 0;
behaviac::EBTStatus status = behaviac::BT_RUNNING; behaviac::EBTStatus status = behaviac::BT_RUNNING;
BtCoroutine(std::shared_ptr<BtContext> context, int id, const char* name) BtCoroutine(std::shared_ptr<BtContext> context, int id, const char* name);
{ virtual ~BtCoroutine();
context_ = context;
id_ = id;
name_ = name;
INIT_LIST_HEAD(&entry);
}
const char* GetName() const { return name_; } const char* GetName() const { return name_; }
auto GetContext() { return context_; } auto GetContext() { return context_; }

View File

@ -18,6 +18,7 @@
#include "glmhelper.h" #include "glmhelper.h"
#include "pbutils.h" #include "pbutils.h"
#include "creature.h" #include "creature.h"
#include "perf.h"
#include "mt/Param.h" #include "mt/Param.h"
#include "mt/Buff.h" #include "mt/Buff.h"
@ -27,12 +28,12 @@
Buff::Buff() Buff::Buff()
{ {
++Perf::Instance()->buff_num;
} }
Buff::~Buff() Buff::~Buff()
{ {
int i = 0; --Perf::Instance()->buff_num;
} }
void Buff::Init() void Buff::Init()

View File

@ -39,7 +39,7 @@ class Buff
std::shared_ptr<std::vector<float>> buff_vars; std::shared_ptr<std::vector<float>> buff_vars;
Buff(); Buff();
~Buff(); virtual ~Buff();
void Init(); void Init();
void UnInit(); void UnInit();
int GetLeftTime(); int GetLeftTime();

View File

@ -5,14 +5,17 @@
#include "human.h" #include "human.h"
#include "app.h" #include "app.h"
#include "perfmonitor.h" #include "perfmonitor.h"
#include "perft.h"
Entity::Entity() Entity::Entity()
{ {
entity_weak_ptr_chunk_.Set(this); entity_weak_ptr_chunk_.Set(this);
++Perf::Instance()->entity_num;
} }
Entity::~Entity() Entity::~Entity()
{ {
--Perf::Instance()->entity_num;
} }
void Entity::Initialize() void Entity::Initialize()

View File

@ -21,7 +21,7 @@ class HeroAgent : public BaseAgent
public: public:
HeroAgent(); HeroAgent();
virtual ~HeroAgent(); virtual ~HeroAgent() override;
BEHAVIAC_DECLARE_AGENTTYPE(HeroAgent, BaseAgent) BEHAVIAC_DECLARE_AGENTTYPE(HeroAgent, BaseAgent)

View File

@ -9,7 +9,7 @@ class MasterAgent : public BaseAgent
public: public:
MasterAgent(); MasterAgent();
virtual ~MasterAgent(); virtual ~MasterAgent() override;
BEHAVIAC_DECLARE_AGENTTYPE(MasterAgent, BaseAgent) BEHAVIAC_DECLARE_AGENTTYPE(MasterAgent, BaseAgent)

View File

@ -9,7 +9,7 @@ class RoomAgent : public BaseAgent
public: public:
RoomAgent(); RoomAgent();
virtual ~RoomAgent(); virtual ~RoomAgent() override;
BEHAVIAC_DECLARE_AGENTTYPE(RoomAgent, BaseAgent) BEHAVIAC_DECLARE_AGENTTYPE(RoomAgent, BaseAgent)

View File

@ -9,7 +9,7 @@ class TargetAgent : public BaseAgent
public: public:
TargetAgent(); TargetAgent();
virtual ~TargetAgent(); virtual ~TargetAgent() override;
BEHAVIAC_DECLARE_AGENTTYPE(TargetAgent, BaseAgent) BEHAVIAC_DECLARE_AGENTTYPE(TargetAgent, BaseAgent)

View File

@ -9,7 +9,7 @@ class TeamAgent : public BaseAgent
public: public:
TeamAgent(); TeamAgent();
virtual ~TeamAgent(); virtual ~TeamAgent() override;
BEHAVIAC_DECLARE_AGENTTYPE(TeamAgent, BaseAgent) BEHAVIAC_DECLARE_AGENTTYPE(TeamAgent, BaseAgent)