aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Groups/Group.cpp
diff options
context:
space:
mode:
authorSubv <s.v.h21@hotmail.com>2013-05-17 21:11:18 -0500
committerSubv <s.v.h21@hotmail.com>2013-05-17 21:11:18 -0500
commit25acef257240edb7763eac043554ca7c7ac767eb (patch)
treee574a1a4936201d811a06eb132720eef68d99d99 /src/server/game/Groups/Group.cpp
parent7c18bbb95f896fa320e4f8a2b7808714b8ba270c (diff)
* Batch of fixes for issues found by static analysis.
Diffstat (limited to 'src/server/game/Groups/Group.cpp')
-rw-r--r--src/server/game/Groups/Group.cpp144
1 files changed, 69 insertions, 75 deletions
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index 50c50fd4b1d..c21cc9210dc 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -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);
+ }
+ player->SetGroupUpdateFlag(GROUP_UPDATE_FULL);
+ UpdatePlayerOutOfRange(player);
- // quest related GO state dependent from raid membership
- if (isRaidGroup())
- player->UpdateForQuestWorldObjects();
+ // 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);
+ {
+ // Broadcast new player group member fields to rest of the group
+ player->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
- UpdateData groupData;
- WorldPacket groupDataPacket;
+ UpdateData groupData;
+ WorldPacket groupDataPacket;
- // Broadcast group members' fields to player
- for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next())
- {
- if (itr->getSource() == player)
- continue;
+ // 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* member = itr->getSource())
+ {
+ if (player->HaveAtClient(member))
{
- if (player->HaveAtClient(member))
- {
- member->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
- member->BuildValuesUpdateBlockForPlayer(&groupData, player);
- member->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
- }
+ member->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
+ member->BuildValuesUpdateBlockForPlayer(&groupData, player);
+ member->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
+ }
- if (member->HaveAtClient(player))
+ if (member->HaveAtClient(player))
+ {
+ UpdateData newData;
+ WorldPacket newDataPacket;
+ player->BuildValuesUpdateBlockForPlayer(&newData, member);
+ if (newData.HasData())
{
- UpdateData newData;
- WorldPacket newDataPacket;
- player->BuildValuesUpdateBlockForPlayer(&newData, member);
- if (newData.HasData())
- {
- newData.BuildPacket(&newDataPacket);
- member->SendDirectMessage(&newDataPacket);
- }
+ newData.BuildPacket(&newDataPacket);
+ member->SendDirectMessage(&newDataPacket);
}
}
}
+ }
- if (groupData.HasData())
- {
- groupData.BuildPacket(&groupDataPacket);
- player->SendDirectMessage(&groupDataPacket);
- }
-
- player->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
+ if (groupData.HasData())
+ {
+ groupData.BuildPacket(&groupDataPacket);
+ player->SendDirectMessage(&groupDataPacket);
}
- if (m_maxEnchantingLevel < player->GetSkillValue(SKILL_ENCHANTING))
- m_maxEnchantingLevel = player->GetSkillValue(SKILL_ENCHANTING);
+ 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();