aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Events
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2014-09-04 23:05:03 +0200
committerjackpoz <giacomopoz@gmail.com>2014-09-05 22:44:24 +0200
commit6df2ff5efa0a84c5423804d713acd0e8952db86e (patch)
tree75e8fa91a6ea2ceb502356e7ee804fc6993a2ef0 /src/server/scripts/Events
parentd3a50ffb59f315d43c9ba93d5909887c6abe3685 (diff)
Core/Misc: Refactor scripts to fix static analysis warnings
Third batch of fixes targeting 100 issues reported by Coverity
Diffstat (limited to 'src/server/scripts/Events')
-rw-r--r--src/server/scripts/Events/childrens_week.cpp82
1 files changed, 67 insertions, 15 deletions
diff --git a/src/server/scripts/Events/childrens_week.cpp b/src/server/scripts/Events/childrens_week.cpp
index 683b8d36011..6a338c2f03a 100644
--- a/src/server/scripts/Events/childrens_week.cpp
+++ b/src/server/scripts/Events/childrens_week.cpp
@@ -150,9 +150,12 @@ class npc_winterfin_playmate : public CreatureScript
struct npc_winterfin_playmateAI : public ScriptedAI
{
- npc_winterfin_playmateAI(Creature* creature) : ScriptedAI(creature) { }
+ npc_winterfin_playmateAI(Creature* creature) : ScriptedAI(creature)
+ {
+ Initialize();
+ }
- void Reset()
+ void Initialize()
{
timer = 0;
phase = 0;
@@ -160,6 +163,11 @@ class npc_winterfin_playmate : public CreatureScript
orphanGUID = 0;
}
+ void Reset()
+ {
+ Initialize();
+ }
+
void MoveInLineOfSight(Unit* who) override
{
@@ -249,9 +257,12 @@ class npc_snowfall_glade_playmate : public CreatureScript
struct npc_snowfall_glade_playmateAI : public ScriptedAI
{
- npc_snowfall_glade_playmateAI(Creature* creature) : ScriptedAI(creature) { }
+ npc_snowfall_glade_playmateAI(Creature* creature) : ScriptedAI(creature)
+ {
+ Initialize();
+ }
- void Reset()
+ void Initialize()
{
timer = 0;
phase = 0;
@@ -259,6 +270,11 @@ class npc_snowfall_glade_playmate : public CreatureScript
orphanGUID = 0;
}
+ void Reset()
+ {
+ Initialize();
+ }
+
void MoveInLineOfSight(Unit* who) override
{
@@ -349,10 +365,11 @@ class npc_the_biggest_tree : public CreatureScript
{
npc_the_biggest_treeAI(Creature* creature) : ScriptedAI(creature)
{
+ Initialize();
me->SetDisplayId(DISPLAY_INVISIBLE);
}
- void Reset()
+ void Initialize()
{
timer = 1000;
phase = 0;
@@ -360,8 +377,12 @@ class npc_the_biggest_tree : public CreatureScript
orphanGUID = 0;
}
- void MoveInLineOfSight(Unit* who) override
+ void Reset()
+ {
+ Initialize();
+ }
+ void MoveInLineOfSight(Unit* who) override
{
if (!phase && who && who->GetDistance2d(me) < 10.0f)
if (Player* player = who->ToPlayer())
@@ -437,9 +458,12 @@ class npc_high_oracle_soo_roo : public CreatureScript
struct npc_high_oracle_soo_rooAI : public ScriptedAI
{
- npc_high_oracle_soo_rooAI(Creature* creature) : ScriptedAI(creature) { }
+ npc_high_oracle_soo_rooAI(Creature* creature) : ScriptedAI(creature)
+ {
+ Initialize();
+ }
- void Reset()
+ void Initialize()
{
timer = 0;
phase = 0;
@@ -447,6 +471,11 @@ class npc_high_oracle_soo_roo : public CreatureScript
orphanGUID = 0;
}
+ void Reset()
+ {
+ Initialize();
+ }
+
void MoveInLineOfSight(Unit* who) override
{
@@ -526,9 +555,12 @@ class npc_elder_kekek : public CreatureScript
struct npc_elder_kekekAI : public ScriptedAI
{
- npc_elder_kekekAI(Creature* creature) : ScriptedAI(creature) { }
+ npc_elder_kekekAI(Creature* creature) : ScriptedAI(creature)
+ {
+ Initialize();
+ }
- void Reset()
+ void Initialize()
{
timer = 0;
phase = 0;
@@ -536,6 +568,11 @@ class npc_elder_kekek : public CreatureScript
orphanGUID = 0;
}
+ void Reset()
+ {
+ Initialize();
+ }
+
void MoveInLineOfSight(Unit* who) override
{
@@ -615,9 +652,12 @@ class npc_the_etymidian : public CreatureScript
struct npc_the_etymidianAI : public ScriptedAI
{
- npc_the_etymidianAI(Creature* creature) : ScriptedAI(creature) { }
+ npc_the_etymidianAI(Creature* creature) : ScriptedAI(creature)
+ {
+ Initialize();
+ }
- void Reset()
+ void Initialize()
{
timer = 0;
phase = 0;
@@ -625,8 +665,12 @@ class npc_the_etymidian : public CreatureScript
orphanGUID = 0;
}
- void MoveInLineOfSight(Unit* who) override
+ void Reset()
+ {
+ Initialize();
+ }
+ void MoveInLineOfSight(Unit* who) override
{
if (!phase && who && who->GetDistance2d(me) < 10.0f)
if (Player* player = who->ToPlayer())
@@ -711,9 +755,12 @@ class npc_alexstraza_the_lifebinder : public CreatureScript
struct npc_alexstraza_the_lifebinderAI : public ScriptedAI
{
- npc_alexstraza_the_lifebinderAI(Creature* creature) : ScriptedAI(creature) { }
+ npc_alexstraza_the_lifebinderAI(Creature* creature) : ScriptedAI(creature)
+ {
+ Initialize();
+ }
- void Reset()
+ void Initialize()
{
timer = 0;
phase = 0;
@@ -721,6 +768,11 @@ class npc_alexstraza_the_lifebinder : public CreatureScript
orphanGUID = 0;
}
+ void Reset()
+ {
+ Initialize();
+ }
+
void SetData(uint32 type, uint32 data) override
{
// Existing SmartAI