This commit is contained in:
aozhiwei 2023-10-14 16:24:56 +08:00
parent a79aca1198
commit 3f1338cc7f
4 changed files with 28 additions and 0 deletions

View File

@ -1,6 +1,9 @@
#include "precompile.h"
#include <a8/mutable_xobject.h>
#include <f8/btmgr.h>
#include "team.h"
#include "human.h"
@ -12,6 +15,7 @@
#include "jsondatamgr.h"
#include "httpproxy.h"
#include "roommgr.h"
#include "team_agent.h"
#include "mt/Param.h"
#include "mt/Map.h"
@ -20,6 +24,18 @@
#include "mt/PveGeminiMode.h"
#include "mt/PveGeminiContent.h"
Team::Team()
{
team_agent_ = behaviac::Agent::Create<TeamAgent>();
team_agent_->SetTeam(this);
}
Team::~Team()
{
f8::BtMgr::Instance()->BtDestory(team_agent_);
team_agent_ = nullptr;
}
void Team::TraverseMembers(std::function<bool (Human*)> func)
{
for (Human* member : members_) {

View File

@ -12,6 +12,7 @@ namespace a8
class Room;
class Human;
class TeamAgent;
class Team
{
public:
@ -22,6 +23,8 @@ class Team
bool sending_battlereport = false;
bool already_report_battle = false;
Team();
~Team();
void SetInitTeamMemberNum(int init_num) { init_team_member_num_ = init_num; };
void SetAutoFill(bool auto_fill) { auto_fill_ = auto_fill; };
bool IsAutoFill() { return auto_fill_; };
@ -68,4 +71,5 @@ class Team
bool auto_fill_ = false;
int kill_count_ = 0;
long long last_kill_frameno_ = 0;
TeamAgent* team_agent_ = nullptr;
};

View File

@ -32,3 +32,8 @@ void TeamAgent::SetTeam(Team* team)
{
team_ = team;
}
Room* TeamAgent::GetRoom()
{
return team_->room;
}

View File

@ -2,6 +2,7 @@
#include "new_base_agent.h"
class Room;
class Team;
class TeamAgent : public BaseAgent
{
@ -17,6 +18,8 @@ public:
int GetAlivePlayerNum();
void SetTeam(Team* team);
Room* GetRoom();
private:
Team* team_ = nullptr;
};