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

@@ -149,22 +149,11 @@ public:
for (uint8 i = 2; i < StormCount; ++i)
bp0 *= 2;
CellCoord p(Acore::ComputeCellCoord(me->GetPositionX(), me->GetPositionY()));
Cell cell(p);
cell.SetNoCreate();
std::list<Unit*> tempUnitMap;
{
Acore::AnyAoETargetUnitInObjectRangeCheck u_check(me, me, SIZE_OF_GRIDS);
Acore::UnitListSearcher<Acore::AnyAoETargetUnitInObjectRangeCheck> searcher(me, tempUnitMap, u_check);
TypeContainerVisitor<Acore::UnitListSearcher<Acore::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
TypeContainerVisitor<Acore::UnitListSearcher<Acore::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
cell.Visit(p, world_unit_searcher, *me->GetMap(), *me, SIZE_OF_GRIDS);
cell.Visit(p, grid_unit_searcher, *me->GetMap(), *me, SIZE_OF_GRIDS);
}
Acore::AnyAoETargetUnitInObjectRangeCheck u_check(me, me, SIZE_OF_GRIDS);
Acore::UnitListSearcher<Acore::AnyAoETargetUnitInObjectRangeCheck> searcher(me, tempUnitMap, u_check);
Cell::VisitAllObjects(me, searcher, SIZE_OF_GRIDS);
// deal damage
for (std::list<Unit*>::const_iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i)

View File

@@ -223,18 +223,9 @@ public:
float x, y, z;
me->GetPosition(x, y, z);
{
CellCoord pair(Acore::ComputeCellCoord(x, y));
Cell cell(pair);
cell.SetNoCreate();
Acore::AllCreaturesOfEntryInRange check(me, NPC_EGG, 100);
Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange> searcher(me, templist, check);
TypeContainerVisitor<Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher);
cell.Visit(pair, cSearcher, *me->GetMap(), *me, me->GetGridActivationRange());
}
Acore::AllCreaturesOfEntryInRange check(me, NPC_EGG, 100);
Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange> searcher(me, templist, check);
Cell::VisitGridObjects(me, searcher, me->GetGridActivationRange());
//TC_LOG_ERROR("scripts", "Eggs %d at middle", templist.size());
if (templist.empty())
@@ -256,18 +247,10 @@ public:
float x, y, z;
me->GetPosition(x, y, z);
{
CellCoord pair(Acore::ComputeCellCoord(x, y));
Cell cell(pair);
cell.SetNoCreate();
Acore::AllCreaturesOfEntryInRange check(me, NPC_FIRE_BOMB, 100);
Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange> searcher(me, templist, check);
Cell::VisitGridObjects(me, searcher, me->GetGridActivationRange());
Acore::AllCreaturesOfEntryInRange check(me, NPC_FIRE_BOMB, 100);
Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange> searcher(me, templist, check);
TypeContainerVisitor<Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher);
cell.Visit(pair, cSearcher, *me->GetMap(), *me, me->GetGridActivationRange());
}
for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i)
{
(*i)->CastSpell(*i, SPELL_FIRE_BOMB_DAMAGE, true);
@@ -517,18 +500,9 @@ public:
float x, y, z;
me->GetPosition(x, y, z);
{
CellCoord pair(Acore::ComputeCellCoord(x, y));
Cell cell(pair);
cell.SetNoCreate();
Acore::AllCreaturesOfEntryInRange check(me, 23817, 50);
Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange> searcher(me, templist, check);
TypeContainerVisitor<Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher);
cell.Visit(pair, cSearcher, *(me->GetMap()), *me, me->GetGridActivationRange());
}
Acore::AllCreaturesOfEntryInRange check(me, 23817, 50);
Acore::CreatureListSearcher<Acore::AllCreaturesOfEntryInRange> searcher(me, templist, check);
Cell::VisitGridObjects(me, searcher, me->GetGridActivationRange());
//TC_LOG_ERROR("scripts", "Eggs %d at %d", templist.size(), side);