diff --git a/zone/groups.cpp b/zone/groups.cpp index f040e8d91..6e5d2c489 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1017,11 +1017,9 @@ void Group::GetBotList(std::list& bot_list, bool clear_list) } } -void Group::GetRawBotList(std::list& bot_list, bool clear_list) +std::list Group::GetRawBotList() { - if (clear_list) { - bot_list.clear(); - } + std::list bot_list; const auto& l = GroupIdRepository::GetWhere( database, @@ -1032,10 +1030,12 @@ void Group::GetRawBotList(std::list& bot_list, bool clear_list) ); for (const auto& e : l) { - if (e.bot_id) { + if (e.bot_id) { bot_list.push_back(e.bot_id); } } + + return bot_list; } bool Group::Process() { @@ -1263,8 +1263,7 @@ void Client::LeaveGroup() { } if (RuleB(Bots, Enabled)) { - std::list sbl; - g->GetRawBotList(sbl); + std::list sbl = g->GetRawBotList(); for (auto botID : sbl) { auto b = entity_list.GetBotByBotID(botID); @@ -2618,8 +2617,7 @@ void Group::AddToGroup(AddToGroupRequest r) } void Group::RemoveClientsBots(Client* c) { - std::list sbl; - GetRawBotList(sbl); + std::list sbl = GetRawBotList(); for (auto botID : sbl) { auto b = entity_list.GetBotByBotID(botID); diff --git a/zone/groups.h b/zone/groups.h index 9a49b7d3c..91fcee13e 100644 --- a/zone/groups.h +++ b/zone/groups.h @@ -69,7 +69,7 @@ public: void GetMemberList(std::list& member_list, bool clear_list = true); void GetClientList(std::list& client_list, bool clear_list = true); void GetBotList(std::list& bot_list, bool clear_list = true); - void GetRawBotList(std::list& bot_list, bool clear_list = true); + std::list GetRawBotList(); bool IsGroupMember(Mob* c); bool IsGroupMember(const char* name); bool Process();