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); } ->