From 3744c141841917075c295c3c38643e3d156eb9d4 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sun, 29 Dec 2013 01:19:52 +0100 Subject: Scripts/Misc: Ensure Creatures are in instances when required Create ScriptedAIs that require a InstanceScript reference only if the InstanceScript exists, so if these Creatures are in an instance. ScriptedAIs that don't require a InstanceScript reference have not been modified. This fixes many possible NULL dereference crashes happening when spawning a scripted Creature outside of an instance. Fixed a GetOwner() and a ToPlayer() NULL dereference crashes too. --- src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp | 2 +- .../scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp | 2 +- .../scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp | 2 +- src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp | 2 +- .../scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp | 2 +- .../scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/server/scripts/EasternKingdoms/Stratholme') diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp index 16ec442d963..04edf4e3f43 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp @@ -68,7 +68,7 @@ public: CreatureAI* GetAI(Creature* creature) const OVERRIDE { - return new boss_baron_rivendareAI(creature); + return GetInstanceAI(creature); } struct boss_baron_rivendareAI : public ScriptedAI diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp index 1812e2efd8d..2f5750b6141 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp @@ -42,7 +42,7 @@ public: CreatureAI* GetAI(Creature* creature) const OVERRIDE { - return new boss_baroness_anastariAI(creature); + return GetInstanceAI(creature); } struct boss_baroness_anastariAI : public ScriptedAI diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp index 0f8340891a8..57bd138e7e1 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp @@ -43,7 +43,7 @@ public: CreatureAI* GetAI(Creature* creature) const OVERRIDE { - return new boss_maleki_the_pallidAI(creature); + return GetInstanceAI(creature); } struct boss_maleki_the_pallidAI : public ScriptedAI diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp index 2cacf80e27c..2eb5d6024d4 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp @@ -42,7 +42,7 @@ public: CreatureAI* GetAI(Creature* creature) const OVERRIDE { - return new boss_nerubenkanAI(creature); + return GetInstanceAI(creature); } struct boss_nerubenkanAI : public ScriptedAI diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp index 706c2e7b6fb..b5d03ae9261 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp @@ -58,7 +58,7 @@ public: CreatureAI* GetAI(Creature* creature) const OVERRIDE { - return new boss_silver_hand_bossesAI(creature); + return GetInstanceAI(creature); } struct boss_silver_hand_bossesAI : public ScriptedAI diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp index 79b8dd7dfe2..17eebf227e8 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp @@ -45,7 +45,7 @@ public: CreatureAI* GetAI(Creature* creature) const OVERRIDE { - return new boss_ramstein_the_gorgerAI(creature); + return GetInstanceAI(creature); } struct boss_ramstein_the_gorgerAI : public ScriptedAI -- cgit v1.2.3