diff --git a/server/gameserver/base_agent.cc b/server/gameserver/base_agent.cc index 5887ebfc..9719a672 100644 --- a/server/gameserver/base_agent.cc +++ b/server/gameserver/base_agent.cc @@ -77,7 +77,10 @@ bool BaseAgent::PreEnterCoroutine(int co_id, behaviac::EBTStatus& status) } auto& co = itr->second; if (co->status != behaviac::BT_RUNNING) { +#ifdef DEBUG abort(); +#endif + return true; } co->status = co->runing_cb(co.get()); status = co->status; @@ -182,6 +185,9 @@ void BaseAgent::AbortCoroutine(int co_id) { auto itr = coroutines_hash_.find(co_id); if (itr != coroutines_hash_.end()) { - itr->second->Abort(GetRoom()->GetFrameNo()); + if (!itr->second->IsAbort()) { + itr->second->Abort(GetRoom()->GetFrameNo()); + itr->second->runing_cb(itr->second.get()); + } } } diff --git a/server/gameserver/hero_agent.cc b/server/gameserver/hero_agent.cc index fc664ecb..7cb9f809 100644 --- a/server/gameserver/hero_agent.cc +++ b/server/gameserver/hero_agent.cc @@ -522,6 +522,7 @@ behaviac::EBTStatus HeroAgent::CoFindPath(const glm::vec3& pos) [this, context, pos] (BtCoroutine* co) { if (co->IsAbort()) { + owner_->GetMovement()->ClearPath(); return behaviac::BT_FAILURE; } if (owner_->dead) { @@ -559,6 +560,7 @@ behaviac::EBTStatus HeroAgent::CoFindPathEx(const glm::vec3& pos, float distance [this, context, distance] (BtCoroutine* co) { if (co->IsAbort()) { + owner_->GetMovement()->ClearPath(); return behaviac::BT_FAILURE; } if (owner_->dead) {