Core/Misc: Fix static analysis issues

(cherry picked from commit 9cf4dd7345b7f05db834fd48a9f0a135f1884d70)
This commit is contained in:
jackpoz
2020-08-19 00:14:06 +02:00
committed by Shauren
parent 1019fc5801
commit 77e6355fba
6 changed files with 18 additions and 18 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ namespace VMAP
struct TC_COMMON_API LocationInfo
{
LocationInfo(): hitInstance(nullptr), hitModel(nullptr), ground_Z(-G3D::finf()) { }
LocationInfo(): rootId(-1), hitInstance(nullptr), hitModel(nullptr), ground_Z(-G3D::finf()) { }
int32 rootId;
const ModelInstance* hitInstance;
const GroupModel* hitModel;
+11 -11
View File
@@ -1045,8 +1045,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
else
creature->DespawnOrUnsummon(respawnDelay);
}
else if (GameObject* go = target->ToGameObject())
go->SetRespawnTime(respawnDelay);
else if (GameObject* goTarget = target->ToGameObject())
goTarget->SetRespawnTime(respawnDelay);
}
break;
}
@@ -1607,10 +1607,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (IsSmart(creature))
ENSURE_AI(SmartAI, creature->AI())->SetScript9(e, e.action.timedActionList.id, GetLastInvoker());
}
else if (GameObject* go = target->ToGameObject())
else if (GameObject* goTarget = target->ToGameObject())
{
if (IsSmartGO(go))
ENSURE_AI(SmartGameObjectAI, go->AI())->SetScript9(e, e.action.timedActionList.id, GetLastInvoker());
if (IsSmartGO(goTarget))
ENSURE_AI(SmartGameObjectAI, goTarget->AI())->SetScript9(e, e.action.timedActionList.id, GetLastInvoker());
}
}
break;
@@ -1694,10 +1694,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (IsSmart(creature))
ENSURE_AI(SmartAI, creature->AI())->SetScript9(e, id, GetLastInvoker());
}
else if (GameObject* go = target->ToGameObject())
else if (GameObject* goTarget = target->ToGameObject())
{
if (IsSmartGO(go))
ENSURE_AI(SmartGameObjectAI, go->AI())->SetScript9(e, id, GetLastInvoker());
if (IsSmartGO(goTarget))
ENSURE_AI(SmartGameObjectAI, goTarget->AI())->SetScript9(e, id, GetLastInvoker());
}
}
break;
@@ -1718,10 +1718,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (IsSmart(creature))
ENSURE_AI(SmartAI, creature->AI())->SetScript9(e, id, GetLastInvoker());
}
else if (GameObject* go = target->ToGameObject())
else if (GameObject* goTarget = target->ToGameObject())
{
if (IsSmartGO(go))
ENSURE_AI(SmartGameObjectAI, go->AI())->SetScript9(e, id, GetLastInvoker());
if (IsSmartGO(goTarget))
ENSURE_AI(SmartGameObjectAI, goTarget->AI())->SetScript9(e, id, GetLastInvoker());
}
}
break;
@@ -189,6 +189,7 @@ bool BattlegroundSA::ResetObjs()
for (uint8 i = 0; i < BG_SA_MAX_GY; i++)
{
WorldSafeLocsEntry const* sg = sObjectMgr->GetWorldSafeLoc(BG_SA_GYEntries[i]);
if (!sg)
{
TC_LOG_ERROR("bg.battleground", "SOTA: Can't find GY entry %u", BG_SA_GYEntries[i]);
+1 -1
View File
@@ -2528,7 +2528,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo
SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo) const
{
// Can`t miss on dead target (on skinning for example)
if ((!victim->IsAlive() && victim->GetTypeId() != TYPEID_PLAYER))
if (!victim->IsAlive() && victim->GetTypeId() != TYPEID_PLAYER)
return SPELL_MISS_NONE;
SpellSchoolMask schoolMask = spellInfo->GetSchoolMask();
+1 -1
View File
@@ -962,7 +962,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
}
}
if (!cInfo->Models.size())
if (cInfo->Models.empty())
TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) does not have any existing display id in creature_template_model.", cInfo->Entry);
if (!cInfo->unit_class || ((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0)
+3 -4
View File
@@ -1706,10 +1706,9 @@ bool SpellInfo::CanPierceImmuneAura(SpellInfo const* auraSpellInfo) const
if (HasAttribute(SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE) || HasAttribute(SPELL_ATTR2_UNAFFECTED_BY_AURA_SCHOOL_IMMUNE))
{
// ...but not these (Divine shield, Ice block, Cyclone and Banish for example)
if (!auraSpellInfo ||
(auraSpellInfo->Mechanic != MECHANIC_IMMUNE_SHIELD &&
auraSpellInfo->Mechanic != MECHANIC_INVULNERABILITY &&
(auraSpellInfo->Mechanic != MECHANIC_BANISH || (IsRankOf(auraSpellInfo) && auraSpellInfo->Dispel != DISPEL_NONE)))) // Banish shouldn't be immune to itself, but Cyclone should
if (auraSpellInfo->Mechanic != MECHANIC_IMMUNE_SHIELD &&
auraSpellInfo->Mechanic != MECHANIC_INVULNERABILITY &&
(auraSpellInfo->Mechanic != MECHANIC_BANISH || (IsRankOf(auraSpellInfo) && auraSpellInfo->Dispel != DISPEL_NONE))) // Banish shouldn't be immune to itself, but Cyclone should
return true;
}