This commit is contained in:
aozhiwei 2023-12-06 15:43:11 +08:00
parent ff1dc417d8
commit b9530e1319
4 changed files with 21 additions and 2 deletions

View File

@ -2085,8 +2085,14 @@ void Room::RandRemoveAndroid()
}
if (hum) {
if (hum->team_id != 0) {
Team* team = GetTeam(hum->team_id);
if (team) {
team->RemoveMember(hum);
if (team->GetMemberNum() < 1) {
team_hash_.erase(hum->team_id);
}
}
}
if (hum->born_point) {
DecBornPointHumanNum(hum->born_point, hum);
}
@ -2102,6 +2108,9 @@ void Room::RandRemoveAndroid()
for (auto& pair : human_hash_) {
pair.second->RemovePartObjects(hum);
}
for (auto& pair : human_hash_) {
pair.second->RemoveObjects(hum);
}
frame_event.AddExitGame(hum->GetWeakPtrRef());
}
}

View File

@ -566,3 +566,12 @@ int Team::GetPlayerNum()
}
return num;
}
void Team::RemoveMember(Human* member)
{
members_.erase(member);
first_member_ = nullptr;
for (auto hum : members_) {
first_member_ = hum;
}
}

View File

@ -38,6 +38,7 @@ class Team
int GetAliveNum();
int GetAlivePlayerNum();
void AddMember(Human* member);
void RemoveMember(Human* member);
bool IsFull();
void CombineBornPoint();
void CombineTeam(Team* b_team);

View File

@ -181,7 +181,7 @@ behaviac::EBTStatus AndroidAgent::CoJoin()
msg.set_auto_fill(1);
msg.set_name("");
msg.set_avatar_url("");
msg.set_mapid(2007);
msg.set_mapid(2002);
msg.set_hero_id(30800);
//weapons
msg.set_session_id(owner_->GetSessionId());