From ed884354944009979b828d21ee3498e830050af8 Mon Sep 17 00:00:00 2001 From: Giacomo Pozzoni Date: Sun, 13 Jan 2019 20:25:02 +0100 Subject: 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 (cherry picked from commit 8f9654d8176646c3076482477fc4b91011fb83cc) --- .../Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/server/scripts') 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 97c78e8f356..3bf56aa8f16 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -449,7 +449,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*/) @@ -457,7 +457,7 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - GetTarget()->SetAI(nullptr); + GetTarget()->PopAI(); } void Register() override -- cgit v1.2.3