From e695f1c499c3aa790f62f7ed17222f8e1506be8f Mon Sep 17 00:00:00 2001 From: nytmyr <53322305+nytmyr@users.noreply.github.com> Date: Thu, 30 Jan 2025 22:38:03 -0600 Subject: [PATCH] Return for GetRawBotList This checks offline bots too --- zone/groups.cpp | 16 +++++++--------- zone/groups.h | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) 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();