From 1a4b1beb141182bd050ed8fa1220597e8ed837a8 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sun, 18 Jan 2015 21:53:04 +0100 Subject: Core/Misc: Fix static analysis issues Fix some static analysis issues reported by Coverity --- .../EasternKingdoms/ZulGurub/boss_mandokir.cpp | 14 ++++++++--- .../boss_temple_guardian_anhuur.cpp | 29 ++++++++++++---------- src/server/scripts/Spells/spell_warrior.cpp | 7 ++++++ 3 files changed, 34 insertions(+), 16 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index 3f44de57968..88b694f742c 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -107,7 +107,16 @@ class boss_mandokir : public CreatureScript struct boss_mandokirAI : public BossAI { - boss_mandokirAI(Creature* creature) : BossAI(creature, DATA_MANDOKIR) { } + boss_mandokirAI(Creature* creature) : BossAI(creature, DATA_MANDOKIR) + { + Initialize(); + } + + void Initialize() + { + _ohganotSoFast = true; + _reanimateOhganCooldown = false; + } void Reset() override { @@ -116,8 +125,7 @@ class boss_mandokir : public CreatureScript _Reset(); me->SummonCreatureGroup(SUMMON_GROUP_CHAINED_SPIRIT); - _ohganotSoFast = true; - _reanimateOhganCooldown = false; + Initialize(); _reviveGUID.Clear(); } diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp index 3da33de01f7..ecf44db800a 100644 --- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp +++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp @@ -133,22 +133,25 @@ public: DoCastAOE(SPELL_ACTIVATE_BEACONS); - std::list stalkers; GameObject* door = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_ANHUUR_DOOR)); - GetCreatureListWithEntryInGrid(stalkers, me, NPC_CAVE_IN_STALKER, 100.0f); - - stalkers.remove_if(Trinity::HeightDifferenceCheck(door, 0.0f, false)); // Target only the bottom ones - for (std::list::iterator itr = stalkers.begin(); itr != stalkers.end(); ++itr) + if (door) { - if ((*itr)->GetPositionX() > door->GetPositionX()) - { - (*itr)->CastSpell((*itr), SPELL_SHIELD_VISUAL_LEFT, true); - (*itr)->CastSpell((*itr), SPELL_BEAM_OF_LIGHT_LEFT, true); - } - else + std::list stalkers; + GetCreatureListWithEntryInGrid(stalkers, me, NPC_CAVE_IN_STALKER, 100.0f); + + stalkers.remove_if(Trinity::HeightDifferenceCheck(door, 0.0f, false)); // Target only the bottom ones + for (std::list::iterator itr = stalkers.begin(); itr != stalkers.end(); ++itr) { - (*itr)->CastSpell((*itr), SPELL_SHIELD_VISUAL_RIGHT, true); - (*itr)->CastSpell((*itr), SPELL_BEAM_OF_LIGHT_RIGHT, true); + if ((*itr)->GetPositionX() > door->GetPositionX()) + { + (*itr)->CastSpell((*itr), SPELL_SHIELD_VISUAL_LEFT, true); + (*itr)->CastSpell((*itr), SPELL_BEAM_OF_LIGHT_LEFT, true); + } + else + { + (*itr)->CastSpell((*itr), SPELL_SHIELD_VISUAL_RIGHT, true); + (*itr)->CastSpell((*itr), SPELL_BEAM_OF_LIGHT_RIGHT, true); + } } } diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index f696fffb2ea..b3caff679df 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -853,6 +853,13 @@ class spell_warr_vigilance : public SpellScriptLoader { PrepareAuraScript(spell_warr_vigilance_AuraScript); + public: + spell_warr_vigilance_AuraScript() + { + _procTarget = nullptr; + } + + private: bool Validate(SpellInfo const* /*spellInfo*/) override { if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_VENGEANCE)) -- cgit v1.2.3