Core/Misc: Fix static analysis issues

This commit is contained in:
jackpoz
2017-11-11 21:06:32 +01:00
parent 97f33dc779
commit 9b7c73a19d
8 changed files with 13 additions and 35 deletions

View File

@@ -392,8 +392,7 @@ public:
for (uint8 i = 0; i < 3; ++i)
{
Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
Creature* Orb = DoSpawnCreature(CREATURE_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000);
if (Orb && target)

View File

@@ -204,9 +204,7 @@ public:
//Charge_Timer
if (Charge_Timer <= diff)
{
Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target)
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
DoCast(target, SPELL_CHARGE);
//me->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true, 1);

View File

@@ -122,10 +122,7 @@ public:
//ChangeTarget_Timer
if (Submerged && ChangeTarget_Timer <= diff)
{
Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target)
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
ChangeTarget_Timer = urand(10000, 20000);

View File

@@ -558,9 +558,7 @@ public:
//Blizzard_Timer
if (Blizzard_Timer <= diff)
{
Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45, true);
if (target)
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45, true))
DoCast(target, SPELL_BLIZZARD);
Blizzard_Timer = 15000 + rand32() % 15000;
} else Blizzard_Timer -= diff;

View File

@@ -332,9 +332,7 @@ public:
if (instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER))
{
Unit* victim = nullptr;
victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER));
if (victim)
if (Unit* victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER)))
AddThreat(victim, 1);
StartEvent();
}
@@ -586,9 +584,7 @@ public:
//at this point he divides himself in two parts
CastConsumingMadness();
DespawnDemon();
Creature* Copy = nullptr;
Copy = DoSpawnCreature(DEMON_FORM, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 6000);
if (Copy)
if (Creature* Copy = DoSpawnCreature(DEMON_FORM, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 6000))
{
Demon = Copy->GetGUID();
if (me->GetVictim())
@@ -764,9 +760,7 @@ public:
if (!me->IsInCombat() && instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER))
{
Unit* victim = nullptr;
victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER));
if (victim)
if (Unit* victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER)))
AttackStart(victim);
}
@@ -784,10 +778,8 @@ public:
if (Mindblast_Timer <= diff)
{
Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target)DoCast(target, SPELL_MINDBLAST);
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_MINDBLAST);
Mindblast_Timer = urand(10000, 15000);
} else Mindblast_Timer -= diff;

View File

@@ -181,9 +181,7 @@ public:
//Charging_Timer
if (Charging_Timer <= diff)
{
Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target)
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
AttackStart(target);
DoCast(target, SPELL_BERSERKER_C);
@@ -293,9 +291,7 @@ public:
//DeathCoil Timer /need correct timer
if (DeathCoil_Timer <= diff)
{
Unit* target = nullptr;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target)
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_DEATH_COIL);
DeathCoil_Timer = 20000;
} else DeathCoil_Timer -= diff;

View File

@@ -436,9 +436,7 @@ class boss_alar : public CreatureScript
}
else
{
Unit* target = nullptr;
target = me->SelectNearestTargetInAttackDistance(5);
if (target)
if (Unit* target = me->SelectNearestTargetInAttackDistance(5))
AttackStart(target);
else
{

View File

@@ -169,7 +169,7 @@ void ByteBuffer::hexlike() const
for (uint32 i = 0; i < size(); ++i)
{
char buf[3];
snprintf(buf, 3, "%2X ", read<uint8>(i));
snprintf(buf, 3, "%2X", read<uint8>(i));
if ((i == (j * 8)) && ((i != (k * 16))))
{
o << "| ";