From 8268c1519ba92b5c3ec4cd91fa535451040d0f74 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 5 Apr 2023 15:37:47 +0800 Subject: [PATCH] 1 --- server/gameserver/base_agent.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/server/gameserver/base_agent.cc b/server/gameserver/base_agent.cc index 30f18a02..de95812c 100644 --- a/server/gameserver/base_agent.cc +++ b/server/gameserver/base_agent.cc @@ -60,10 +60,10 @@ void BaseAgent::Exec() coroutine_->event_cb(true, has_event); if (has_event) { status_= behaviac::BT_INVALID; - coroutine_->runing_cb = nullptr; - coroutine_->event_cb(false, has_event); - coroutine_->event_cb = nullptr; + auto old_coroutine = coroutine_; coroutine_ = nullptr; + old_coroutine->event_cb(false, has_event); + old_coroutine = nullptr; #ifdef DEBUG1 a8::XPrintf("FireEvent OnAttacked\n", {}); #endif @@ -100,7 +100,7 @@ behaviac::EBTStatus BaseAgent::StartCoroutine(std::shared_ptr corou { coroutine_ = coroutine; #ifdef DEBUG - last_status_ = behaviac::BT_INVALID;d + last_status_ = behaviac::BT_INVALID; status_frameno_ = GetOwner()->room->GetFrameNo(); status_name_ = coroutine_->name; #endif @@ -270,4 +270,3 @@ behaviac::EBTStatus BaseAgent::DoIdle(int min_time, int max_time) }; return StartCoroutine(co); } ->