From f0e6b0f1abe2ff92d8a48c6c447d2d666051a8a7 Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Wed, 17 Jul 2024 00:17:49 +0200 Subject: [PATCH] chore(Core/GameObjectAI): Cleanup register macro (#19409) --- src/server/game/Scripting/ScriptDefines/GameObjectScript.h | 6 ++---- src/server/scripts/Northrend/AzjolNerub/ahnkahet/ahnkahet.h | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/server/game/Scripting/ScriptDefines/GameObjectScript.h b/src/server/game/Scripting/ScriptDefines/GameObjectScript.h index 4038eafac..418a28883 100644 --- a/src/server/game/Scripting/ScriptDefines/GameObjectScript.h +++ b/src/server/game/Scripting/ScriptDefines/GameObjectScript.h @@ -66,23 +66,21 @@ public: virtual GameObjectAI* GetAI(GameObject* /*go*/) const { return nullptr; } }; -// Cannot be used due gob scripts not working like this template class GenericGameObjectScript : public GameObjectScript { public: GenericGameObjectScript(char const* name) : GameObjectScript(name) { } - GameObjectAI* GetAI(GameObject* me) const override { return new AI(me); } + GameObjectAI* GetAI(GameObject* go) const override { return new AI(go); } }; #define RegisterGameObjectAI(ai_name) new GenericGameObjectScript(#ai_name) -// Cannot be used due gob scripts not working like this template class FactoryGameObjectScript : public GameObjectScript { public: FactoryGameObjectScript(char const* name) : GameObjectScript(name) {} - GameObjectAI* GetAI(GameObject* me) const override { return AIFactory(me); } + GameObjectAI* GetAI(GameObject* go) const override { return AIFactory(go); } }; #define RegisterGameObjectAIWithFactory(ai_name, factory_fn) new FactoryGameObjectScript(#ai_name) diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/ahnkahet.h b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/ahnkahet.h index ef352c14b..2add3a842 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/ahnkahet.h +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/ahnkahet.h @@ -83,6 +83,5 @@ inline AI* GetAhnKahetAI(T* obj) } #define RegisterAhnKahetCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetAhnKahetAI) -#define RegisterAhnKahetGameObjectAI(ai_name) RegisterGameObjectAIWithFactory(ai_name, GetAhnKahetAI) #endif // DEF_AHNKAHET_H