aboutsummaryrefslogtreecommitdiff
path: root/src/game/GridNotifiers.h
diff options
context:
space:
mode:
authorKudlaty <none@none>2009-07-24 05:27:49 +0200
committerKudlaty <none@none>2009-07-24 05:27:49 +0200
commit607dfaf8c9cf723a9a2244f88de506b609651341 (patch)
treebc905c394fd8a1fdf5cf6f3dadc505bbb259b78b /src/game/GridNotifiers.h
parentff1b2ed88c11927b8fdbfee34086e1c7dab05167 (diff)
Merge [SD2]
r1088 Add grid searcher class PlayerAtMinimumRangeAway and create ScriptedAI function GetPlayerAtMinimumRange that return player in grid with at least the defined range away from m_creature. r1089 Remove no longer needed grid search code and use function instead. - skip r1090 Rename and clarify function variables - skip r1091 Add two new grid search functions to return list of creature and gameobject. Remove unused class. r1092 Remove more grid search code in scripts and use functions instead. r1093 Remove obsolete grid search class and rename new to a more consistent name. r1094 Speed up functions GetCreature/GameObjectListWithEntryInGrid a bit --HG-- branch : trunk
Diffstat (limited to 'src/game/GridNotifiers.h')
-rw-r--r--src/game/GridNotifiers.h61
1 files changed, 41 insertions, 20 deletions
diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h
index 64deb0d3123..997f0806369 100644
--- a/src/game/GridNotifiers.h
+++ b/src/game/GridNotifiers.h
@@ -1135,48 +1135,69 @@ namespace Trinity
Unit const* pUnit;
};
- class AllGameObjectsWithEntryInGrid
+ class AllGameObjectsWithEntryInRange
{
public:
- AllGameObjectsWithEntryInGrid(uint32 ent) : entry(ent) {}
- bool operator() (GameObject* g)
+ AllGameObjectsWithEntryInRange(const WorldObject* pObject, uint32 uiEntry, float fMaxRange) : m_pObject(pObject), m_uiEntry(uiEntry), m_fRange(fMaxRange) {}
+ bool operator() (GameObject* pGo)
{
- if(g->GetEntry() == entry)
+ if (pGo->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(pGo,m_fRange,false))
return true;
return false;
}
private:
- uint32 entry;
+ const WorldObject* m_pObject;
+ uint32 m_uiEntry;
+ float m_fRange;
};
- class GameObjectInRangeCheck
+ class AllCreaturesOfEntryInRange
{
- public:
- GameObjectInRangeCheck(float _x, float _y, float _z, float _range) : x(_x), y(_y), z(_z), range(_range) {}
- bool operator() (GameObject* go)
- {
- return go->IsInRange(x, y, z, range);
- }
- private:
- float x, y, z, range;
+ public:
+ AllCreaturesOfEntryInRange(const WorldObject* pObject, uint32 uiEntry, float fMaxRange) : m_pObject(pObject), m_uiEntry(uiEntry), m_fRange(fMaxRange) {}
+ bool operator() (Unit* pUnit)
+ {
+ if (pUnit->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(pUnit,m_fRange,false))
+ return true;
+
+ return false;
+ }
+
+ private:
+ const WorldObject* m_pObject;
+ uint32 m_uiEntry;
+ float m_fRange;
};
- class AllCreaturesOfEntryInRange
+ class PlayerAtMinimumRangeAway
{
public:
- AllCreaturesOfEntryInRange(Unit const* obj, uint32 ent, float ran) : pUnit(obj), entry(ent), range(ran) {}
- bool operator() (Unit* u)
+ PlayerAtMinimumRangeAway(Unit const* unit, float fMinRange) : pUnit(unit), fRange(fMinRange) {}
+ bool operator() (Player* pPlayer)
{
- if(u->GetEntry() == entry && pUnit->IsWithinDistInMap(u, range))
+ //No threat list check, must be done explicit if expected to be in combat with creature
+ if (!pPlayer->isGameMaster() && pPlayer->isAlive() && !pUnit->IsWithinDist(pPlayer,fRange,false))
return true;
return false;
}
+
private:
Unit const* pUnit;
- uint32 entry;
- float range;
+ float fRange;
+ };
+
+ class GameObjectInRangeCheck
+ {
+ public:
+ GameObjectInRangeCheck(float _x, float _y, float _z, float _range) : x(_x), y(_y), z(_z), range(_range) {}
+ bool operator() (GameObject* go)
+ {
+ return go->IsInRange(x, y, z, range);
+ }
+ private:
+ float x, y, z, range;
};
// Player checks and do