This commit is contained in:
aozhiwei 2023-10-21 14:27:27 +08:00
parent eef2cd1972
commit 0764bba1b2
3 changed files with 15 additions and 9 deletions

View File

@ -2,6 +2,8 @@
#include "android_agent.h" #include "android_agent.h"
#include "human.h"
AndroidAgent::AndroidAgent():HeroAgent() AndroidAgent::AndroidAgent():HeroAgent()
{ {
@ -13,5 +15,9 @@ AndroidAgent::~AndroidAgent()
const std::string AndroidAgent::GetAccountId() const std::string AndroidAgent::GetAccountId()
{ {
if (owner_->IsHuman()) {
return owner_->AsHuman()->account_id;
} else {
return "";
}
} }

View File

@ -648,11 +648,11 @@ void HeroAgent::UnSetFlag(int tag)
a8::UnSetBitFlag(flags_, tag); a8::UnSetBitFlag(flags_, tag);
} }
behaviac::EBTStatus HeroAgent::StartCoroutine(std::shared_ptr<BtCoroutine> coroutine) behaviac::EBTStatus HeroAgent::StartCoroutine(std::shared_ptr<BtCoroutine> co)
{ {
coroutine_ = coroutine; coroutines_hash_[co->GetId()] = co;
status_ = behaviac::BT_RUNNING; list_add_tail(&coroutines_list_, &co->entry);
return status_; return behaviac::BT_RUNNING;
} }
behaviac::EBTStatus HeroAgent::RegisterEvents(behaviac::vector<BtEvent_e> events) behaviac::EBTStatus HeroAgent::RegisterEvents(behaviac::vector<BtEvent_e> events)

View File

@ -141,18 +141,18 @@ public:
protected: protected:
bool PreEnterCoroutine(int co_id, behaviac::EBTStatus& status); bool PreEnterCoroutine(int co_id, behaviac::EBTStatus& status);
behaviac::EBTStatus StartCoroutine(std::shared_ptr<BtCoroutine> coroutine); behaviac::EBTStatus StartCoroutine(std::shared_ptr<BtCoroutine> co);
bool InternalUseSkill(int skill_id, int& wait_time); bool InternalUseSkill(int skill_id, int& wait_time);
void CheckCoroutineEvent(); void CheckCoroutineEvent();
private:
Creature* owner_ = nullptr; Creature* owner_ = nullptr;
private:
bool bullet_trace_mode_ = false; bool bullet_trace_mode_ = false;
long long flags_ = 0; long long flags_ = 0;
std::map<int, int> dyn_hash_; std::map<int, int> dyn_hash_;
behaviac::EBTStatus status_= behaviac::BT_SUCCESS;
std::shared_ptr<BtCoroutine> coroutine_;
std::map<int, std::shared_ptr<BtCoroutine>> coroutines_hash_; std::map<int, std::shared_ptr<BtCoroutine>> coroutines_hash_;
list_head coroutines_list_; list_head coroutines_list_;
}; };