aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/CreatureAIImpl.h
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-06-19 23:20:06 -0300
committerariel- <ariel-@users.noreply.github.com>2017-06-19 23:20:06 -0300
commit85a7d5ce9ac68b30da2277cc91d4b70358f1880d (patch)
treedf3d2084ee2e35008903c03178039b9c986e2d08 /src/server/game/AI/CreatureAIImpl.h
parent052fc24315ace866ea1cf610e85df119b68100c9 (diff)
Core: ported headers cleanup from master branch
Diffstat (limited to 'src/server/game/AI/CreatureAIImpl.h')
-rw-r--r--src/server/game/AI/CreatureAIImpl.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h
index e0346eac10a..b2036d815bd 100644
--- a/src/server/game/AI/CreatureAIImpl.h
+++ b/src/server/game/AI/CreatureAIImpl.h
@@ -17,17 +17,13 @@
#ifndef CREATUREAIIMPL_H
#define CREATUREAIIMPL_H
-#include "Common.h"
-#include "Define.h"
-#include "TemporarySummon.h"
-#include "CreatureAI.h"
-#include "SpellMgr.h"
-
-#include <functional>
+#include "Random.h"
#include <type_traits>
+class WorldObject;
+
template<typename First, typename Second, typename... Rest>
-static inline First const& RAND(First const& first, Second const& second, Rest const&... rest)
+inline First const& RAND(First const& first, Second const& second, Rest const&... rest)
{
std::reference_wrapper<typename std::add_const<First>::type> const pack[] = { first, second, rest... };
return pack[urand(0, sizeof...(rest) + 1)].get();
@@ -65,5 +61,15 @@ struct AISpellInfoType
AISpellInfoType* GetAISpellInfo(uint32 i);
-#endif
+TC_GAME_API bool InstanceHasScript(WorldObject const* obj, char const* scriptName);
+
+template <class AI, class T>
+AI* GetInstanceAI(T* obj, char const* scriptName)
+{
+ if (InstanceHasScript(obj, scriptName))
+ return new AI(obj);
+
+ return nullptr;
+}
+#endif