-
Notifications
You must be signed in to change notification settings - Fork 203
Expand file tree
/
Copy pathsc_grid_searchers.h
More file actions
61 lines (47 loc) · 1.95 KB
/
Copy pathsc_grid_searchers.h
File metadata and controls
61 lines (47 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* This file is part of the ScriptDev2 Project. See AUTHORS file for Copyright information
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#ifndef SC_GRIDSEARCH_H
#define SC_GRIDSEARCH_H
#include "Object.h"
class GameObject;
class Creature;
struct ObjectDistanceOrder : public std::binary_function<const WorldObject, const WorldObject, bool>
{
const Unit* m_pSource;
ObjectDistanceOrder(const Unit* pSource) : m_pSource(pSource) {};
bool operator()(const WorldObject* pLeft, const WorldObject* pRight) const
{
return m_pSource->GetDistanceOrder(pLeft, pRight);
}
};
struct ObjectDistanceOrderReversed : public std::binary_function<const WorldObject, const WorldObject, bool>
{
const Unit* m_pSource;
ObjectDistanceOrderReversed(const Unit* pSource) : m_pSource(pSource) {};
bool operator()(const WorldObject* pLeft, const WorldObject* pRight) const
{
return !m_pSource->GetDistanceOrder(pLeft, pRight);
}
};
GameObject* GetClosestGameObjectWithEntry(WorldObject* pSource, uint32 uiEntry, float fMaxSearchRange);
Creature* GetClosestCreatureWithEntry(WorldObject* pSource, uint32 uiEntry, float fMaxSearchRange, bool bOnlyAlive = true, bool bOnlyDead = false, bool bExcludeSelf = false);
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList , WorldObject* pSource, uint32 uiEntry, float fMaxSearchRange);
void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, WorldObject* pSource, uint32 uiEntry, float fMaxSearchRange);
// Used in: hyjalAI.cpp
/*
class AllFriendlyCreaturesInGrid
{
public:
AllFriendlyCreaturesInGrid(Unit const* obj) : pUnit(obj) {}
bool operator() (Unit* u)
{
if (u->isAlive() && u->GetVisibility() == VISIBILITY_ON && u->IsFriendlyTo(pUnit))
return true;
return false;
}
private:
Unit const* pUnit;
};
*/
#endif