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.

(cherry picked from commit 0d5adf356e)
This commit is contained in:
treeston
2016-05-13 00:56:52 +02:00
committed by joschiwald
parent 473efd5f35
commit bef9683a30
2 changed files with 4 additions and 4 deletions

View File

@@ -654,8 +654,8 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
GameObject* FindNearestGameObject(uint32 entry, float range) const;
GameObject* FindNearestGameObjectOfType(GameobjectTypes type, float range) const;
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry = 0, float fMaxSearchRange = 250.0f) const;
void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry = 0, float fMaxSearchRange = 250.0f) const;
void GetPlayerListInGrid(std::list<Player*>& lList, float fMaxSearchRange) const;
void DestroyForNearbyPlayers();

View File

@@ -1267,7 +1267,7 @@ namespace Trinity
bool operator()(GameObject* go) const
{
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;
@@ -1286,7 +1286,7 @@ namespace Trinity
bool operator()(Unit* unit) const
{
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;