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

@@ -2399,7 +2399,7 @@ void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, boo
UnitList targets;
Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(target, target, target->GetVisibilityRange()); // no VISIBILITY_COMPENSATION, distance is enough
Acore::UnitListSearcher<Acore::AnyUnfriendlyUnitInObjectRangeCheck> searcher(target, targets, u_check);
target->VisitNearbyObject(target->GetVisibilityRange(), searcher); // no VISIBILITY_COMPENSATION, distance is enough
Cell::VisitAllObjects(target, searcher, target->GetMap()->GetVisibilityRange());
for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter)
{
if (!(*iter)->HasUnitState(UNIT_STATE_CASTING))
@@ -5206,7 +5206,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
Player* player = nullptr;
Acore::AnyPlayerInObjectRangeCheck checker(target, 10.0f);
Acore::PlayerSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(target, player, checker);
target->VisitNearbyWorldObject(10.0f, searcher);
Cell::VisitWorldObjects(target, searcher, 10.0f);
if( player && player->GetGUID() != target->GetGUID() )
target->CastSpell(player, 52921, true);

View File

@@ -2652,7 +2652,7 @@ void UnitAura::FillTargetMap(std::map<Unit*, uint8>& targets, Unit* caster)
targetList.push_back(GetUnitOwner());
Acore::AnyGroupedUnitInObjectRangeCheck u_check(GetUnitOwner(), GetUnitOwner(), radius, GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_APPLY_AREA_AURA_RAID);
Acore::UnitListSearcher<Acore::AnyGroupedUnitInObjectRangeCheck> searcher(GetUnitOwner(), targetList, u_check);
GetUnitOwner()->VisitNearbyObject(radius, searcher);
Cell::VisitAllObjects(GetUnitOwner(), searcher, radius);
break;
}
case SPELL_EFFECT_APPLY_AREA_AURA_FRIEND:
@@ -2660,14 +2660,14 @@ void UnitAura::FillTargetMap(std::map<Unit*, uint8>& targets, Unit* caster)
targetList.push_back(GetUnitOwner());
Acore::AnyFriendlyUnitInObjectRangeCheck u_check(GetUnitOwner(), GetUnitOwner(), radius);
Acore::UnitListSearcher<Acore::AnyFriendlyUnitInObjectRangeCheck> searcher(GetUnitOwner(), targetList, u_check);
GetUnitOwner()->VisitNearbyObject(radius, searcher);
Cell::VisitAllObjects(GetUnitOwner(), searcher, radius);
break;
}
case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY:
{
Acore::AnyAoETargetUnitInObjectRangeCheck u_check(GetUnitOwner(), GetUnitOwner(), radius); // No GetCharmer in searcher
Acore::UnitListSearcher<Acore::AnyAoETargetUnitInObjectRangeCheck> searcher(GetUnitOwner(), targetList, u_check);
GetUnitOwner()->VisitNearbyObject(radius, searcher);
Cell::VisitAllObjects(GetUnitOwner(), searcher, radius);
break;
}
case SPELL_EFFECT_APPLY_AREA_AURA_PET:
@@ -2728,7 +2728,7 @@ void DynObjAura::FillTargetMap(std::map<Unit*, uint8>& targets, Unit* /*caster*/
{
Acore::AnyFriendlyUnitInObjectRangeCheck u_check(GetDynobjOwner(), dynObjOwnerCaster, radius);
Acore::UnitListSearcher<Acore::AnyFriendlyUnitInObjectRangeCheck> searcher(GetDynobjOwner(), targetList, u_check);
GetDynobjOwner()->VisitNearbyObject(radius, searcher);
Cell::VisitAllObjects(GetDynobjOwner(), searcher, radius);
}
// pussywizard: TARGET_DEST_DYNOBJ_NONE is supposed to search for both friendly and unfriendly targets, so for any unit
// what about EffectImplicitTargetA?
@@ -2736,13 +2736,13 @@ void DynObjAura::FillTargetMap(std::map<Unit*, uint8>& targets, Unit* /*caster*/
{
Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck u_check(GetDynobjOwner(), dynObjOwnerCaster, radius);
Acore::UnitListSearcher<Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck> searcher(GetDynobjOwner(), targetList, u_check);
GetDynobjOwner()->VisitNearbyObject(radius, searcher);
Cell::VisitAllObjects(GetDynobjOwner(), searcher, radius);
}
else
{
Acore::AnyAoETargetUnitInObjectRangeCheck u_check(GetDynobjOwner(), dynObjOwnerCaster, radius);
Acore::UnitListSearcher<Acore::AnyAoETargetUnitInObjectRangeCheck> searcher(GetDynobjOwner(), targetList, u_check);
GetDynobjOwner()->VisitNearbyObject(radius, searcher);
Cell::VisitAllObjects(GetDynobjOwner(), searcher, radius);
}
for (UnitList::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)

View File

@@ -1896,18 +1896,13 @@ void Spell::SearchTargets(SEARCHER& searcher, uint32 containerMask, Unit* refere
Cell cell(p);
cell.SetNoCreate();
Map& map = *(referer->GetMap());
Map* map = referer->GetMap();
if (searchInWorld)
{
TypeContainerVisitor<SEARCHER, WorldTypeMapContainer> world_object_notifier(searcher);
cell.Visit(p, world_object_notifier, map, radius + SPELL_SEARCHER_COMPENSATION, x, y);
}
Cell::VisitWorldObjects(x, y, map, searcher, radius);
if (searchInGrid)
{
TypeContainerVisitor<SEARCHER, GridTypeMapContainer > grid_object_notifier(searcher);
cell.Visit(p, grid_object_notifier, map, radius + SPELL_SEARCHER_COMPENSATION, x, y);
}
Cell::VisitGridObjects(x, y, map, searcher, radius);
}
}

View File

@@ -4297,7 +4297,7 @@ void Spell::EffectSanctuary(SpellEffIndex /*effIndex*/)
UnitList targets;
Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(unitTarget, unitTarget, unitTarget->GetVisibilityRange()); // no VISIBILITY_COMPENSATION, distance is enough
Acore::UnitListSearcher<Acore::AnyUnfriendlyUnitInObjectRangeCheck> searcher(unitTarget, targets, u_check);
unitTarget->VisitNearbyObject(unitTarget->GetVisibilityRange(), searcher); // no VISIBILITY_COMPENSATION, distance is enough
Cell::VisitAllObjects(unitTarget, searcher, unitTarget->GetVisibilityRange());
for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter)
{
if (!(*iter)->HasUnitState(UNIT_STATE_CASTING))
@@ -4943,7 +4943,7 @@ void Spell::EffectForceDeselect(SpellEffIndex /*effIndex*/)
float dist = m_caster->GetVisibilityRange() + VISIBILITY_COMPENSATION;
Acore::MessageDistDelivererToHostile notifier(m_caster, &data, dist);
m_caster->VisitNearbyWorldObject(dist, notifier);
Cell::VisitWorldObjects(m_caster, notifier, dist);
// xinef: we should also force pets to remove us from current target
Unit::AttackerSet attackerSet;
@@ -4968,7 +4968,7 @@ void Spell::EffectForceDeselect(SpellEffIndex /*effIndex*/)
UnitList targets;
Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(m_caster, m_caster, m_caster->GetVisibilityRange()); // no VISIBILITY_COMPENSATION, distance is enough
Acore::UnitListSearcher<Acore::AnyUnfriendlyUnitInObjectRangeCheck> searcher(m_caster, targets, u_check);
m_caster->VisitNearbyObject(m_caster->GetVisibilityRange(), searcher); // no VISIBILITY_COMPENSATION, distance is enough
Cell::VisitAllObjects(m_caster, searcher, m_caster->GetVisibilityRange());
for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter)
{
if (!(*iter)->HasUnitState(UNIT_STATE_CASTING))