Core/Misc: Fix static analysis issues

This commit is contained in:
Aokromes
2017-11-12 13:30:18 +01:00
parent 67dc6a7576
commit 51d0befe6d
8 changed files with 13 additions and 35 deletions

View File

@@ -399,8 +399,7 @@ public:
for (uint8 i = 0; i < 3; ++i)
{
Unit* target = NULL;
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

@@ -201,9 +201,7 @@ public:
//Charge_Timer
if (Charge_Timer <= diff)
{
Unit* target = NULL;
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 = NULL;
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

@@ -550,9 +550,7 @@ public:
//Blizzard_Timer
if (Blizzard_Timer <= diff)
{
Unit* target = NULL;
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

@@ -327,9 +327,7 @@ public:
if (instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER))
{
Unit* victim = NULL;
victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER));
if (victim)
if (Unit* victim = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER)))
me->getThreatManager().addThreat(victim, 1);
StartEvent();
}
@@ -580,9 +578,7 @@ public:
//at this point he divides himself in two parts
CastConsumingMadness();
DespawnDemon();
Creature* Copy = NULL;
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())
@@ -758,9 +754,7 @@ public:
if (!me->IsInCombat() && instance->GetGuidData(DATA_LEOTHERAS_EVENT_STARTER))
{
Unit* victim = NULL;
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);
}
@@ -778,10 +772,8 @@ public:
if (Mindblast_Timer <= diff)
{
Unit* target = NULL;
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

@@ -178,9 +178,7 @@ public:
//Charging_Timer
if (Charging_Timer <= diff)
{
Unit* target = NULL;
target = SelectTarget(SELECT_TARGET_RANDOM, 0);
if (target)
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
{
AttackStart(target);
DoCast(target, SPELL_BERSERKER_C);
@@ -290,9 +288,7 @@ public:
//DeathCoil Timer /need correct timer
if (DeathCoil_Timer <= diff)
{
Unit* target = NULL;
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

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

View File

@@ -94,7 +94,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 << "| ";