mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Change Map::Visit to not call EnsureGridLoaded if cell.NoCreate is true (#28884)
Remove Map::setGridObjectDataLoaded/Map::isGridObjectDataLoaded helpers, we have NGridType object to use methods directly
This commit is contained in:
@@ -534,11 +534,11 @@ bool Map::EnsureGridLoaded(Cell const& cell)
|
||||
NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
|
||||
|
||||
ASSERT(grid != nullptr);
|
||||
if (!isGridObjectDataLoaded(cell.GridX(), cell.GridY()))
|
||||
if (!grid->isGridObjectDataLoaded())
|
||||
{
|
||||
TC_LOG_DEBUG("maps", "Loading grid[%u, %u] for map %u instance %u", cell.GridX(), cell.GridY(), GetId(), i_InstanceId);
|
||||
|
||||
setGridObjectDataLoaded(true, cell.GridX(), cell.GridY());
|
||||
grid->setGridObjectDataLoaded(true);
|
||||
|
||||
ObjectGridLoader loader(*grid, this, cell);
|
||||
loader.LoadN();
|
||||
@@ -709,7 +709,8 @@ bool Map::AddToMap(Transport* obj)
|
||||
|
||||
bool Map::IsGridLoaded(GridCoord const& p) const
|
||||
{
|
||||
return (getNGrid(p.x_coord, p.y_coord) && isGridObjectDataLoaded(p.x_coord, p.y_coord));
|
||||
NGridType* grid = getNGrid(p.x_coord, p.y_coord);
|
||||
return grid && grid->isGridObjectDataLoaded();
|
||||
}
|
||||
|
||||
void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer> &gridVisitor, TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer> &worldVisitor)
|
||||
|
||||
@@ -696,9 +696,6 @@ class TC_GAME_API Map : public GridRefManager<NGridType>
|
||||
return i_grids[x][y];
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
@@ -985,10 +982,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() || IsGridLoaded(GridCoord(x, y)))
|
||||
{
|
||||
if (!cell.NoCreate())
|
||||
EnsureGridLoaded(cell);
|
||||
getNGrid(x, y)->VisitGrid(cell_x, cell_y, visitor);
|
||||
}
|
||||
|
||||
NGridType* grid = getNGrid(x, y);
|
||||
if (grid && grid->isGridObjectDataLoaded())
|
||||
grid->VisitGrid(cell_x, cell_y, visitor);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user