aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2016-06-06 09:16:59 +0200
committerShauren <shauren.trinity@gmail.com>2016-06-06 09:16:59 +0200
commit8396dabdad65fbe86c525584e38ccfacde85f9f1 (patch)
treefd91aa475c92e825c1ddf99b7d09406b2f6ce62e /src/server/scripts
parentd59bba3c5dcc0915247c86c4b89f0325b2af97be (diff)
Core/Misc: Fixed coverity issues
Uninitialized fields: CID 1354593, 1354595, 1354738 Unchecked return value: CID 1354558 Out of bounds access: CID 1352989, 1352993 Null pointer dereference: CID 1296286
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
index ef6ccf5bf4b..69dbc7bf9e6 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp
@@ -200,7 +200,7 @@ public:
if (zombie)
{
zombieToBeEatenGUID = zombie->GetGUID(); // save for later use
-
+
// the soon-to-be-eaten zombie should stop moving and stop attacking
zombie->AI()->SetData(DATA_ZOMBIE_STATE, STATE_ZOMBIE_TOBE_EATEN);
@@ -225,7 +225,7 @@ public:
case EVENT_KILL_ZOMBIE_SINGLE:
{
Creature* zombieToBeEaten = ObjectAccessor::GetCreature(*me, zombieToBeEatenGUID);
- if (zombieToBeEaten && zombieToBeEaten->IsAlive() && zombieToBeEaten->IsWithinDistInMap(me, 10.0))
+ if (zombieToBeEaten && zombieToBeEaten->IsAlive() && zombieToBeEaten->IsWithinDistInMap(me, 10.0))
DoCast(zombieToBeEaten, SPELL_ZOMBIE_CHOW_SEARCH_SINGLE); // do the killing + healing in done inside by spell script see below.
zombieToBeEatenGUID = ObjectGuid::Empty;
@@ -249,11 +249,11 @@ public:
if (zombie && zombie->IsAlive() && zombie->GetExactDist2d(me) > 18.0)
zombie = nullptr;
}
-
+
if (zombie) // cast the aoe spell only if at least one zombie is found nearby
{
Talk(EMOTE_DEVOURS_ALL);
- DoCastAOE(SPELL_ZOMBIE_CHOW_SEARCH_MULTI);
+ DoCastAOE(SPELL_ZOMBIE_CHOW_SEARCH_MULTI);
}
break;
}
@@ -269,7 +269,7 @@ public:
me->GetMotionMaster()->MoveIdle();
events.ScheduleEvent(EVENT_KILL_ZOMBIE_SINGLE, Seconds(1));
}
-
+
}
void DoAction(int32 action) override
@@ -405,17 +405,19 @@ public:
if (state == STATE_ZOMBIE_DECIMATED)
{
timer += diff;
- Creature* gluth = ObjectAccessor::GetCreature(*me, GluthGUID);
// Putting this in the UpdateAI loop fixes an issue where death gripping a decimated zombie would make the zombie stand still until the rest of the fight.
// Also fix the issue where if one or more zombie is rooted when decimates hits (and MovePoint() is called), the zombie teleport to the boss. pretty weird behavior.
- if (gluth && timer>1600 && me->GetExactDist2d(gluth) > 10.0 && me->CanFreeMove()) // it takes about 1600 ms for the animation to cycle. This way, the animation looks relatively smooth.
+ if (Creature* gluth = ObjectAccessor::GetCreature(*me, GluthGUID))
{
- me->GetMotionMaster()->MovePoint(0, gluth->GetPosition()); // isn't dynamic. So, to take into account Gluth's movement, it must be called periodicly.
- timer = 0;
- }
+ if (timer > 1600 && me->GetExactDist2d(gluth) > 10.0 && me->CanFreeMove()) // it takes about 1600 ms for the animation to cycle. This way, the animation looks relatively smooth.
+ {
+ me->GetMotionMaster()->MovePoint(0, gluth->GetPosition()); // isn't dynamic. So, to take into account Gluth's movement, it must be called periodicly.
+ timer = 0;
+ }
- if (me->GetExactDist2d(gluth) <= 10.0)
- me->StopMoving();
+ if (me->GetExactDist2d(gluth) <= 10.0)
+ me->StopMoving();
+ }
}
else if (state == STATE_ZOMBIE_NORMAL)
DoMeleeAttackIfReady();
@@ -430,10 +432,10 @@ public:
{
me->SetReactState(ReactStates::REACT_PASSIVE);
me->AttackStop();
- me->SetTarget(ObjectGuid::Empty);
+ me->SetTarget(ObjectGuid::Empty);
// at this point, the zombie should be non attacking and non moving.
- me->SetWalk(true); // it doesnt seem to work with MoveFollow() (but it does work with MovePoint()).
+ me->SetWalk(true); // it doesnt seem to work with MoveFollow() (but it does work with MovePoint()).
timer = 1000;
}