diff options
author | ariel- <ariel-@users.noreply.github.com> | 2016-10-13 22:44:59 -0300 |
---|---|---|
committer | ariel- <ariel-@users.noreply.github.com> | 2016-10-13 22:44:59 -0300 |
commit | 271dd0788d1c01adbb741c1d9b3686f80978ddbc (patch) | |
tree | 9f537b21ba2bfe4a6a1896e5f3669d9ebc81bb80 /src | |
parent | 4b5350c0a64b3483959fa80794715b2a9e0a0c0c (diff) |
Core/AI: added container independent wrappers for WorldObject::GetxxxInGrid
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 26 | ||||
-rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedCreature.h | 32 |
2 files changed, 27 insertions, 31 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 241441db958..e697a8d270f 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -635,29 +635,3 @@ void WorldBossAI::UpdateAI(uint32 diff) DoMeleeAttackIfReady(); } - -// SD2 grid searchers. -Creature* GetClosestCreatureWithEntry(WorldObject* source, uint32 entry, float maxSearchRange, bool alive /*= true*/) -{ - return source->FindNearestCreature(entry, maxSearchRange, alive); -} - -GameObject* GetClosestGameObjectWithEntry(WorldObject* source, uint32 entry, float maxSearchRange) -{ - return source->FindNearestGameObject(entry, maxSearchRange); -} - -void GetCreatureListWithEntryInGrid(std::list<Creature*>& list, WorldObject* source, uint32 entry, float maxSearchRange) -{ - source->GetCreatureListWithEntryInGrid(list, entry, maxSearchRange); -} - -void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& list, WorldObject* source, uint32 entry, float maxSearchRange) -{ - source->GetGameObjectListWithEntryInGrid(list, entry, maxSearchRange); -} - -void GetPlayerListInGrid(std::list<Player*>& list, WorldObject* source, float maxSearchRange) -{ - source->GetPlayerListInGrid(list, maxSearchRange); -} diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index 08cc4fa3960..37a7020752b 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -417,10 +417,32 @@ class TC_GAME_API WorldBossAI : public ScriptedAI }; // SD2 grid searchers. -TC_GAME_API Creature* GetClosestCreatureWithEntry(WorldObject* source, uint32 entry, float maxSearchRange, bool alive = true); -TC_GAME_API GameObject* GetClosestGameObjectWithEntry(WorldObject* source, uint32 entry, float maxSearchRange); -TC_GAME_API void GetCreatureListWithEntryInGrid(std::list<Creature*>& list, WorldObject* source, uint32 entry, float maxSearchRange); -TC_GAME_API void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& list, WorldObject* source, uint32 entry, float maxSearchRange); -TC_GAME_API void GetPlayerListInGrid(std::list<Player*>& list, WorldObject* source, float maxSearchRange); +inline Creature* GetClosestCreatureWithEntry(WorldObject* source, uint32 entry, float maxSearchRange, bool alive = true) +{ + return source->FindNearestCreature(entry, maxSearchRange, alive); +} + +inline GameObject* GetClosestGameObjectWithEntry(WorldObject* source, uint32 entry, float maxSearchRange) +{ + return source->FindNearestGameObject(entry, maxSearchRange); +} + +template <typename Container> +inline void GetCreatureListWithEntryInGrid(Container& container, WorldObject* source, uint32 entry, float maxSearchRange) +{ + source->GetCreatureListWithEntryInGrid(container, entry, maxSearchRange); +} + +template <typename Container> +inline void GetGameObjectListWithEntryInGrid(Container& container, WorldObject* source, uint32 entry, float maxSearchRange) +{ + source->GetGameObjectListWithEntryInGrid(container, entry, maxSearchRange); +} + +template <typename Container> +inline void GetPlayerListInGrid(Container& container, WorldObject* source, float maxSearchRange) +{ + source->GetPlayerListInGrid(container, maxSearchRange); +} #endif // SCRIPTEDCREATURE_H_ |