From 0020a8fcf619eb30d986d19e639111dd62419993 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 6 May 2023 11:55:20 +0800 Subject: [PATCH] 1 --- server/gameserver/room.cc | 9 +++++++-- server/gameserver/room.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 3520ec99..fae8f1c8 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -158,6 +158,10 @@ void Room::UnInit() delete pair.second; } team_hash_.clear(); + for (auto& pair : discard_team_hash_) { + delete pair.second; + } + discard_team_hash_.clear(); A8_SAFE_DELETE(frame_event_data); PerfMonitor::Instance()->alive_count -= alive_count_; } @@ -1881,8 +1885,9 @@ void Room::RandRemoveAndroid() } } if (hum) { - if (hum->team_id != 0) { - team_hash_.erase(hum->team_id); + if (hum->GetTeam()) { + team_hash_.erase(hum->GetTeam()->GetTeamId()); + discard_team_hash_[hum->GetTeam()->GetTeamId()] = hum->GetTeam(); } if (hum->born_point) { DecBornPointHumanNum(hum->born_point, hum); diff --git a/server/gameserver/room.h b/server/gameserver/room.h index 05155e48..81d96def 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -363,6 +363,7 @@ private: std::set refreshed_robot_set_; std::map team_hash_; std::map combineable_team_hash_; + std::map discard_team_hash_; std::map accountid_hash_; std::map moveable_hash_; std::map uniid_hash_;