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:
@@ -738,20 +738,24 @@ namespace Game.Garrisons
|
||||
|
||||
if (go.GetGoType() == GameObjectTypes.GarrisonBuilding && go.GetGoInfo().GarrisonBuilding.SpawnMap != 0)
|
||||
{
|
||||
foreach (var cellGuids in Global.ObjectMgr.GetMapObjectGuids((uint)go.GetGoInfo().GarrisonBuilding.SpawnMap, map.GetDifficultyID()))
|
||||
var cells = Global.ObjectMgr.GetMapObjectGuids((uint)go.GetGoInfo().GarrisonBuilding.SpawnMap, map.GetDifficultyID());
|
||||
if (cells != null)
|
||||
{
|
||||
foreach (var spawnId in cellGuids.Value.creatures)
|
||||
foreach (var (_, guids) in cells)
|
||||
{
|
||||
Creature spawn = BuildingSpawnHelper<Creature>(go, spawnId, map);
|
||||
if (spawn != null)
|
||||
BuildingInfo.Spawns.Add(spawn.GetGUID());
|
||||
}
|
||||
foreach (var spawnId in guids.creatures)
|
||||
{
|
||||
Creature spawn = BuildingSpawnHelper<Creature>(go, spawnId, map);
|
||||
if (spawn != null)
|
||||
BuildingInfo.Spawns.Add(spawn.GetGUID());
|
||||
}
|
||||
|
||||
foreach (var spawnId in cellGuids.Value.gameobjects)
|
||||
{
|
||||
GameObject spawn = BuildingSpawnHelper<GameObject>(go, spawnId, map);
|
||||
if (spawn != null)
|
||||
BuildingInfo.Spawns.Add(spawn.GetGUID());
|
||||
foreach (var spawnId in guids.gameobjects)
|
||||
{
|
||||
GameObject spawn = BuildingSpawnHelper<GameObject>(go, spawnId, map);
|
||||
if (spawn != null)
|
||||
BuildingInfo.Spawns.Add(spawn.GetGUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user