Core/Misc: Fixed thread-unsafe access to list of objects that should be spawned in a cell
Port From (https://github.com/TrinityCore/TrinityCore/commit/7b6589c1ecc159f6949c5535785fba79a04b2c4a)
This commit is contained in:
@@ -591,18 +591,22 @@ namespace Game.Entities
|
||||
void LoadStaticPassengers()
|
||||
{
|
||||
uint mapId = (uint)GetGoInfo().MoTransport.SpawnMap;
|
||||
if (mapId == 0)
|
||||
return;
|
||||
|
||||
var cells = Global.ObjectMgr.GetMapObjectGuids(mapId, GetMap().GetDifficultyID());
|
||||
if (cells == null)
|
||||
return;
|
||||
foreach (var cell in cells)
|
||||
{
|
||||
// Creatures on transport
|
||||
foreach (var npc in cell.Value.creatures)
|
||||
CreateNPCPassenger(npc, Global.ObjectMgr.GetCreatureData(npc));
|
||||
|
||||
foreach (var (_, guids) in cells)
|
||||
{
|
||||
// GameObjects on transport
|
||||
foreach (var go in cell.Value.gameobjects)
|
||||
CreateGOPassenger(go, Global.ObjectMgr.GetGameObjectData(go));
|
||||
foreach (var spawnId in guids.gameobjects)
|
||||
CreateGOPassenger(spawnId, Global.ObjectMgr.GetGameObjectData(spawnId));
|
||||
|
||||
// Creatures on transport
|
||||
foreach (var spawnId in guids.creatures)
|
||||
CreateNPCPassenger(spawnId, Global.ObjectMgr.GetCreatureData(spawnId));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user