mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-13 07:23:44 +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:
@@ -71,6 +71,7 @@ namespace VMAP
|
||||
namespace Acore
|
||||
{
|
||||
struct ObjectUpdater;
|
||||
struct LargeObjectUpdater;
|
||||
}
|
||||
|
||||
struct ScriptAction
|
||||
@@ -311,7 +312,7 @@ class Map : public GridRefMgr<NGridType>
|
||||
{
|
||||
friend class MapReference;
|
||||
public:
|
||||
Map(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode, Map* _parent = nullptr);
|
||||
Map(uint32 id, uint32 InstanceId, uint8 SpawnMode, Map* _parent = nullptr);
|
||||
~Map() override;
|
||||
|
||||
[[nodiscard]] MapEntry const* GetEntry() const { return i_mapEntry; }
|
||||
@@ -336,7 +337,13 @@ public:
|
||||
template<class T> void RemoveFromMap(T*, bool);
|
||||
|
||||
void VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<Acore::ObjectUpdater, GridTypeMapContainer>& gridVisitor,
|
||||
TypeContainerVisitor<Acore::ObjectUpdater, WorldTypeMapContainer>& worldVisitor);
|
||||
TypeContainerVisitor<Acore::ObjectUpdater, WorldTypeMapContainer>& worldVisitor,
|
||||
TypeContainerVisitor<Acore::ObjectUpdater, GridTypeMapContainer>& largeGridVisitor,
|
||||
TypeContainerVisitor<Acore::ObjectUpdater, WorldTypeMapContainer>& largeWorldVisitor);
|
||||
void VisitNearbyCellsOfPlayer(Player* player, TypeContainerVisitor<Acore::ObjectUpdater, GridTypeMapContainer>& gridVisitor,
|
||||
TypeContainerVisitor<Acore::ObjectUpdater, WorldTypeMapContainer>& worldVisitor,
|
||||
TypeContainerVisitor<Acore::ObjectUpdater, GridTypeMapContainer>& largeGridVisitor,
|
||||
TypeContainerVisitor<Acore::ObjectUpdater, WorldTypeMapContainer>& largeWorldVisitor);
|
||||
|
||||
virtual void Update(const uint32, const uint32, bool thread = true);
|
||||
|
||||
@@ -346,22 +353,16 @@ public:
|
||||
virtual void InitVisibilityDistance();
|
||||
|
||||
void PlayerRelocation(Player*, float x, float y, float z, float o);
|
||||
void CreatureRelocation(Creature* creature, float x, float y, float z, float o, bool respawnRelocationOnFail = true);
|
||||
void GameObjectRelocation(GameObject* go, float x, float y, float z, float o, bool respawnRelocationOnFail = true);
|
||||
void CreatureRelocation(Creature* creature, float x, float y, float z, float o);
|
||||
void GameObjectRelocation(GameObject* go, float x, float y, float z, float o);
|
||||
void DynamicObjectRelocation(DynamicObject* go, float x, float y, float z, float o);
|
||||
|
||||
template<class T, class CONTAINER> void Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER>& visitor);
|
||||
|
||||
[[nodiscard]] bool IsActiveGrid(float x, float y) const
|
||||
{
|
||||
GridCoord p = Acore::ComputeGridCoord(x, y);
|
||||
return !getNGrid(p.x_coord, p.y_coord) || getNGrid(p.x_coord, p.y_coord)->GetGridState() == GRID_STATE_ACTIVE;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool IsRemovalGrid(float x, float y) const
|
||||
{
|
||||
GridCoord p = Acore::ComputeGridCoord(x, y);
|
||||
return !getNGrid(p.x_coord, p.y_coord) || getNGrid(p.x_coord, p.y_coord)->GetGridState() == GRID_STATE_REMOVAL;
|
||||
return !getNGrid(p.x_coord, p.y_coord);
|
||||
}
|
||||
|
||||
[[nodiscard]] bool IsGridLoaded(float x, float y) const
|
||||
@@ -369,26 +370,13 @@ public:
|
||||
return IsGridLoaded(Acore::ComputeGridCoord(x, y));
|
||||
}
|
||||
|
||||
bool GetUnloadLock(GridCoord const& p) const { return getNGrid(p.x_coord, p.y_coord)->getUnloadLock(); }
|
||||
void SetUnloadLock(GridCoord const& p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadExplicitLock(on); }
|
||||
void LoadGrid(float x, float y);
|
||||
void LoadAllCells();
|
||||
bool UnloadGrid(NGridType& ngrid, bool pForce);
|
||||
void GridMarkNoUnload(uint32 x, uint32 y);
|
||||
void GridUnmarkNoUnload(uint32 x, uint32 y);
|
||||
bool UnloadGrid(NGridType& ngrid);
|
||||
virtual void UnloadAll();
|
||||
|
||||
void ResetGridExpiry(NGridType& grid, float factor = 1) const
|
||||
{
|
||||
grid.ResetTimeTracker(time_t(float(i_gridExpiry) * factor));
|
||||
}
|
||||
|
||||
[[nodiscard]] time_t GetGridExpiry(void) const { return i_gridExpiry; }
|
||||
[[nodiscard]] uint32 GetId() const { return i_mapEntry->MapID; }
|
||||
|
||||
static void InitStateMachine();
|
||||
static void DeleteStateMachine();
|
||||
|
||||
static bool ExistMap(uint32 mapid, int gx, int gy);
|
||||
static bool ExistVMap(uint32 mapid, int gx, int gy);
|
||||
|
||||
@@ -427,10 +415,6 @@ public:
|
||||
void RemoveAllObjectsInRemoveList();
|
||||
virtual void RemoveAllPlayers();
|
||||
|
||||
// used only in MoveAllCreaturesInMoveList and ObjectGridUnloader
|
||||
bool CreatureRespawnRelocation(Creature* c, bool diffGridOnly);
|
||||
bool GameObjectRespawnRelocation(GameObject* go, bool diffGridOnly);
|
||||
|
||||
[[nodiscard]] uint32 GetInstanceId() const { return i_InstanceId; }
|
||||
[[nodiscard]] uint8 GetSpawnMode() const { return (i_spawnMode); }
|
||||
|
||||
@@ -484,10 +468,12 @@ public:
|
||||
void resetMarkedCells() { marked_cells.reset(); }
|
||||
bool isCellMarked(uint32 pCellId) { return marked_cells.test(pCellId); }
|
||||
void markCell(uint32 pCellId) { marked_cells.set(pCellId); }
|
||||
void resetMarkedCellsLarge() { marked_cells_large.reset(); }
|
||||
bool isCellMarkedLarge(uint32 pCellId) { return marked_cells_large.test(pCellId); }
|
||||
void markCellLarge(uint32 pCellId) { marked_cells_large.set(pCellId); }
|
||||
|
||||
[[nodiscard]] bool HavePlayers() const { return !m_mapRefMgr.IsEmpty(); }
|
||||
[[nodiscard]] uint32 GetPlayersCountExceptGMs() const;
|
||||
[[nodiscard]] bool ActiveObjectsNearGrid(NGridType const& ngrid) const;
|
||||
|
||||
void AddWorldObject(WorldObject* obj) { i_worldObjects.insert(obj); }
|
||||
void RemoveWorldObject(WorldObject* obj) { i_worldObjects.erase(obj); }
|
||||
@@ -674,30 +660,20 @@ private:
|
||||
// Load MMap Data
|
||||
void LoadMMap(int gx, int gy);
|
||||
|
||||
bool CreatureCellRelocation(Creature* creature, Cell new_cell);
|
||||
bool GameObjectCellRelocation(GameObject* go, Cell new_cell);
|
||||
bool DynamicObjectCellRelocation(DynamicObject* go, Cell new_cell);
|
||||
|
||||
template<class T> void InitializeObject(T* obj);
|
||||
void AddCreatureToMoveList(Creature* c, float x, float y, float z, float ang);
|
||||
void AddCreatureToMoveList(Creature* c);
|
||||
void RemoveCreatureFromMoveList(Creature* c);
|
||||
void AddGameObjectToMoveList(GameObject* go, float x, float y, float z, float ang);
|
||||
void AddGameObjectToMoveList(GameObject* go);
|
||||
void RemoveGameObjectFromMoveList(GameObject* go);
|
||||
void AddDynamicObjectToMoveList(DynamicObject* go, float x, float y, float z, float ang);
|
||||
void AddDynamicObjectToMoveList(DynamicObject* go);
|
||||
void RemoveDynamicObjectFromMoveList(DynamicObject* go);
|
||||
|
||||
bool _creatureToMoveLock;
|
||||
std::vector<Creature*> _creaturesToMove;
|
||||
|
||||
bool _gameObjectsToMoveLock;
|
||||
std::vector<GameObject*> _gameObjectsToMove;
|
||||
|
||||
bool _dynamicObjectsToMoveLock;
|
||||
std::vector<DynamicObject*> _dynamicObjectsToMove;
|
||||
|
||||
[[nodiscard]] bool IsGridLoaded(const GridCoord&) const;
|
||||
void EnsureGridCreated_i(const GridCoord&);
|
||||
void EnsureGridLoadedForActiveObject(Cell const&, WorldObject* object);
|
||||
|
||||
void buildNGridLinkage(NGridType* pNGridType) { pNGridType->link(this); }
|
||||
|
||||
@@ -708,6 +684,9 @@ private:
|
||||
}
|
||||
|
||||
bool EnsureGridLoaded(Cell const&);
|
||||
[[nodiscard]] bool isGridObjectDataLoaded(uint32 x, uint32 y) const { return getNGrid(x, y)->isGridObjectDataLoaded(); }
|
||||
void setGridObjectDataLoaded(bool pLoaded, uint32 x, uint32 y) { getNGrid(x, y)->setGridObjectDataLoaded(pLoaded); }
|
||||
|
||||
void setNGrid(NGridType* grid, uint32 x, uint32 y);
|
||||
void ScriptsProcess();
|
||||
|
||||
@@ -716,8 +695,6 @@ private:
|
||||
void SendObjectUpdates();
|
||||
|
||||
protected:
|
||||
void SetUnloadReferenceLock(GridCoord const& p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadReferenceLock(on); }
|
||||
|
||||
std::mutex Lock;
|
||||
std::mutex GridLock;
|
||||
std::shared_mutex MMapLock;
|
||||
@@ -733,8 +710,6 @@ protected:
|
||||
MapRefMgr m_mapRefMgr;
|
||||
MapRefMgr::iterator m_mapRefIter;
|
||||
|
||||
int32 m_VisibilityNotifyPeriod;
|
||||
|
||||
typedef std::set<WorldObject*> ActiveNonPlayers;
|
||||
ActiveNonPlayers m_activeNonPlayers;
|
||||
ActiveNonPlayers::iterator m_activeNonPlayersIter;
|
||||
@@ -753,8 +728,6 @@ private:
|
||||
void _ScriptProcessDoor(Object* source, Object* target, const ScriptInfo* scriptInfo) const;
|
||||
GameObject* _FindGameObject(WorldObject* pWorldObject, ObjectGuid::LowType guid) const;
|
||||
|
||||
time_t i_gridExpiry;
|
||||
|
||||
//used for fast base_map (e.g. MapInstanced class object) search for
|
||||
//InstanceMaps and BattlegroundMaps...
|
||||
Map* m_parentMap;
|
||||
@@ -762,15 +735,12 @@ private:
|
||||
NGridType* i_grids[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
|
||||
GridMap* GridMaps[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
|
||||
std::bitset<TOTAL_NUMBER_OF_CELLS_PER_MAP* TOTAL_NUMBER_OF_CELLS_PER_MAP> marked_cells;
|
||||
|
||||
//these functions used to process player/mob aggro reactions and
|
||||
//visibility calculations. Highly optimized for massive calculations
|
||||
void ProcessRelocationNotifies(uint32 diff);
|
||||
std::bitset<TOTAL_NUMBER_OF_CELLS_PER_MAP* TOTAL_NUMBER_OF_CELLS_PER_MAP> marked_cells_large;
|
||||
|
||||
bool i_scriptLock;
|
||||
std::set<WorldObject*> i_objectsToRemove;
|
||||
std::unordered_set<WorldObject*> i_objectsToRemove;
|
||||
std::map<WorldObject*, bool> i_objectsToSwitch;
|
||||
std::set<WorldObject*> i_worldObjects;
|
||||
std::unordered_set<WorldObject*> i_worldObjects;
|
||||
|
||||
typedef std::multimap<time_t, ScriptAction> ScriptScheduleMap;
|
||||
ScriptScheduleMap m_scriptSchedule;
|
||||
@@ -842,7 +812,7 @@ enum InstanceResetMethod
|
||||
class InstanceMap : public Map
|
||||
{
|
||||
public:
|
||||
InstanceMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode, Map* _parent);
|
||||
InstanceMap(uint32 id, uint32 InstanceId, uint8 SpawnMode, Map* _parent);
|
||||
~InstanceMap() override;
|
||||
bool AddPlayerToMap(Player*) override;
|
||||
void RemovePlayerFromMap(Player*, bool) override;
|
||||
@@ -876,7 +846,7 @@ private:
|
||||
class BattlegroundMap : public Map
|
||||
{
|
||||
public:
|
||||
BattlegroundMap(uint32 id, time_t, uint32 InstanceId, Map* _parent, uint8 spawnMode);
|
||||
BattlegroundMap(uint32 id, uint32 InstanceId, Map* _parent, uint8 spawnMode);
|
||||
~BattlegroundMap() override;
|
||||
|
||||
bool AddPlayerToMap(Player*) override;
|
||||
@@ -901,12 +871,11 @@ inline void Map::Visit(Cell const& cell, TypeContainerVisitor<T, CONTAINER>& vis
|
||||
const uint32 cell_x = cell.CellX();
|
||||
const uint32 cell_y = cell.CellY();
|
||||
|
||||
if (!cell.NoCreate())
|
||||
if (!cell.NoCreate() || IsGridLoaded(GridCoord(x, y)))
|
||||
{
|
||||
EnsureGridLoaded(cell);
|
||||
|
||||
NGridType* grid = getNGrid(x, y);
|
||||
if (grid && grid->isGridObjectDataLoaded())
|
||||
grid->VisitGrid(cell_x, cell_y, visitor);
|
||||
getNGrid(x, y)->VisitGrid(cell_x, cell_y, visitor);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user