Core/Misc: Fix some static analysis issues

Fix some static analysis issues about uninitialized values in scripts.
Add spell id validation in Unit::SpellNonMeleeDamageLog() .
This commit is contained in:
jackpoz committed 2013-12-08 22:04:30 +01:00
1 parent b76d141ce0
commit f418f4cf94
9 files changed
+10 -3

No files matched your search

+2
View File
@@ -957,6 +957,8 @@ void Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castI
uint32 Unit::SpellNonMeleeDamageLog(Unit* victim, uint32 spellID, uint32 damage)
{
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
if (!spellInfo)
return 0;
SpellNonMeleeDamage damageInfo(this, victim, spellInfo->Id, spellInfo->SchoolMask);
damage = SpellDamageBonusDone(victim, spellInfo, damage, SPELL_DIRECT_DAMAGE);
damage = victim->SpellDamageBonusTaken(this, spellInfo, damage, SPELL_DIRECT_DAMAGE);
@@ -60,6 +60,7 @@ public:
{
waterBoltTimer = 3 * IN_MILLISECONDS;
resetTimer = 5 * IN_MILLISECONDS;
balindaGUID = 0;
}
void UpdateAI(uint32 diff) OVERRIDE
@@ -171,6 +171,7 @@ public:
_Reset();
gythEvent = false;
victorGUID = 0;
portcullisGUID = 0;
}
void EnterCombat(Unit* /*who*/) OVERRIDE
@@ -63,6 +63,7 @@ public:
{
// Razorgore
EggCount = 0;
EggEvent = 0;
RazorgoreTheUntamedGUID = 0;
RazorgoreDoorGUID = 0;
EggList.clear();
@@ -310,8 +310,6 @@ class npc_snobold_vassal : public CreatureScript
_targetGUID = 0;
_targetDied = false;
if (_instance)
_bossGUID = _instance->GetData64(NPC_GORMOK);
//Workaround for Snobold
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
}
@@ -450,7 +448,6 @@ class npc_snobold_vassal : public CreatureScript
private:
EventMap _events;
InstanceScript* _instance;
uint64 _bossGUID;
uint64 _targetGUID;
bool _targetDied;
};
@@ -1185,6 +1185,7 @@ struct npc_gauntlet_trash : public ScriptedAI
void Reset() OVERRIDE
{
InternalWaveId = 0;
me->CastSpell(me, SPELL_WELL_OF_SOULS, true);
_events.Reset();
}
@@ -514,6 +514,7 @@ class npc_gothik_minion : public CreatureScript
npc_gothik_minionAI(Creature* creature) : CombatAI(creature)
{
liveSide = IN_LIVE_SIDE(me);
gateClose = false;
}
bool liveSide;
@@ -457,6 +457,8 @@ public:
void Reset() OVERRIDE
{
_playerGUID = 0;
_getingredienttry = 0;
_events.ScheduleEvent(EVENT_TURN_TO_POT, urand(15000, 26000));
}
@@ -68,6 +68,7 @@ public:
void Reset() OVERRIDE
{
myClass = CLASS_NONE;
Class_Timer = 1000;
}