From 080bf4c5650d54694819f6aaf7a12f3cbc623ef4 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 11 Mar 2023 13:37:03 +0100 Subject: Core/Scripts: Make CreatureAI::DoZoneInCombat overload accepting a different creature static --- src/server/game/AI/CreatureAI.cpp | 5 +---- src/server/game/AI/CreatureAI.h | 5 ++++- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 0ae258856a6..3f2aae8d2de 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -78,11 +78,8 @@ void CreatureAI::OnCharmed(bool isNew) UnitAI::OnCharmed(isNew); } -void CreatureAI::DoZoneInCombat(Creature* creature /*= nullptr*/) +void CreatureAI::DoZoneInCombat(Creature* creature) { - if (!creature) - creature = me; - Map* map = creature->GetMap(); if (!map->IsDungeon()) // use IsDungeon instead of Instanceable, in case battlegrounds will be instantiated { diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index a6c03467ca2..a36de96f8df 100644 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -155,7 +155,8 @@ class TC_GAME_API CreatureAI : public UnitAI // Called at reaching home after evade virtual void JustReachedHome() { } - void DoZoneInCombat(Creature* creature = nullptr); + void DoZoneInCombat() { DoZoneInCombat(me); } + static void DoZoneInCombat(Creature* creature); // Called at text emote receive from player virtual void ReceiveEmote(Player* /*player*/, uint32 /*emoteId*/) { } @@ -251,6 +252,8 @@ class TC_GAME_API CreatureAI : public UnitAI uint32 const _scriptId; bool _isEngaged; bool _moveInLOSLocked; + + friend Scripting::v2::ScriptedAI; }; #endif -- cgit v1.2.3