mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +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);
|
MANGOS_ASSERT(grid != NULL);
|
||||||
if( !isGridObjectDataLoaded(cell.GridX(), cell.GridY()) )
|
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);
|
ObjectGridLoader loader(*grid, this, cell);
|
||||||
loader.LoadN();
|
loader.LoadN();
|
||||||
|
|
||||||
// Add resurrectable corpses to world object list in grid
|
// Add resurrectable corpses to world object list in grid
|
||||||
sObjectAccessor.AddCorpsesToGrid(GridPair(cell.GridX(),cell.GridY()),(*grid)(cell.CellX(), cell.CellY()), this);
|
sObjectAccessor.AddCorpsesToGrid(GridPair(cell.GridX(),cell.GridY()),(*grid)(cell.CellX(), cell.CellY()), this);
|
||||||
|
|
||||||
setGridObjectDataLoaded(true,cell.GridX(), cell.GridY());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10604"
|
#define REVISION_NR "10605"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue