* Batch of fixes for issues found by static analysis.
This commit is contained in:
1 parent
7c18bbb95f
commit
25acef2572
10 files changed
+100
-101
No files matched your search
@@ -365,24 +365,21 @@ bool Group::AddMember(Player* player)
|
||||
|
||||
SubGroupCounterIncrease(subGroup);
|
||||
|
||||
if (player)
|
||||
player->SetGroupInvite(NULL);
|
||||
if (player->GetGroup())
|
||||
{
|
||||
player->SetGroupInvite(NULL);
|
||||
if (player->GetGroup())
|
||||
{
|
||||
if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
|
||||
player->SetBattlegroundOrBattlefieldRaid(this, subGroup);
|
||||
else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
|
||||
player->SetOriginalGroup(this, subGroup);
|
||||
}
|
||||
else //if player is not in group, then call set group
|
||||
player->SetGroup(this, subGroup);
|
||||
|
||||
// if the same group invites the player back, cancel the homebind timer
|
||||
InstanceGroupBind* bind = GetBoundInstance(player);
|
||||
if (bind && bind->save->GetInstanceId() == player->GetInstanceId())
|
||||
player->m_InstanceValid = true;
|
||||
if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
|
||||
player->SetBattlegroundOrBattlefieldRaid(this, subGroup);
|
||||
else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
|
||||
player->SetOriginalGroup(this, subGroup);
|
||||
}
|
||||
else //if player is not in group, then call set group
|
||||
player->SetGroup(this, subGroup);
|
||||
|
||||
// if the same group invites the player back, cancel the homebind timer
|
||||
InstanceGroupBind* bind = GetBoundInstance(player);
|
||||
if (bind && bind->save->GetInstanceId() == player->GetInstanceId())
|
||||
player->m_InstanceValid = true;
|
||||
|
||||
if (!isRaidGroup()) // reset targetIcons for non-raid-groups
|
||||
{
|
||||
@@ -408,89 +405,86 @@ bool Group::AddMember(Player* player)
|
||||
SendUpdate();
|
||||
sScriptMgr->OnGroupAddMember(this, player->GetGUID());
|
||||
|
||||
if (player)
|
||||
if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup())
|
||||
{
|
||||
if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup())
|
||||
{
|
||||
// reset the new member's instances, unless he is currently in one of them
|
||||
// including raid/heroic instances that they are not permanently bound to!
|
||||
player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, false);
|
||||
player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, true);
|
||||
// reset the new member's instances, unless he is currently in one of them
|
||||
// including raid/heroic instances that they are not permanently bound to!
|
||||
player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, false);
|
||||
player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, true);
|
||||
|
||||
if (player->getLevel() >= LEVELREQUIREMENT_HEROIC)
|
||||
if (player->getLevel() >= LEVELREQUIREMENT_HEROIC)
|
||||
{
|
||||
if (player->GetDungeonDifficulty() != GetDungeonDifficulty())
|
||||
{
|
||||
if (player->GetDungeonDifficulty() != GetDungeonDifficulty())
|
||||
{
|
||||
player->SetDungeonDifficulty(GetDungeonDifficulty());
|
||||
player->SendDungeonDifficulty(true);
|
||||
}
|
||||
if (player->GetRaidDifficulty() != GetRaidDifficulty())
|
||||
{
|
||||
player->SetRaidDifficulty(GetRaidDifficulty());
|
||||
player->SendRaidDifficulty(true);
|
||||
}
|
||||
player->SetDungeonDifficulty(GetDungeonDifficulty());
|
||||
player->SendDungeonDifficulty(true);
|
||||
}
|
||||
if (player->GetRaidDifficulty() != GetRaidDifficulty())
|
||||
{
|
||||
player->SetRaidDifficulty(GetRaidDifficulty());
|
||||
player->SendRaidDifficulty(true);
|
||||
}
|
||||
}
|
||||
player->SetGroupUpdateFlag(GROUP_UPDATE_FULL);
|
||||
UpdatePlayerOutOfRange(player);
|
||||
|
||||
// quest related GO state dependent from raid membership
|
||||
if (isRaidGroup())
|
||||
player->UpdateForQuestWorldObjects();
|
||||
|
||||
{
|
||||
// Broadcast new player group member fields to rest of the group
|
||||
player->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
|
||||
|
||||
UpdateData groupData;
|
||||
WorldPacket groupDataPacket;
|
||||
|
||||
// Broadcast group members' fields to player
|
||||
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
if (itr->getSource() == player)
|
||||
continue;
|
||||
|
||||
if (Player* member = itr->getSource())
|
||||
{
|
||||
if (player->HaveAtClient(member))
|
||||
{
|
||||
member->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
|
||||
member->BuildValuesUpdateBlockForPlayer(&groupData, player);
|
||||
member->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
|
||||
}
|
||||
|
||||
if (member->HaveAtClient(player))
|
||||
{
|
||||
UpdateData newData;
|
||||
WorldPacket newDataPacket;
|
||||
player->BuildValuesUpdateBlockForPlayer(&newData, member);
|
||||
if (newData.HasData())
|
||||
{
|
||||
newData.BuildPacket(&newDataPacket);
|
||||
member->SendDirectMessage(&newDataPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (groupData.HasData())
|
||||
{
|
||||
groupData.BuildPacket(&groupDataPacket);
|
||||
player->SendDirectMessage(&groupDataPacket);
|
||||
}
|
||||
|
||||
player->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
|
||||
}
|
||||
|
||||
if (m_maxEnchantingLevel < player->GetSkillValue(SKILL_ENCHANTING))
|
||||
m_maxEnchantingLevel = player->GetSkillValue(SKILL_ENCHANTING);
|
||||
}
|
||||
player->SetGroupUpdateFlag(GROUP_UPDATE_FULL);
|
||||
UpdatePlayerOutOfRange(player);
|
||||
|
||||
// quest related GO state dependent from raid membership
|
||||
if (isRaidGroup())
|
||||
player->UpdateForQuestWorldObjects();
|
||||
|
||||
{
|
||||
// Broadcast new player group member fields to rest of the group
|
||||
player->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
|
||||
|
||||
UpdateData groupData;
|
||||
WorldPacket groupDataPacket;
|
||||
|
||||
// Broadcast group members' fields to player
|
||||
for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
if (itr->getSource() == player)
|
||||
continue;
|
||||
|
||||
if (Player* member = itr->getSource())
|
||||
{
|
||||
if (player->HaveAtClient(member))
|
||||
{
|
||||
member->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
|
||||
member->BuildValuesUpdateBlockForPlayer(&groupData, player);
|
||||
member->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
|
||||
}
|
||||
|
||||
if (member->HaveAtClient(player))
|
||||
{
|
||||
UpdateData newData;
|
||||
WorldPacket newDataPacket;
|
||||
player->BuildValuesUpdateBlockForPlayer(&newData, member);
|
||||
if (newData.HasData())
|
||||
{
|
||||
newData.BuildPacket(&newDataPacket);
|
||||
member->SendDirectMessage(&newDataPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (groupData.HasData())
|
||||
{
|
||||
groupData.BuildPacket(&groupDataPacket);
|
||||
player->SendDirectMessage(&groupDataPacket);
|
||||
}
|
||||
|
||||
player->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
|
||||
}
|
||||
|
||||
if (m_maxEnchantingLevel < player->GetSkillValue(SKILL_ENCHANTING))
|
||||
m_maxEnchantingLevel = player->GetSkillValue(SKILL_ENCHANTING);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOVEMETHOD_DEFAULT*/, uint64 kicker /*= 0*/, const char* reason /*= NULL*/)
|
||||
bool Group::RemoveMember(uint64 guid, const RemoveMethod& method /*= GROUP_REMOVEMETHOD_DEFAULT*/, uint64 kicker /*= 0*/, const char* reason /*= NULL*/)
|
||||
{
|
||||
BroadcastGroupUpdate();
|
||||
|
||||
|
||||
Reference in new issue
Block a user