Clean up grid system. Get rid of GridLoader. This patch should not change any logic, except the incorrect calculation of the number of loaded corpse (which only affects log).

This commit is contained in:
megamage
2011-10-18 14:31:34 -04:00
parent bb64e64463
commit 7231ab959f
8 changed files with 78 additions and 171 deletions
+13 -6
View File
@@ -962,8 +962,6 @@ bool Map::UnloadGrid(const uint32 x, const uint32 y, bool unloadAll)
sLog->outDebug(LOG_FILTER_MAPS, "Unloading grid[%u, %u] for map %u", x, y, GetId());
ObjectGridUnloader unloader(*grid);
if (!unloadAll)
{
// Finish creature moves, remove and delete all creatures with delayed remove before moving to respawn grids
@@ -971,18 +969,27 @@ bool Map::UnloadGrid(const uint32 x, const uint32 y, bool unloadAll)
MoveAllCreaturesInMoveList();
// move creatures to respawn grids if this is diff.grid or to remove list
unloader.MoveToRespawnN();
ObjectGridEvacuator worker;
TypeContainerVisitor<ObjectGridEvacuator, GridTypeMapContainer> visitor(worker);
grid->VisitAllGrids(visitor);
// Finish creature moves, remove and delete all creatures with delayed remove before unload
MoveAllCreaturesInMoveList();
}
ObjectGridCleaner cleaner(*grid);
cleaner.CleanN();
{
ObjectGridCleaner worker;
TypeContainerVisitor<ObjectGridCleaner, GridTypeMapContainer> visitor(worker);
grid->VisitAllGrids(visitor);
}
RemoveAllObjectsInRemoveList();
unloader.UnloadN();
{
ObjectGridUnloader worker;
TypeContainerVisitor<ObjectGridUnloader, GridTypeMapContainer> visitor(worker);
grid->VisitAllGrids(visitor);
}
ASSERT(i_objectsToRemove.empty());
+1 -1
View File
@@ -626,7 +626,7 @@ Map::Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER> &visitor)
if (!cell.NoCreate() || IsGridLoaded(GridCoord(x, y)))
{
EnsureGridLoaded(cell);
getNGrid(x, y)->Visit(cell_x, cell_y, visitor);
getNGrid(x, y)->VisitGrid(cell_x, cell_y, visitor);
}
}