* Batch of fixes for issues found by static analysis.

This commit is contained in:
Subv committed 2013-05-17 21:11:18 -05:00
1 parent 7c18bbb95f
commit 25acef2572
10 files changed
+100 -101

No files matched your search

@@ -4149,6 +4149,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
// learnSpell(prev_id, false);
}
// if ranked non-stackable spell: need activate lesser rank and update dendence state
/// No need to check for spellInfo != NULL here because if cur_active is true, then that means that the spell was already in m_spells, and only valid spells can be pushed there.
else if (cur_active && !spellInfo->IsStackableWithRanks() && spellInfo->IsRanked())
{
// need manually update dependence state (learn spell ignore like attempts)
+4 -2
View File
@@ -7478,7 +7478,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
case SPELLFAMILY_PALADIN:
{
// Infusion of Light
if (dummySpell->SpellIconID == 3021)
if (procSpell && dummySpell->SpellIconID == 3021)
{
// Flash of Light HoT on Flash of Light when Sacred Shield active
if (procSpell->SpellFamilyFlags[0] & 0x40000000 && procSpell->SpellIconID == 242)
@@ -7509,6 +7509,8 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
// Glyph of Divinity
else if (dummySpell->Id == 54939)
{
if (!procSpell)
return false;
*handled = true;
// Check if we are the target and prevent mana gain
if (victim && triggeredByAura->GetCasterGUID() == victim->GetGUID())
@@ -16837,7 +16839,7 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a
}
}
if (aurApp && aurApp->GetRemoveMode())
if (!aurApp || aurApp->GetRemoveMode())
return;
if (Player* player = ToPlayer())
+83 -89
View File
@@ -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();
@@ -1600,6 +1600,9 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
switch (GetId())
{
case 19746:
if (!caster)
break;
// Improved concentration aura - linked aura
if (caster->HasAura(20254) || caster->HasAura(20255) || caster->HasAura(20256))
{
@@ -1608,6 +1611,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
else
target->RemoveAura(63510);
}
break;
case 31821:
// Aura Mastery Triggered Spell Handler
// If apply Concentration Aura -> trigger -> apply Aura Mastery Immunity
+1 -1
View File
@@ -482,7 +482,7 @@ public:
char* arg3 = strtok(NULL, " ");
bool isAccountNameGiven = true;
if (arg1 && !arg3)
if (!arg3)
{
if (!handler->getSelectedPlayer())
return false;
+1 -1
View File
@@ -796,7 +796,7 @@ public:
if (show == "info")
{
// Check if the user did specify a visual waypoint
if (target->GetEntry() != VISUAL_WAYPOINT)
if (target && target->GetEntry() != VISUAL_WAYPOINT)
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_SELECT);
handler->SetSentErrorMessage(true);
@@ -773,7 +773,7 @@ public:
void JustSummoned(Creature* summon)
{
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30, true);
if (target && summon)
if (target)
summon->Attack(target, false);
summons.Summon(summon);
}
@@ -182,10 +182,8 @@ public:
}
if (!found)
{
return;
}
DoNextDialogueStep();
}
@@ -210,7 +208,7 @@ private:
void DoNextDialogueStep()
{
// Last Dialogue Entry done?
if (_currentEntry && !_currentEntry->TextEntry)
if (!_currentEntry || !_currentEntry->TextEntry)
{
_actionTimer = 0;
return;
@@ -754,7 +754,7 @@ public:
void UpdateAI(uint32 diff)
{
if (!UpdateVictim() && _phase != PHASE_NOT_STARTED && _phase != PHASE_TWO)
if (!instance || (!UpdateVictim() && _phase != PHASE_NOT_STARTED && _phase != PHASE_TWO))
return;
events.Update(diff);
@@ -854,7 +854,7 @@ public:
}
}
if (_arcaneReinforcements && instance)
if (_arcaneReinforcements)
{
for (uint8 rangeDisks = 0; rangeDisks < (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL ? 4 : 5); rangeDisks++)
{
+1 -1
View File
@@ -1751,7 +1751,7 @@ public:
{
me->HandleEmoteCommand(emote);
Unit* owner = me->GetOwner();
if (emote != TEXT_EMOTE_KISS || owner || owner->GetTypeId() != TYPEID_PLAYER ||
if (emote != TEXT_EMOTE_KISS || !owner || owner->GetTypeId() != TYPEID_PLAYER ||
owner->ToPlayer()->GetTeam() != player->GetTeam())
{
return;