From dcf41256ddaa341b532bd7c565c3d18a7c3b6757 Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 10 May 2009 16:07:49 -0500 Subject: *Move some AI functions to core. No real change. --HG-- branch : trunk --- src/bindings/scripts/include/sc_creature.cpp | 1 - src/bindings/scripts/include/sc_creature.h | 76 +++++----------------------- 2 files changed, 13 insertions(+), 64 deletions(-) (limited to 'src/bindings/scripts') diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp index 4a9f8ec61e8..42ee15074ed 100644 --- a/src/bindings/scripts/include/sc_creature.cpp +++ b/src/bindings/scripts/include/sc_creature.cpp @@ -375,7 +375,6 @@ bool ScriptedAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered) return true; } - float GetSpellMaxRangeForHostile(uint32 id) { SpellEntry const *spellInfo = GetSpellStore()->LookupEntry(id); diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h index 44caf063162..8336df545b6 100644 --- a/src/bindings/scripts/include/sc_creature.h +++ b/src/bindings/scripts/include/sc_creature.h @@ -8,75 +8,25 @@ #ifndef SC_CREATURE_H #define SC_CREATURE_H -#include "CreatureAI.h" #include "Creature.h" - -#define HEROIC(n,h) (HeroicMode ? h : n) - -template -inline -const T& RAND(const T& v1, const T& v2) -{ - return rand()%2 ? v1 : v2; -} - -template -inline -const T& RAND(const T& v1, const T& v2, const T& v3) -{ - switch(rand()%3) - { - default: - case 0: return v1; - case 1: return v2; - case 2: return v3; - } -} - -template -inline -const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4) -{ - switch(rand()%4) - { - default: - case 0: return v1; - case 1: return v2; - case 2: return v3; - case 3: return v4; - } -} - -template -inline -const T& RAND(const T& v1, const T& v2, const T& v3, const T& v4, const T& v5) -{ - switch(rand()%4) - { - default: - case 0: return v1; - case 1: return v2; - case 2: return v3; - case 3: return v4; - case 4: return v5; - } -} - -float GetSpellMaxRangeForHostile(uint32 id); +#include "CreatureAI.h" +#include "CreatureAIImpl.h" class SummonList : private std::list { -public: - explicit SummonList(Creature* creature) : m_creature(creature) {} - void Summon(Creature *summon) { push_back(summon->GetGUID()); } - void Despawn(Creature *summon) { remove(summon->GetGUID()); } - void DespawnEntry(uint32 entry); - void DespawnAll(); - void DoAction(uint32 entry, uint32 info); -private: - Creature *m_creature; + public: + explicit SummonList(Creature* creature) : m_creature(creature) {} + void Summon(Creature *summon) { push_back(summon->GetGUID()); } + void Despawn(Creature *summon) { remove(summon->GetGUID()); } + void DespawnEntry(uint32 entry); + void DespawnAll(); + void DoAction(uint32 entry, uint32 info); + private: + Creature *m_creature; }; +float GetSpellMaxRangeForHostile(uint32 id); + //Get a single creature of given entry Unit* FindCreature(uint32 entry, float range, Unit* Finder); -- cgit v1.2.3