aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2019-01-13 20:25:02 +0100
committerGitHub <noreply@github.com>2019-01-13 20:25:02 +0100
commit8f9654d8176646c3076482477fc4b91011fb83cc (patch)
treecd985399d4c8de1381198f84a5898d875ea6010f /src/server/scripts
parenta8558c4361a7e3560c094886ef3072d46c64de44 (diff)
3.3.5 UnitAI (#22911)
* Core/AI: Revamp how UnitAI changes are applied Revamp how UnitAI changes are applied by storing current AI in a variable and all previous AIs plus current in a stack. The callers can push/pop AIs on the stack that will take effect only in next Unit::Update() call. The current AI will be a valid object for the whole duration of Unit::Update() and until next Unit::Update() call. * Core/AI: Apply new AI change code * Core/AI: Fix build * Core/AI: Fix crash on Creature::AIM_Create() * Core/AI: Fix crash * Core/AI: Restore ASSERT * Core/AI: Fix UnitAI not being popped properly when restoring a charmed AI
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp4
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
index a813c84994c..f76da2e1c95 100644
--- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp
@@ -447,7 +447,7 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader
return;
Player* pTarget = GetTarget()->ToPlayer();
- GetTarget()->SetAI(new player_overlord_brandAI(pTarget, GetCasterGUID()));
+ GetTarget()->PushAI(new player_overlord_brandAI(pTarget, GetCasterGUID()));
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -455,7 +455,7 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader
if (GetTarget()->GetTypeId() != TYPEID_PLAYER)
return;
- GetTarget()->SetAI(nullptr);
+ GetTarget()->PopAI();
}
void Register() override
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp
index 43020beaa9b..5739c27ee33 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -2914,14 +2914,14 @@ public:
if (ghoulGuid.IsEmpty())
return;
- player->SetAI(new player_ghoulAI(player, ghoulGuid));
+ player->PushAI(new player_ghoulAI(player, ghoulGuid));
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Player* player = GetTarget()->ToPlayer();
- player->SetAI(nullptr);
+ player->PopAI();
// Dismiss ghoul if necessary
if (Creature* ghoul = ObjectAccessor::GetCreature(*player, ghoulGuid))