diff options
author | megamage <none@none> | 2008-12-27 11:26:22 -0600 |
---|---|---|
committer | megamage <none@none> | 2008-12-27 11:26:22 -0600 |
commit | d5e9d0b2c4389998cdbed7cf8fc6fb81c2a22829 (patch) | |
tree | ae4a9c46b42b4095159c6cf45b9eec8e3466c495 | |
parent | 5d886fc46eecf75f4ccaddba32fc82251ecf6e11 (diff) |
*Try to fix the bug that relocation notify causes crash.
--HG--
branch : trunk
-rw-r--r-- | src/game/Map.cpp | 10 | ||||
-rw-r--r-- | src/game/Map.h | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 531f32e75e9..c2fe5bfec74 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -653,7 +653,7 @@ bool Map::loaded(const GridPair &p) const } }*/ -void Map::Update(const uint32 &t_diff) +void Map::RelocationNotify() { //creatures may be added to the list during update i_lock = true; @@ -666,6 +666,7 @@ void Map::Update(const uint32 &t_diff) continue; CellPair val = Trinity::ComputeCellPair(unit->GetPositionX(), unit->GetPositionY()); Cell cell(val); + cell.SetNoCreate(); //if(unit->GetTypeId() == TYPEID_PLAYER) // PlayerRelocationNotify((Player*)unit, cell, val); //else @@ -693,7 +694,10 @@ void Map::Update(const uint32 &t_diff) } i_unitsToNotify.clear(); i_lock = false; +} +void Map::Update(const uint32 &t_diff) +{ resetMarkedCells(); //TODO: is there a better way to update activeobjects? @@ -743,7 +747,7 @@ void Map::Update(const uint32 &t_diff) CellPair pair(x,y); Cell cell(pair); cell.data.Part.reserved = CENTER_DISTRICT; - cell.SetNoCreate(); + //cell.SetNoCreate(); CellLock<NullGuard> cell_lock(cell, pair); cell_lock->Visit(cell_lock, grid_object_update, *this); cell_lock->Visit(cell_lock, world_object_update, *this); @@ -754,6 +758,8 @@ void Map::Update(const uint32 &t_diff) // UpdateActiveCells((*iter)->GetPositionX(), (*iter)->GetPositionY(), t_diff); } + RelocationNotify(); + // Don't unload grids if it's battleground, since we may have manually added GOs,creatures, those doesn't load from DB at grid re-load ! // This isn't really bother us, since as soon as we have instanced BG-s, the whole map unloads as the BG gets ended if (IsBattleGroundOrArena()) diff --git a/src/game/Map.h b/src/game/Map.h index 23b2ea1f3fa..c3ae4830cfb 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -248,6 +248,7 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O void AddActiveObject(WorldObject* obj) { i_activeObjects.insert(obj); } void RemoveActiveObject(WorldObject* obj) { i_activeObjects.erase(obj); } void AddUnitToNotify(Unit* unit); + void RelocationNotify(); void SendToPlayers(WorldPacket const* data) const; |