mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
Fix for a crash issue related to groups that both PEQ and Armm reported on the forums.
This commit is contained in:
parent
a6f2c1be8a
commit
e609ec1df6
@ -6461,7 +6461,12 @@ void Client::Handle_OP_GroupFollow2(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
// Remove the merc from the old group
|
// Remove the merc from the old group
|
||||||
if (GetMerc())
|
if (GetMerc())
|
||||||
GetMerc()->RemoveMercFromGroup(GetMerc(), GetMerc()->GetGroup());
|
{
|
||||||
|
if(GetGroup())
|
||||||
|
{
|
||||||
|
Merc::RemoveMercFromGroup(GetMerc(), GetMerc()->GetGroup());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Group* group = entity_list.GetGroupByClient(inviter->CastToClient());
|
Group* group = entity_list.GetGroupByClient(inviter->CastToClient());
|
||||||
|
|
||||||
@ -6660,24 +6665,20 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app)
|
|||||||
group->DelMember(memberToDisband,false);
|
group->DelMember(memberToDisband,false);
|
||||||
Client* memberClient = memberToDisband->CastToClient();
|
Client* memberClient = memberToDisband->CastToClient();
|
||||||
Merc* memberMerc = memberToDisband->CastToClient()->GetMerc();
|
Merc* memberMerc = memberToDisband->CastToClient()->GetMerc();
|
||||||
memberMerc->RemoveMercFromGroup(memberMerc, group);
|
if(memberClient && memberMerc && group)
|
||||||
|
{
|
||||||
|
Merc::RemoveMercFromGroup(memberMerc, group);
|
||||||
|
|
||||||
if(!memberMerc->IsGrouped() && !memberClient->IsGrouped()) {
|
if(!memberMerc->IsGrouped() && !memberClient->IsGrouped()) {
|
||||||
Group *g = new Group(memberClient);
|
Group *g = new Group(memberClient);
|
||||||
|
|
||||||
if(!g) {
|
|
||||||
delete g;
|
|
||||||
g = NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
entity_list.AddGroup(g);
|
entity_list.AddGroup(g);
|
||||||
|
|
||||||
if(g->GetID() == 0) {
|
if(g->GetID() == 0) {
|
||||||
safe_delete(g);
|
safe_delete(g);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(memberMerc->AddMercToGroup(memberMerc, g)) {
|
if(Merc::AddMercToGroup(memberMerc, g)) {
|
||||||
database.SetGroupLeaderName(g->GetID(), memberClient->GetName());
|
database.SetGroupLeaderName(g->GetID(), memberClient->GetName());
|
||||||
g->SaveGroupLeaderAA();
|
g->SaveGroupLeaderAA();
|
||||||
database.SetGroupID(memberClient->GetName(), g->GetID(), memberClient->CharacterID());
|
database.SetGroupID(memberClient->GetName(), g->GetID(), memberClient->CharacterID());
|
||||||
@ -6686,9 +6687,9 @@ void Client::Handle_OP_GroupDisband(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if(memberToDisband->IsMerc()) {
|
else if(memberToDisband->IsMerc()) {
|
||||||
memberToDisband->CastToMerc()->RemoveMercFromGroup(memberToDisband->CastToMerc(), group);
|
Merc::RemoveMercFromGroup(memberToDisband->CastToMerc(), group);
|
||||||
memberToDisband->CastToMerc()->RemoveMercFromGroup(memberToDisband->CastToMerc(), group);
|
|
||||||
memberToDisband->CastToMerc()->Suspend();
|
memberToDisband->CastToMerc()->Suspend();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -192,7 +192,7 @@ bool Client::Process() {
|
|||||||
{
|
{
|
||||||
GetMerc()->Save();
|
GetMerc()->Save();
|
||||||
if(GetMerc()->GetGroup() != NULL)
|
if(GetMerc()->GetGroup() != NULL)
|
||||||
GetMerc()->RemoveMercFromGroup(GetMerc(), GetMerc()->GetGroup());
|
Merc::RemoveMercFromGroup(GetMerc(), GetMerc()->GetGroup());
|
||||||
GetMerc()->Depop();
|
GetMerc()->Depop();
|
||||||
}
|
}
|
||||||
LeaveGroup();
|
LeaveGroup();
|
||||||
@ -210,6 +210,7 @@ bool Client::Process() {
|
|||||||
if (GetMerc())
|
if (GetMerc())
|
||||||
{
|
{
|
||||||
GetMerc()->Save();
|
GetMerc()->Save();
|
||||||
|
if(GetMerc()->GetGroup() != NULL)
|
||||||
GetMerc()->RemoveMercFromGroup(GetMerc(), GetMerc()->GetGroup());
|
GetMerc()->RemoveMercFromGroup(GetMerc(), GetMerc()->GetGroup());
|
||||||
GetMerc()->Depop();
|
GetMerc()->Depop();
|
||||||
}
|
}
|
||||||
@ -679,6 +680,7 @@ bool Client::Process() {
|
|||||||
if (GetMerc())
|
if (GetMerc())
|
||||||
{
|
{
|
||||||
GetMerc()->Save();
|
GetMerc()->Save();
|
||||||
|
if(GetMerc()->GetGroup() != NULL)
|
||||||
GetMerc()->RemoveMercFromGroup(GetMerc(), GetMerc()->GetGroup());
|
GetMerc()->RemoveMercFromGroup(GetMerc(), GetMerc()->GetGroup());
|
||||||
GetMerc()->Depop();
|
GetMerc()->Depop();
|
||||||
}
|
}
|
||||||
@ -728,7 +730,8 @@ bool Client::Process() {
|
|||||||
}
|
}
|
||||||
if (GetMerc())
|
if (GetMerc())
|
||||||
{
|
{
|
||||||
GetMerc()->RemoveMercFromGroup(GetMerc(), GetMerc()->GetGroup());
|
if(GetMerc()->GetGroup() != NULL)
|
||||||
|
Merc::RemoveMercFromGroup(GetMerc(), GetMerc()->GetGroup());
|
||||||
GetMerc()->Depop();
|
GetMerc()->Depop();
|
||||||
}
|
}
|
||||||
adverrorinfo = 811;
|
adverrorinfo = 811;
|
||||||
|
|||||||
@ -5642,9 +5642,6 @@ bool Merc::Suspend() {
|
|||||||
|
|
||||||
SetSuspended(true);
|
SetSuspended(true);
|
||||||
|
|
||||||
/*if(HasGroup()) {
|
|
||||||
RemoveMercFromGroup(this, GetGroup());
|
|
||||||
}*/
|
|
||||||
mercOwner->GetMercInfo().IsSuspended = true;
|
mercOwner->GetMercInfo().IsSuspended = true;
|
||||||
mercOwner->GetMercInfo().SuspendedTime = time(NULL) + RuleI(Mercs, SuspendIntervalS);
|
mercOwner->GetMercInfo().SuspendedTime = time(NULL) + RuleI(Mercs, SuspendIntervalS);
|
||||||
mercOwner->GetMercInfo().MercTimerRemaining = mercOwner->GetMercTimer()->GetRemainingTime();
|
mercOwner->GetMercInfo().MercTimerRemaining = mercOwner->GetMercTimer()->GetRemainingTime();
|
||||||
@ -5652,7 +5649,6 @@ bool Merc::Suspend() {
|
|||||||
Save();
|
Save();
|
||||||
mercOwner->GetMercTimer()->Disable();
|
mercOwner->GetMercTimer()->Disable();
|
||||||
|
|
||||||
//mercOwner->UpdateMercTimer();
|
|
||||||
mercOwner->SendMercSuspendResponsePacket(mercOwner->GetMercInfo().SuspendedTime);
|
mercOwner->SendMercSuspendResponsePacket(mercOwner->GetMercInfo().SuspendedTime);
|
||||||
|
|
||||||
Depop();
|
Depop();
|
||||||
@ -5782,7 +5778,7 @@ void Merc::Depop() {
|
|||||||
entity_list.RemoveFromHateLists(this);
|
entity_list.RemoveFromHateLists(this);
|
||||||
|
|
||||||
if(HasGroup())
|
if(HasGroup())
|
||||||
RemoveMercFromGroup(this, GetGroup());
|
Merc::RemoveMercFromGroup(this, GetGroup());
|
||||||
|
|
||||||
if(HasPet()) {
|
if(HasPet()) {
|
||||||
GetPet()->Depop();
|
GetPet()->Depop();
|
||||||
@ -5843,7 +5839,7 @@ bool Merc::AddMercToGroup(Merc* merc, Group* group) {
|
|||||||
if(merc && group) {
|
if(merc && group) {
|
||||||
// Remove merc from current group if any
|
// Remove merc from current group if any
|
||||||
if(merc->HasGroup()) {
|
if(merc->HasGroup()) {
|
||||||
merc->RemoveMercFromGroup(merc, merc->GetGroup());
|
Merc::RemoveMercFromGroup(merc, merc->GetGroup());
|
||||||
}
|
}
|
||||||
// Add merc to this group
|
// Add merc to this group
|
||||||
if(group->AddMember(merc)) {
|
if(group->AddMember(merc)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user