mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 13:46:24 +00:00
Revert Visibility Notifier changes (#17682)
* Revert "fix(Core/Grid): Implement missing GridUnload setting (#17569)" This reverts commit79b39f9655. * Revert "fix(Core/Grid): Address bugs and performance issues introduced by visibility notifier implementation (#17480)" This reverts commit60e27511c5. * Revert "fix(Core): GridCleanUpDelay Log (#17436)" This reverts commit90b16ca065. * Revert "feat(Core/Grids): Implement visibility notifier (#15919)" This reverts commit2779833768.
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Map.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "SpellInfo.h"
|
||||
@@ -24,10 +23,22 @@
|
||||
#include "Transport.h"
|
||||
#include "UpdateData.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "CellImpl.h"
|
||||
|
||||
using namespace Acore;
|
||||
|
||||
void VisibleNotifier::Visit(GameObjectMapType& m)
|
||||
{
|
||||
for (GameObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
GameObject* go = iter->GetSource();
|
||||
if (i_largeOnly != go->IsVisibilityOverridden())
|
||||
continue;
|
||||
|
||||
vis_guids.erase(go->GetGUID());
|
||||
i_player.UpdateVisibilityOf(go, i_data, i_visibleNow);
|
||||
}
|
||||
}
|
||||
|
||||
void VisibleNotifier::SendToSelf()
|
||||
{
|
||||
// at this moment i_clientGUIDs have guids that not iterate at grid level checks
|
||||
@@ -35,6 +46,9 @@ void VisibleNotifier::SendToSelf()
|
||||
if (Transport* transport = i_player.GetTransport())
|
||||
for (Transport::PassengerSet::const_iterator itr = transport->GetPassengers().begin(); itr != transport->GetPassengers().end(); ++itr)
|
||||
{
|
||||
if (i_largeOnly != (*itr)->IsVisibilityOverridden())
|
||||
continue;
|
||||
|
||||
if (vis_guids.find((*itr)->GetGUID()) != vis_guids.end())
|
||||
{
|
||||
vis_guids.erase((*itr)->GetGUID());
|
||||
@@ -51,9 +65,6 @@ void VisibleNotifier::SendToSelf()
|
||||
case TYPEID_UNIT:
|
||||
i_player.UpdateVisibilityOf((*itr)->ToCreature(), i_data, i_visibleNow);
|
||||
break;
|
||||
case TYPEID_DYNAMICOBJECT:
|
||||
i_player.UpdateVisibilityOf((*itr)->ToDynObject(), i_data, i_visibleNow);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -62,6 +73,12 @@ void VisibleNotifier::SendToSelf()
|
||||
|
||||
for (GuidUnorderedSet::const_iterator it = vis_guids.begin(); it != vis_guids.end(); ++it)
|
||||
{
|
||||
if (WorldObject* obj = ObjectAccessor::GetWorldObject(i_player, *it))
|
||||
{
|
||||
if (i_largeOnly != obj->IsVisibilityOverridden())
|
||||
continue;
|
||||
}
|
||||
|
||||
// pussywizard: static transports are removed only in RemovePlayerFromMap and here if can no longer detect (eg. phase changed)
|
||||
if ((*it).IsTransport())
|
||||
if (GameObject* staticTrans = i_player.GetMap()->GetGameObject(*it))
|
||||
@@ -86,8 +103,11 @@ void VisibleNotifier::SendToSelf()
|
||||
i_data.BuildPacket(&packet);
|
||||
i_player.GetSession()->SendPacket(&packet);
|
||||
|
||||
for (std::set<Unit*>::const_iterator it = i_visibleNow.begin(); it != i_visibleNow.end(); ++it)
|
||||
for (std::vector<Unit*>::const_iterator it = i_visibleNow.begin(); it != i_visibleNow.end(); ++it)
|
||||
{
|
||||
if (i_largeOnly != (*it)->IsVisibilityOverridden())
|
||||
continue;
|
||||
|
||||
i_player.GetInitialVisiblePackets(*it);
|
||||
}
|
||||
}
|
||||
@@ -158,23 +178,6 @@ void PlayerRelocationNotifier::Visit(PlayerMapType& m)
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerRelocationNotifier::Visit(CreatureMapType& m)
|
||||
{
|
||||
bool relocated_for_ai = (&i_player == i_player.m_seer);
|
||||
|
||||
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
Creature* c = iter->GetSource();
|
||||
|
||||
vis_guids.erase(c->GetGUID());
|
||||
|
||||
i_player.UpdateVisibilityOf(c, i_data, i_visibleNow);
|
||||
|
||||
if (relocated_for_ai && !c->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
|
||||
CreatureUnitRelocationWorker(c, &i_player);
|
||||
}
|
||||
}
|
||||
|
||||
void CreatureRelocationNotifier::Visit(PlayerMapType& m)
|
||||
{
|
||||
for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
@@ -191,58 +194,6 @@ void CreatureRelocationNotifier::Visit(PlayerMapType& m)
|
||||
}
|
||||
}
|
||||
|
||||
void CreatureRelocationNotifier::Visit(CreatureMapType& m)
|
||||
{
|
||||
if (!i_creature.IsAlive())
|
||||
return;
|
||||
|
||||
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
Creature* c = iter->GetSource();
|
||||
CreatureUnitRelocationWorker(&i_creature, c);
|
||||
|
||||
if (!c->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
|
||||
CreatureUnitRelocationWorker(c, &i_creature);
|
||||
}
|
||||
}
|
||||
|
||||
void DelayedUnitRelocation::Visit(CreatureMapType& m)
|
||||
{
|
||||
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
Creature* unit = iter->GetSource();
|
||||
if (!unit->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
|
||||
continue;
|
||||
|
||||
CreatureRelocationNotifier relocate(*unit);
|
||||
|
||||
TypeContainerVisitor<CreatureRelocationNotifier, WorldTypeMapContainer > c2world_relocation(relocate);
|
||||
TypeContainerVisitor<CreatureRelocationNotifier, GridTypeMapContainer > c2grid_relocation(relocate);
|
||||
|
||||
cell.Visit(p, c2world_relocation, i_map, *unit, i_radius);
|
||||
cell.Visit(p, c2grid_relocation, i_map, *unit, i_radius);
|
||||
}
|
||||
}
|
||||
|
||||
void DelayedUnitRelocation::Visit(PlayerMapType& m)
|
||||
{
|
||||
for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
Player* player = iter->GetSource();
|
||||
WorldObject const* viewPoint = player->m_seer;
|
||||
|
||||
if (!viewPoint->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
|
||||
continue;
|
||||
|
||||
if (player != viewPoint && !viewPoint->IsPositionValid())
|
||||
continue;
|
||||
|
||||
PlayerRelocationNotifier relocate(*player);
|
||||
Cell::VisitAllObjects(viewPoint, relocate, i_radius, false);
|
||||
relocate.SendToSelf();
|
||||
}
|
||||
}
|
||||
|
||||
void AIRelocationNotifier::Visit(CreatureMapType& m)
|
||||
{
|
||||
bool self = isCreature && !((Creature*)(&i_unit))->IsMoveInLineOfSightStrictlyDisabled();
|
||||
@@ -390,9 +341,14 @@ void MessageDistDelivererToHostile::Visit(DynamicObjectMapType& m)
|
||||
template<class T>
|
||||
void ObjectUpdater::Visit(GridRefMgr<T>& m)
|
||||
{
|
||||
for (typename GridRefMgr<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
if (iter->GetSource()->IsInWorld())
|
||||
iter->GetSource()->Update(i_timeDiff);
|
||||
T* obj;
|
||||
for (typename GridRefMgr<T>::iterator iter = m.begin(); iter != m.end(); )
|
||||
{
|
||||
obj = iter->GetSource();
|
||||
++iter;
|
||||
if (obj->IsInWorld() && (i_largeOnly == obj->IsVisibilityOverridden()))
|
||||
obj->Update(i_timeDiff);
|
||||
}
|
||||
}
|
||||
|
||||
bool AnyDeadUnitObjectInRangeCheck::operator()(Player* u)
|
||||
|
||||
@@ -42,10 +42,18 @@ namespace Acore
|
||||
{
|
||||
Player& i_player;
|
||||
GuidUnorderedSet vis_guids;
|
||||
std::set<Unit*> i_visibleNow;
|
||||
std::vector<Unit*>& i_visibleNow;
|
||||
bool i_gobjOnly;
|
||||
bool i_largeOnly;
|
||||
UpdateData i_data;
|
||||
|
||||
VisibleNotifier(Player& player) : i_player(player), vis_guids(player.m_clientGUIDs) {}
|
||||
VisibleNotifier(Player& player, bool gobjOnly, bool largeOnly) :
|
||||
i_player(player), vis_guids(player.m_clientGUIDs), i_visibleNow(player.m_newVisible), i_gobjOnly(gobjOnly), i_largeOnly(largeOnly)
|
||||
{
|
||||
i_visibleNow.clear();
|
||||
}
|
||||
|
||||
void Visit(GameObjectMapType&);
|
||||
template<class T> void Visit(GridRefMgr<T>& m);
|
||||
void SendToSelf(void);
|
||||
};
|
||||
@@ -63,10 +71,9 @@ namespace Acore
|
||||
|
||||
struct PlayerRelocationNotifier : public VisibleNotifier
|
||||
{
|
||||
PlayerRelocationNotifier(Player& player) : VisibleNotifier(player) { }
|
||||
PlayerRelocationNotifier(Player& player, bool largeOnly): VisibleNotifier(player, false, largeOnly) { }
|
||||
|
||||
template<class T> void Visit(GridRefMgr<T>& m) { VisibleNotifier::Visit(m); }
|
||||
void Visit(CreatureMapType&);
|
||||
void Visit(PlayerMapType&);
|
||||
};
|
||||
|
||||
@@ -75,20 +82,6 @@ namespace Acore
|
||||
Creature& i_creature;
|
||||
CreatureRelocationNotifier(Creature& c) : i_creature(c) {}
|
||||
template<class T> void Visit(GridRefMgr<T>&) {}
|
||||
void Visit(CreatureMapType&);
|
||||
void Visit(PlayerMapType&);
|
||||
};
|
||||
|
||||
struct DelayedUnitRelocation
|
||||
{
|
||||
Map& i_map;
|
||||
Cell& cell;
|
||||
CellCoord& p;
|
||||
const float i_radius;
|
||||
DelayedUnitRelocation(Cell& c, CellCoord& pair, Map& map, float radius) :
|
||||
i_map(map), cell(c), p(pair), i_radius(radius) { }
|
||||
template<class T> void Visit(GridRefMgr<T>&) { }
|
||||
void Visit(CreatureMapType&);
|
||||
void Visit(PlayerMapType&);
|
||||
};
|
||||
|
||||
@@ -101,25 +94,6 @@ namespace Acore
|
||||
void Visit(CreatureMapType&);
|
||||
};
|
||||
|
||||
struct GridUpdater
|
||||
{
|
||||
GridType& i_grid;
|
||||
uint32 i_timeDiff;
|
||||
GridUpdater(GridType& grid, uint32 diff) : i_grid(grid), i_timeDiff(diff) { }
|
||||
|
||||
template<class T> void updateObjects(GridRefMgr<T>& m)
|
||||
{
|
||||
for (typename GridRefMgr<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
iter->GetSource()->Update(i_timeDiff);
|
||||
}
|
||||
|
||||
void Visit(PlayerMapType& m) { updateObjects<Player>(m); }
|
||||
void Visit(CreatureMapType& m) { updateObjects<Creature>(m); }
|
||||
void Visit(GameObjectMapType& m) { updateObjects<GameObject>(m); }
|
||||
void Visit(DynamicObjectMapType& m) { updateObjects<DynamicObject>(m); }
|
||||
void Visit(CorpseMapType& m) { updateObjects<Corpse>(m); }
|
||||
};
|
||||
|
||||
struct MessageDistDeliverer
|
||||
{
|
||||
WorldObject const* i_source;
|
||||
@@ -180,7 +154,8 @@ namespace Acore
|
||||
struct ObjectUpdater
|
||||
{
|
||||
uint32 i_timeDiff;
|
||||
explicit ObjectUpdater(const uint32 diff) : i_timeDiff(diff) {}
|
||||
bool i_largeOnly;
|
||||
explicit ObjectUpdater(const uint32 diff, bool largeOnly) : i_timeDiff(diff), i_largeOnly(largeOnly) {}
|
||||
template<class T> void Visit(GridRefMgr<T>& m);
|
||||
void Visit(PlayerMapType&) {}
|
||||
void Visit(CorpseMapType&) {}
|
||||
|
||||
@@ -32,8 +32,15 @@
|
||||
template<class T>
|
||||
inline void Acore::VisibleNotifier::Visit(GridRefMgr<T>& m)
|
||||
{
|
||||
// Xinef: Update gameobjects only
|
||||
if (i_gobjOnly)
|
||||
return;
|
||||
|
||||
for (typename GridRefMgr<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
if (i_largeOnly != iter->GetSource()->IsVisibilityOverridden())
|
||||
continue;
|
||||
|
||||
vis_guids.erase(iter->GetSource()->GetGUID());
|
||||
i_player.UpdateVisibilityOf(iter->GetSource(), i_data, i_visibleNow);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user