Core/Battlegrounds: Unload all grids before destroying battleground object
Port From (https://github.com/TrinityCore/TrinityCore/commit/3fc3cd455b51d2de4ba5a70b7eff15e23b3da481)
This commit is contained in:
@@ -54,7 +54,14 @@ namespace Game.BattleGrounds
|
||||
Global.BattlegroundMgr.RemoveBattleground(GetTypeID(), GetInstanceID());
|
||||
// unload map
|
||||
if (m_Map)
|
||||
m_Map.SetUnload();
|
||||
{
|
||||
m_Map.UnloadAll(); // unload all objects (they may hold a reference to bg in their ZoneScript pointer)
|
||||
m_Map.SetUnload(); // mark for deletion by MapManager
|
||||
|
||||
//unlink to prevent crash, always unlink all pointer reference before destruction
|
||||
m_Map.SetBG(null);
|
||||
m_Map = null;
|
||||
}
|
||||
|
||||
// remove from bg free slot queue
|
||||
RemoveFromBGFreeSlotQueue();
|
||||
|
||||
@@ -1474,7 +1474,7 @@ namespace Game.Maps
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void UnloadAll()
|
||||
public void UnloadAll()
|
||||
{
|
||||
// clear all delayed moves, useless anyway do this moves before map unload.
|
||||
creaturesToMove.Clear();
|
||||
|
||||
Reference in New Issue
Block a user