mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[10605] Fixed infinity loop at grid loading
this also probably solves the problem that object tries to be loaded twice
This commit is contained in:
parent
90e4480439
commit
4c5c6c46a1
2 changed files with 7 additions and 3 deletions
|
|
@ -334,13 +334,17 @@ bool Map::EnsureGridLoaded(const Cell &cell)
|
|||
MANGOS_ASSERT(grid != NULL);
|
||||
if( !isGridObjectDataLoaded(cell.GridX(), cell.GridY()) )
|
||||
{
|
||||
//it's important to set it loaded before loading!
|
||||
//otherwise there is a possibility of infinity chain (grid loading will be called many times for the same grid)
|
||||
//possible scenario:
|
||||
//active object A(loaded with loader.LoadN call and added to the map)
|
||||
//summons some active object B, while B added to map grid loading called again and so on..
|
||||
setGridObjectDataLoaded(true,cell.GridX(), cell.GridY());
|
||||
ObjectGridLoader loader(*grid, this, cell);
|
||||
loader.LoadN();
|
||||
|
||||
// Add resurrectable corpses to world object list in grid
|
||||
sObjectAccessor.AddCorpsesToGrid(GridPair(cell.GridX(),cell.GridY()),(*grid)(cell.CellX(), cell.CellY()), this);
|
||||
|
||||
setGridObjectDataLoaded(true,cell.GridX(), cell.GridY());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue