Core/Groups: Move scattered group object deletion to Disband()
This commit is contained in:
@@ -1034,7 +1034,6 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
|||||||
if (!group->RemoveMember(guid)) // group was disbanded
|
if (!group->RemoveMember(guid)) // group was disbanded
|
||||||
{
|
{
|
||||||
SetBgRaid(team, NULL);
|
SetBgRaid(team, NULL);
|
||||||
delete group;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DecreaseInvitedCount(team);
|
DecreaseInvitedCount(team);
|
||||||
|
|||||||
@@ -2647,27 +2647,21 @@ void Player::UninviteFromGroup()
|
|||||||
if (group->IsCreated())
|
if (group->IsCreated())
|
||||||
{
|
{
|
||||||
group->Disband(true);
|
group->Disband(true);
|
||||||
sObjectMgr->RemoveGroup(group);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
group->RemoveAllInvites();
|
group->RemoveAllInvites();
|
||||||
|
|
||||||
delete group;
|
delete group;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method /* = GROUP_REMOVEMETHOD_DEFAULT*/, uint64 kicker /* = 0 */, const char* reason /* = NULL */)
|
void Player::RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method /* = GROUP_REMOVEMETHOD_DEFAULT*/, uint64 kicker /* = 0 */, const char* reason /* = NULL */)
|
||||||
{
|
{
|
||||||
if (group)
|
if (group)
|
||||||
{
|
{
|
||||||
if (group->RemoveMember(guid, method, kicker, reason) <= 1)
|
group->RemoveMember(guid, method, kicker, reason);
|
||||||
{
|
|
||||||
// group->Disband(); already disbanded in RemoveMember
|
|
||||||
sObjectMgr->RemoveGroup(group);
|
|
||||||
delete group;
|
|
||||||
group = NULL;
|
group = NULL;
|
||||||
// removemember sets the player's group pointer to NULL
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ bool Group::AddMember(Player *player)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Group::RemoveMember(const uint64 &guid, const RemoveMethod &method /* = GROUP_REMOVEMETHOD_DEFAULT */, uint64 kicker /* = 0 */, const char* reason /* = NULL */)
|
bool Group::RemoveMember(const uint64 &guid, const RemoveMethod &method /*= GROUP_REMOVEMETHOD_DEFAULT*/, uint64 kicker /*= 0*/, const char* reason /*= NULL*/)
|
||||||
{
|
{
|
||||||
BroadcastGroupUpdate();
|
BroadcastGroupUpdate();
|
||||||
|
|
||||||
@@ -505,12 +505,15 @@ uint32 Group::RemoveMember(const uint64 &guid, const RemoveMethod &method /* = G
|
|||||||
}
|
}
|
||||||
|
|
||||||
SendUpdate();
|
SendUpdate();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
// If group size before player removal <= 2 then disband it
|
// If group size before player removal <= 2 then disband it
|
||||||
else
|
else
|
||||||
|
{
|
||||||
Disband();
|
Disband();
|
||||||
|
return false;
|
||||||
return m_memberSlots.size();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Group::ChangeLeader(const uint64 &guid)
|
void Group::ChangeLeader(const uint64 &guid)
|
||||||
@@ -634,9 +637,8 @@ void Group::Disband(bool hideDestroy /* = false */)
|
|||||||
ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, NULL);
|
ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_guid = 0;
|
sObjectMgr->RemoveGroup(this);
|
||||||
m_leaderGuid = 0;
|
delete this;
|
||||||
m_leaderName = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ class Group
|
|||||||
void RemoveAllInvites();
|
void RemoveAllInvites();
|
||||||
bool AddLeaderInvite(Player *player);
|
bool AddLeaderInvite(Player *player);
|
||||||
bool AddMember(Player *player);
|
bool AddMember(Player *player);
|
||||||
uint32 RemoveMember(const uint64 &guid, const RemoveMethod &method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0, const char* reason = NULL);
|
bool RemoveMember(const uint64 &guid, const RemoveMethod &method = GROUP_REMOVEMETHOD_DEFAULT, uint64 kicker = 0, const char* reason = NULL);
|
||||||
void ChangeLeader(const uint64 &guid);
|
void ChangeLeader(const uint64 &guid);
|
||||||
void SetLootMethod(LootMethod method);
|
void SetLootMethod(LootMethod method);
|
||||||
void SetLooterGuid(const uint64 &guid);
|
void SetLooterGuid(const uint64 &guid);
|
||||||
|
|||||||
Reference in New Issue
Block a user