From ef80fbd6c0af40c8a1e4469d04755a0bce8b5990 Mon Sep 17 00:00:00 2001 From: treeston Date: Fri, 13 May 2016 00:56:52 +0200 Subject: [PATCH] Core/Scripts: Added reasonable default params to GetCreatureListWithEntryInGrid/GetGameObjectListWithEntryInGrid for ease of use. Also, entry = 0 means no filter now, since we lacked an easy way to get a list of all creatures in grid. --- src/server/game/Entities/Object/Object.h | 4 ++-- src/server/game/Grids/Notifiers/GridNotifiers.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 50be3292346..8607856ab6c 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -586,8 +586,8 @@ class WorldObject : public Object, public WorldLocation GameObject* FindNearestGameObject(uint32 entry, float range) const; GameObject* FindNearestGameObjectOfType(GameobjectTypes type, float range) const; - void GetGameObjectListWithEntryInGrid(std::list& lList, uint32 uiEntry, float fMaxSearchRange) const; - void GetCreatureListWithEntryInGrid(std::list& lList, uint32 uiEntry, float fMaxSearchRange) const; + void GetGameObjectListWithEntryInGrid(std::list& lList, uint32 uiEntry = 0, float fMaxSearchRange = 250.0f) const; + void GetCreatureListWithEntryInGrid(std::list& lList, uint32 uiEntry = 0, float fMaxSearchRange = 250.0f) const; void GetPlayerListInGrid(std::list& lList, float fMaxSearchRange) const; void DestroyForNearbyPlayers(); diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index b943d44574f..79e01e2f029 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -1250,7 +1250,7 @@ namespace Trinity AllGameObjectsWithEntryInRange(const WorldObject* object, uint32 entry, float maxRange) : m_pObject(object), m_uiEntry(entry), m_fRange(maxRange) { } bool operator() (GameObject* go) { - if (go->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(go, m_fRange, false)) + if ((!m_uiEntry || go->GetEntry() == m_uiEntry) && m_pObject->IsWithinDist(go, m_fRange, false)) return true; return false; @@ -1267,7 +1267,7 @@ namespace Trinity AllCreaturesOfEntryInRange(const WorldObject* object, uint32 entry, float maxRange) : m_pObject(object), m_uiEntry(entry), m_fRange(maxRange) { } bool operator() (Unit* unit) { - if (unit->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(unit, m_fRange, false)) + if ((!m_uiEntry || unit->GetEntry() == m_uiEntry) && m_pObject->IsWithinDist(unit, m_fRange, false)) return true; return false;