From 5113415d5cfdca0cfacb7ee3443337caa3b6f96b Mon Sep 17 00:00:00 2001 From: neckkola <65987027+neckkola@users.noreply.github.com> Date: Thu, 3 Feb 2022 20:20:23 -0400 Subject: [PATCH] Update p_raid_instance --- zone/bot.cpp | 19 ++++++++++--------- zone/client_packet.cpp | 1 + zone/raids.cpp | 1 + 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index e2628a34e..bfd17530d 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3994,7 +3994,15 @@ void Bot::Depop() { entity_list.RemoveFromHateLists(this); if(HasGroup()) Bot::RemoveBotFromGroup(this, GetGroup()); - + + //Mitch + Raid* bot_raid = entity_list.GetRaidByBotName(this->GetName()); + if (bot_raid) { + uint32 gid = bot_raid->GetGroup(this->GetName()); + bot_raid->SendRaidGroupRemove(this->GetName(), bot_raid->GetGroup(this->GetName())); + bot_raid->RemoveMember(this->GetName()); + bot_raid->GroupUpdate(gid); + } if(HasPet()) GetPet()->Depop(); @@ -8426,14 +8434,7 @@ void Bot::Camp(bool databaseSave) { if(GetGroup()) RemoveBotFromGroup(this, GetGroup()); - //Mitch - Raid* bot_raid = entity_list.GetRaidByBotName(this->GetName()); - if (bot_raid) { - uint32 gid = bot_raid->GetGroup(this->GetName()); - bot_raid->SendRaidGroupRemove(this->GetName(), bot_raid->GetGroup(this->GetName())); - bot_raid->RemoveMember(this->GetName()); - bot_raid->GroupUpdate(gid); - } + // RemoveBotFromGroup() code is too complicated for this to work as-is (still needs to be addressed to prevent memory leaks) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 9ff37b676..2fb9f99b8 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -587,6 +587,7 @@ void Client::CompleteConnect() if (b) { b->SetRaidGrouped(true); + b->p_raid_instance = raid; //b->SetFollowID(this->GetID()); } } diff --git a/zone/raids.cpp b/zone/raids.cpp index 116f55b65..62c7aa91d 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -209,6 +209,7 @@ void Raid::AddBot(Bot* b, uint32 group, bool rleader, bool groupleader, bool loo SendRaidAddAll(b->GetName()); b->SetRaidGrouped(true); + b->p_raid_instance = this; //SendRaidMOTD(b->GetOwner()->CastToClient()); // Mitch What to do here?