From 6232a64cdb8d6239410d6a90b6e17436f13cc060 Mon Sep 17 00:00:00 2001 From: Kinglykrab <89047260+Kinglykrab@users.noreply.github.com> Date: Sat, 20 Aug 2022 04:15:58 -0400 Subject: [PATCH] [Bug Fix] Fix Bot Group Loading (#2366) * [Bug Fix] Fix Bot Group Loading There were some weird cases where this code would falsely say a bot group did not exist and this would disallow summoning this botgroup as well as deleting it. * Typo. --- zone/bot_command.cpp | 28 ++-------------------------- zone/bot_database.cpp | 17 +++-------------- zone/bot_database.h | 2 +- 3 files changed, 6 insertions(+), 41 deletions(-) diff --git a/zone/bot_command.cpp b/zone/bot_command.cpp index 870d440b5..0de652e28 100644 --- a/zone/bot_command.cpp +++ b/zone/bot_command.cpp @@ -7020,19 +7020,7 @@ void bot_subcommand_botgroup_create(Client *c, const Seperator *sep) return; } - bool extant_flag = false; - if (!database.botdb.QueryBotGroupExistence(botgroup_name, extant_flag)) { - c->Message( - Chat::White, - fmt::format( - "Failed to query bot-group existence for '{}'.", - botgroup_name - ).c_str() - ); - return; - } - - if (extant_flag) { + if (database.botdb.QueryBotGroupExistence(botgroup_name)) { c->Message( Chat::White, fmt::format( @@ -7360,8 +7348,7 @@ void bot_subcommand_botgroup_load(Client *c, const Seperator *sep) return; } - bool extant_flag = false; - if (!database.botdb.QueryBotGroupExistence(botgroup_name, extant_flag)) { + if (!database.botdb.QueryBotGroupExistence(botgroup_name)) { c->Message( Chat::White, fmt::format( @@ -7372,17 +7359,6 @@ void bot_subcommand_botgroup_load(Client *c, const Seperator *sep) return; } - if (!extant_flag) { - c->Message( - Chat::White, - fmt::format( - "Bot-group {} does not exist.", - botgroup_name - ).c_str() - ); - return; - } - auto* owner_group = c->GetGroup(); if (owner_group) { std::list member_list; diff --git a/zone/bot_database.cpp b/zone/bot_database.cpp index 0ffa1b05f..464e0bd70 100644 --- a/zone/bot_database.cpp +++ b/zone/bot_database.cpp @@ -2328,7 +2328,7 @@ bool BotDatabase::SaveOwnerOption(const uint32 owner_id, const std::pair type, const std::pair flag); /* Bot bot-group functions */ - bool QueryBotGroupExistence(const std::string& botgroup_name, bool& extant_flag); + bool QueryBotGroupExistence(const std::string& botgroup_name); bool LoadBotGroupIDByBotGroupName(const std::string& botgroup_name, uint32& botgroup_id); bool LoadBotGroupIDByLeaderID(const uint32 leader_id, uint32& botgroup_id);