aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Instances/InstanceScript.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Instances/InstanceScript.h')
-rw-r--r--src/server/game/Instances/InstanceScript.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h
index acc8012bbbc..ade08b3a35d 100644
--- a/src/server/game/Instances/InstanceScript.h
+++ b/src/server/game/Instances/InstanceScript.h
@@ -243,6 +243,16 @@ AI* GetInstanceAI(T* obj, char const* scriptName)
return new AI(obj);
return NULL;
-}
+};
+
+template<class AI, class T>
+AI* GetInstanceAI(T* obj)
+{
+ if (InstanceMap* instance = obj->GetMap()->ToInstanceMap())
+ if (instance->GetInstanceScript())
+ return new AI(obj);
+
+ return NULL;
+};
#endif // TRINITY_INSTANCE_DATA_H