aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellEffects.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2013-08-01 21:31:11 +0200
committerShauren <shauren.trinity@gmail.com>2013-08-01 21:31:11 +0200
commitac10589edaf16f32105620b579ebae77d9b09f2c (patch)
tree8455fa46e10c6659cd942ba42122e8b41a36b4cf /src/server/game/Spells/SpellEffects.cpp
parentab6be8c603c9af110392bb7019472d2775dae60d (diff)
Core/Misc: Fixed some issues found by Coverity Scan
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r--src/server/game/Spells/SpellEffects.cpp39
1 files changed, 13 insertions, 26 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 38d31a89e86..e054c91ccc9 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -4214,6 +4214,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
m_caster->CastSpell(unitTarget, spellId2, true);
return;
}
+ break;
}
case SPELLFAMILY_DEATHKNIGHT:
{
@@ -4650,25 +4651,11 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
return;
uint32 go_id = m_spellInfo->Effects[effIndex].MiscValue;
+ uint8 slot = m_spellInfo->Effects[effIndex].Effect - SPELL_EFFECT_SUMMON_OBJECT_SLOT1;
- uint8 slot = 0;
- switch (m_spellInfo->Effects[effIndex].Effect)
- {
- case SPELL_EFFECT_SUMMON_OBJECT_SLOT1: slot = 0; break;
- case SPELL_EFFECT_SUMMON_OBJECT_SLOT2: slot = 1; break;
- case SPELL_EFFECT_SUMMON_OBJECT_SLOT3: slot = 2; break;
- case SPELL_EFFECT_SUMMON_OBJECT_SLOT4: slot = 3; break;
- default: return;
- }
-
- uint64 guid = m_caster->m_ObjectSlot[slot];
- if (guid != 0)
+ if (uint64 guid = m_caster->m_ObjectSlot[slot])
{
- GameObject* obj = NULL;
- if (m_caster)
- obj = m_caster->GetMap()->GetGameObject(guid);
-
- if (obj)
+ if (GameObject* obj = m_caster->GetMap()->GetGameObject(guid))
{
// Recast case - null spell id to make auras not be removed on object remove from world
if (m_spellInfo->Id == obj->GetSpellId())
@@ -4678,7 +4665,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
m_caster->m_ObjectSlot[slot] = 0;
}
- GameObject* pGameObj = new GameObject;
+ GameObject* go = new GameObject();
float x, y, z;
// If dest location if present
@@ -4689,24 +4676,24 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
Map* map = m_caster->GetMap();
- if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map,
+ if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map,
m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
{
- delete pGameObj;
+ delete go;
return;
}
//pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel());
int32 duration = m_spellInfo->GetDuration();
- pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
- pGameObj->SetSpellId(m_spellInfo->Id);
- m_caster->AddGameObject(pGameObj);
+ go->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
+ go->SetSpellId(m_spellInfo->Id);
+ m_caster->AddGameObject(go);
- ExecuteLogEffectSummonObject(effIndex, pGameObj);
+ ExecuteLogEffectSummonObject(effIndex, go);
- map->AddToMap(pGameObj);
+ map->AddToMap(go);
- m_caster->m_ObjectSlot[slot] = pGameObj->GetGUID();
+ m_caster->m_ObjectSlot[slot] = go->GetGUID();
}
void Spell::EffectResurrect(SpellEffIndex effIndex)