diff --git a/server/gameserver/custom_battle.cc b/server/gameserver/custom_battle.cc index 3738fabe..1d9bff76 100644 --- a/server/gameserver/custom_battle.cc +++ b/server/gameserver/custom_battle.cc @@ -40,6 +40,7 @@ void CustomBattle::ParseResult(a8::XObject& obj) return; } std::string team_uuid = team_obj->Get("team_uuid").GetString(); + int is_view = team_obj->Get("is_view").GetInt(); auto member_list = team_obj->At("members"); if (!member_list || !member_list->IsArray()) { @@ -50,6 +51,7 @@ void CustomBattle::ParseResult(a8::XObject& obj) if (!team) { team = std::make_shared(); team->team_uuid_ = team_uuid; + team->is_view_ = is_view ? true : false; uuid_hash_[team->team_uuid_] = team; } for (int ii = 0; ii < member_list->Size(); ++ii) { diff --git a/server/gameserver/custom_member.cc b/server/gameserver/custom_member.cc index c783e781..30498306 100644 --- a/server/gameserver/custom_member.cc +++ b/server/gameserver/custom_member.cc @@ -12,3 +12,8 @@ void CustomMember::Join(Player* hum) joined_ = true; join_time_ = Global::g_nowtime; } + +bool CustomMember::IsView() +{ + return team_->IsView(); +} diff --git a/server/gameserver/custom_member.h b/server/gameserver/custom_member.h index 0f153d8a..8d031591 100644 --- a/server/gameserver/custom_member.h +++ b/server/gameserver/custom_member.h @@ -11,7 +11,7 @@ class CustomMember CustomTeam* GetTeam() { return team_; } bool IsJoined() { return joined_; } int GetJoinTime() { return join_time_; } - bool IsViewer() { return is_viewer_; } + bool IsView(); const std::string& GetAccountId() { return account_id_; } const std::string& GetSessionId() { return session_id_; } std::shared_ptr& GetNetData() { return battle_context_; }; @@ -20,7 +20,6 @@ class CustomMember CustomTeam *team_ = nullptr; bool joined_ = false; int join_time_ = 0; - bool is_viewer_ = false; std::string account_id_; std::string session_id_; std::shared_ptr battle_context_; diff --git a/server/gameserver/custom_team.h b/server/gameserver/custom_team.h index f9896790..2d3a9dab 100644 --- a/server/gameserver/custom_team.h +++ b/server/gameserver/custom_team.h @@ -7,9 +7,11 @@ class CustomTeam const std::string& GetTeamUuid() { return team_uuid_; } std::shared_ptr GetMember(const std::string& account_id); + bool IsView() { return is_view_; } private: std::string team_uuid_; + bool is_view_ = false; std::map> member_hash_; friend class CustomBattle; };