mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[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.
This commit is contained in:
+3
-14
@@ -2328,7 +2328,7 @@ bool BotDatabase::SaveOwnerOption(const uint32 owner_id, const std::pair<size_t,
|
||||
|
||||
|
||||
/* Bot bot-group functions */
|
||||
bool BotDatabase::QueryBotGroupExistence(const std::string& group_name, bool& extant_flag)
|
||||
bool BotDatabase::QueryBotGroupExistence(const std::string& group_name)
|
||||
{
|
||||
if (group_name.empty()) {
|
||||
return false;
|
||||
@@ -2340,16 +2340,10 @@ bool BotDatabase::QueryBotGroupExistence(const std::string& group_name, bool& ex
|
||||
);
|
||||
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
if (!results.Success() || !results.RowCount()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!results.RowCount()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
extant_flag = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2541,15 +2535,10 @@ bool BotDatabase::CreateBotGroup(const std::string& group_name, const uint32 lea
|
||||
return false;
|
||||
}
|
||||
|
||||
bool extant_flag = false;
|
||||
if (!QueryBotGroupExistence(group_name, extant_flag)) {
|
||||
if (QueryBotGroupExistence(group_name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (extant_flag) {
|
||||
return true;
|
||||
}
|
||||
|
||||
query = fmt::format(
|
||||
"INSERT INTO `bot_groups` (`group_leader_id`, `group_name`) VALUES ({}, '{}')",
|
||||
leader_id,
|
||||
|
||||
Reference in New Issue
Block a user