fix(Core/Grids): Grid improvements (#20955)
This commit is contained in:
@@ -2341,8 +2341,8 @@ void ObjectMgr::AddCreatureToGrid(ObjectGuid::LowType guid, CreatureData const*
|
||||
{
|
||||
if (mask & 1)
|
||||
{
|
||||
CellCoord cellCoord = Acore::ComputeCellCoord(data->posX, data->posY);
|
||||
CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
|
||||
GridCoord gridCoord = Acore::ComputeGridCoord(data->posX, data->posY);
|
||||
CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][gridCoord.GetId()];
|
||||
cell_guids.creatures.insert(guid);
|
||||
}
|
||||
}
|
||||
@@ -2355,8 +2355,8 @@ void ObjectMgr::RemoveCreatureFromGrid(ObjectGuid::LowType guid, CreatureData co
|
||||
{
|
||||
if (mask & 1)
|
||||
{
|
||||
CellCoord cellCoord = Acore::ComputeCellCoord(data->posX, data->posY);
|
||||
CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
|
||||
GridCoord gridCoord = Acore::ComputeGridCoord(data->posX, data->posY);
|
||||
CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][gridCoord.GetId()];
|
||||
cell_guids.creatures.erase(guid);
|
||||
}
|
||||
}
|
||||
@@ -2454,7 +2454,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 mapId, float x, float y, float
|
||||
AddCreatureToGrid(spawnId, &data);
|
||||
|
||||
// Spawn if necessary (loaded grids only)
|
||||
if (!map->Instanceable() && !map->IsRemovalGrid(x, y))
|
||||
if (!map->Instanceable() && !map->IsGridCreated(x, y))
|
||||
{
|
||||
Creature* creature = new Creature();
|
||||
if (!creature->LoadCreatureFromDB(spawnId, map, true, true))
|
||||
@@ -2644,8 +2644,8 @@ void ObjectMgr::AddGameobjectToGrid(ObjectGuid::LowType guid, GameObjectData con
|
||||
{
|
||||
if (mask & 1)
|
||||
{
|
||||
CellCoord cellCoord = Acore::ComputeCellCoord(data->posX, data->posY);
|
||||
CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
|
||||
GridCoord gridCoord = Acore::ComputeGridCoord(data->posX, data->posY);
|
||||
CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][gridCoord.GetId()];
|
||||
cell_guids.gameobjects.insert(guid);
|
||||
}
|
||||
}
|
||||
@@ -2658,8 +2658,8 @@ void ObjectMgr::RemoveGameobjectFromGrid(ObjectGuid::LowType guid, GameObjectDat
|
||||
{
|
||||
if (mask & 1)
|
||||
{
|
||||
CellCoord cellCoord = Acore::ComputeCellCoord(data->posX, data->posY);
|
||||
CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][cellCoord.GetId()];
|
||||
GridCoord gridCoord = Acore::ComputeGridCoord(data->posX, data->posY);
|
||||
CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapid, i)][gridCoord.GetId()];
|
||||
cell_guids.gameobjects.erase(guid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1150,12 +1150,12 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CellObjectGuids const& GetCellObjectGuids(uint16 mapid, uint8 spawnMode, uint32 cell_id)
|
||||
CellObjectGuids const& GetGridObjectGuids(uint16 mapid, uint8 spawnMode, uint32 gridId)
|
||||
{
|
||||
MapObjectGuids::const_iterator itr1 = _mapObjectGuidsStore.find(MAKE_PAIR32(mapid, spawnMode));
|
||||
if (itr1 != _mapObjectGuidsStore.end())
|
||||
{
|
||||
CellObjectGuidsMap::const_iterator itr2 = itr1->second.find(cell_id);
|
||||
CellObjectGuidsMap::const_iterator itr2 = itr1->second.find(gridId);
|
||||
if (itr2 != itr1->second.end())
|
||||
return itr2->second;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user