refactor(Core/Grids): Ported cmangos/mangos-wotlk@ea99457 (#6113)

* refactor(Core/Grids): Ported cmangos/mangos-wotlk@ea99457

(cherry picked from commit d6201e5dbb)
Co-Authored-By: Shauren <shauren.trinity@gmail.com>
Co-Authored-By: SilverIce <slifeleaf@gmail.com>

* Update CellImpl.h

* w

* more more brackets

* ew

* fix build
This commit is contained in:
Kitzunu
2021-06-03 05:27:51 +02:00
committed by GitHub
parent cc28cf6bf0
commit 7152ddc82c
46 changed files with 238 additions and 361 deletions

View File

@@ -888,17 +888,12 @@ void hyjalAI::JustDied(Unit* /*killer*/)
void hyjalAI::HideNearPos(float x, float y)
{
CellCoord pair(Acore::ComputeCellCoord(x, y));
Cell cell(pair);
cell.SetNoCreate();
// First get all creatures.
std::list<Creature*> creatures;
Acore::AllFriendlyCreaturesInGrid creature_check(me);
Acore::CreatureListSearcher<Acore::AllFriendlyCreaturesInGrid> creature_searcher(me, creatures, creature_check);
TypeContainerVisitor <Acore::CreatureListSearcher<Acore::AllFriendlyCreaturesInGrid>, GridTypeMapContainer> creature_visitor(creature_searcher);
cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange());
Cell::VisitGridObjects(x, y, me->GetMap(), creature_searcher, me->GetGridActivationRange());
if (!creatures.empty())
{
@@ -912,14 +907,9 @@ void hyjalAI::HideNearPos(float x, float y)
void hyjalAI::RespawnNearPos(float x, float y)
{
CellCoord p(Acore::ComputeCellCoord(x, y));
Cell cell(p);
cell.SetNoCreate();
Acore::RespawnDo u_do;
Acore::WorldObjectWorker<Acore::RespawnDo> worker(me, u_do);
TypeContainerVisitor<Acore::WorldObjectWorker<Acore::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
cell.Visit(p, obj_worker, *me->GetMap(), *me, me->GetGridActivationRange());
Cell::VisitGridObjects(x, y, me->GetMap(), worker, me->GetGridActivationRange());
}
void hyjalAI::WaypointReached(uint32 waypointId)
@@ -943,19 +933,11 @@ void hyjalAI::WaypointReached(uint32 waypointId)
}
//do some talking
//all alive guards walk near here
CellCoord pair(Acore::ComputeCellCoord(me->GetPositionX(), me->GetPositionY()));
Cell cell(pair);
cell.SetNoCreate();
// First get all creatures.
std::list<Creature*> creatures;
Acore::AllFriendlyCreaturesInGrid creature_check(me);
Acore::CreatureListSearcher<Acore::AllFriendlyCreaturesInGrid> creature_searcher(me, creatures, creature_check);
TypeContainerVisitor
<Acore::CreatureListSearcher<Acore::AllFriendlyCreaturesInGrid>,
GridTypeMapContainer> creature_visitor(creature_searcher);
cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange());
Cell::VisitGridObjects(me, creature_searcher, me->GetGridActivationRange());
if (!creatures.empty())
{
@@ -984,18 +966,10 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
{
if (TeleportTimer <= diff)
{
CellCoord pair(Acore::ComputeCellCoord(me->GetPositionX(), me->GetPositionY()));
Cell cell(pair);
cell.SetNoCreate();
std::list<Creature*> creatures;
Acore::AllFriendlyCreaturesInGrid creature_check(me);
Acore::CreatureListSearcher<Acore::AllFriendlyCreaturesInGrid> creature_searcher(me, creatures, creature_check);
TypeContainerVisitor
<Acore::CreatureListSearcher<Acore::AllFriendlyCreaturesInGrid>,
GridTypeMapContainer> creature_visitor(creature_searcher);
cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange());
Cell::VisitGridObjects(me, creature_searcher, me->GetGridActivationRange());
if (!creatures.empty())
{

View File

@@ -182,7 +182,7 @@ public:
std::list<WorldObject*> ClusterList;
Acore::AllWorldObjectsInRange objects(me, 50.0f);
Acore::WorldObjectListSearcher<Acore::AllWorldObjectsInRange> searcher(me, ClusterList, objects);
me->VisitNearbyObject(50.0f, searcher);
Cell::VisitAllObjects(me, searcher, 50.0f);
for (std::list<WorldObject*>::const_iterator itr = ClusterList.begin(); itr != ClusterList.end(); ++itr)
{
if (Player* player = (*itr)->ToPlayer())

View File

@@ -141,7 +141,7 @@ public:
std::list<WorldObject*> cagesList;
Acore::AllWorldObjectsInRange objects(GetCaster(), 15.0f);
Acore::WorldObjectListSearcher<Acore::AllWorldObjectsInRange> searcher(GetCaster(), cagesList, objects);
GetCaster()->VisitNearbyObject(15.0f, searcher);
Cell::VisitAllObjects(GetCaster(), searcher, 15.0f);
for (std::list<WorldObject*>::const_iterator itr = cagesList.begin(); itr != cagesList.end(); ++itr)
{
if (GameObject* go = (*itr)->ToGameObject())

View File

@@ -313,7 +313,7 @@ public:
std::list<Player*> playerOnQuestList;
Acore::AnyPlayerInObjectRangeCheck checker(me, 5.0f);
Acore::PlayerListSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(me, playerOnQuestList, checker);
me->VisitNearbyWorldObject(5.0f, searcher);
Cell::VisitWorldObjects(me, searcher, 5.0f);
for (std::list<Player*>::const_iterator itr = playerOnQuestList.begin(); itr != playerOnQuestList.end(); ++itr)
{
// Check if found player target has active quest