1
This commit is contained in:
parent
bed1c91d66
commit
958e9a4b47
@ -60,7 +60,7 @@ void MapService::UnInit()
|
|||||||
CellNode,
|
CellNode,
|
||||||
entry);
|
entry);
|
||||||
list_del_init(&e->entry);
|
list_del_init(&e->entry);
|
||||||
delete e;
|
e->holder = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (map_cells_) {
|
if (map_cells_) {
|
||||||
|
@ -28,13 +28,13 @@ void MatchPool::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
MatchTeamNew* MatchPool::GetTeam(const std::string& team_uuid)
|
std::shared_ptr<MatchTeamNew> MatchPool::GetTeam(const std::string& team_uuid)
|
||||||
{
|
{
|
||||||
auto itr = team_hash_.find(team_uuid);
|
auto itr = team_hash_.find(team_uuid);
|
||||||
return itr != team_hash_.end() ? itr->second : nullptr;
|
return itr != team_hash_.end() ? itr->second : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MatchPool::TraverseTeam(std::function<void (MatchTeamNew*, bool&)> func)
|
void MatchPool::TraverseTeam(std::function<void (std::shared_ptr<MatchTeamNew>&, bool&)> func)
|
||||||
{
|
{
|
||||||
if (!func) {
|
if (!func) {
|
||||||
return;
|
return;
|
||||||
@ -54,7 +54,6 @@ void MatchPool::RemoveTeam(const std::string& team_uuid)
|
|||||||
{
|
{
|
||||||
auto itr = team_hash_.find(team_uuid);
|
auto itr = team_hash_.find(team_uuid);
|
||||||
if (itr != team_hash_.end()) {
|
if (itr != team_hash_.end()) {
|
||||||
delete itr->second;
|
|
||||||
team_hash_.erase(itr);
|
team_hash_.erase(itr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,18 +25,18 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void TraverseTeam(std::function<void (MatchTeamNew*, bool&)> func);
|
void TraverseTeam(std::function<void (std::shared_ptr<MatchTeamNew>&, bool&)> func);
|
||||||
|
|
||||||
bool NeedMatch(const cs::CMJoin& msg);
|
bool NeedMatch(const cs::CMJoin& msg);
|
||||||
MatchTeamNew* GetTeam(const std::string& team_uuid);
|
std::shared_ptr<MatchTeamNew> GetTeam(const std::string& team_uuid);
|
||||||
void RemoveTeam(const std::string& team_uuid);
|
void RemoveTeam(const std::string& team_uuid);
|
||||||
void RemoveSocket(int socket_handle);
|
void RemoveSocket(int socket_handle);
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
f8::Attacher timer_attacher_;
|
f8::Attacher timer_attacher_;
|
||||||
std::map<std::string, MatchTeamNew*> team_hash_;
|
std::map<std::string, std::shared_ptr<MatchTeamNew>> team_hash_;
|
||||||
std::map<int, std::tuple<std::string, MatchTeamNew*>> socket_hash_;
|
std::map<int, std::tuple<std::string, std::shared_ptr<MatchTeamNew>>> socket_hash_;
|
||||||
|
|
||||||
std::map<long long, std::shared_ptr<TeamGroup>> group_hash_;
|
std::map<long long, std::shared_ptr<TeamGroup>> group_hash_;
|
||||||
std::map<long long, std::shared_ptr<TeamGroup>> matching_list_;
|
std::map<long long, std::shared_ptr<TeamGroup>> matching_list_;
|
||||||
|
@ -376,7 +376,6 @@ void Room::AddPlayer(Player* hum, std::shared_ptr<BornPoint> init_born_point, bo
|
|||||||
Team* t = a->GetTeam();
|
Team* t = a->GetTeam();
|
||||||
leader->GetTeam()->CombineTeam(a->GetTeam());
|
leader->GetTeam()->CombineTeam(a->GetTeam());
|
||||||
team_hash_.erase(t->GetTeamId());
|
team_hash_.erase(t->GetTeamId());
|
||||||
delete t;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
leader = humans.at(3);
|
leader = humans.at(3);
|
||||||
@ -393,7 +392,6 @@ void Room::AddPlayer(Player* hum, std::shared_ptr<BornPoint> init_born_point, bo
|
|||||||
Team* t = a->GetTeam();
|
Team* t = a->GetTeam();
|
||||||
leader->GetTeam()->CombineTeam(a->GetTeam());
|
leader->GetTeam()->CombineTeam(a->GetTeam());
|
||||||
team_hash_.erase(t->GetTeamId());
|
team_hash_.erase(t->GetTeamId());
|
||||||
delete t;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user