* Swaps Scene.Entities Dictionary for EntityManager.
* Important Changes: Scene.Entities is now IEnumerable directly. You do not need to use Entities.Values, you can Enumerate on .Entities directly. (So 'foreach Scene.Entities' vs 'foreach Scene.Entities.Values'). * Locks: Entities maintains it's own internal locking states. This means you do not need to lock entities anymore. I'll be going through and removing locks on it systematically.0.6.1-post-fixes
parent
202406c522
commit
47829849d9
|
@ -98,7 +98,7 @@ namespace OpenSim.Region.DataSnapshot.Providers
|
|||
XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "objectdata", "");
|
||||
XmlNode node;
|
||||
|
||||
foreach (EntityBase entity in m_scene.Entities.Values)
|
||||
foreach (EntityBase entity in m_scene.Entities)
|
||||
{
|
||||
// only objects, not avatars
|
||||
if (entity is SceneObjectGroup)
|
||||
|
|
|
@ -272,7 +272,12 @@ namespace OpenSim.Region.Environment.Modules.ContentManagement
|
|||
|
||||
lock (scene)
|
||||
{
|
||||
scene.Entities = ReplacementList;
|
||||
scene.Entities.Clear();
|
||||
|
||||
foreach(KeyValuePair<UUID,EntityBase> kvp in ReplacementList)
|
||||
{
|
||||
scene.Entities.Add(kvp.Value);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (EntityBase ent in ReplacementList.Values)
|
||||
|
|
|
@ -666,7 +666,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
ResetAllLandPrimCounts();
|
||||
lock (m_scene.Entities)
|
||||
{
|
||||
foreach (EntityBase obj in m_scene.Entities.Values)
|
||||
foreach (EntityBase obj in m_scene.Entities)
|
||||
{
|
||||
if (obj != null)
|
||||
{
|
||||
|
|
|
@ -71,21 +71,25 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void Remove(uint localID)
|
||||
public bool Remove(uint localID)
|
||||
{
|
||||
lock(m_lock)
|
||||
{
|
||||
m_eb_uuid.Remove(m_eb_localID[localID].UUID);
|
||||
m_eb_localID.Remove(localID);
|
||||
bool a = m_eb_uuid.Remove(m_eb_localID[localID].UUID);
|
||||
bool b = m_eb_localID.Remove(localID);
|
||||
|
||||
return a && b;
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove(UUID id)
|
||||
public bool Remove(UUID id)
|
||||
{
|
||||
lock(m_lock)
|
||||
{
|
||||
m_eb_localID.Remove(m_eb_uuid[id].LocalId);
|
||||
m_eb_uuid.Remove(id);
|
||||
bool a = m_eb_localID.Remove(m_eb_uuid[id].LocalId);
|
||||
bool b = m_eb_uuid.Remove(id);
|
||||
|
||||
return a && b;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,6 +149,22 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public bool TryGetValue(UUID key, out EntityBase obj)
|
||||
{
|
||||
lock(m_lock)
|
||||
{
|
||||
return m_eb_uuid.TryGetValue(key, out obj);
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryGetValue(uint key, out EntityBase obj)
|
||||
{
|
||||
lock (m_lock)
|
||||
{
|
||||
return m_eb_localID.TryGetValue(key, out obj);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that.
|
||||
/// </summary>
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
m_log.Info("[PRIM INVENTORY]: Starting scripts in scene");
|
||||
|
||||
foreach (EntityBase group in Entities.Values)
|
||||
foreach (EntityBase group in Entities)
|
||||
{
|
||||
if (group is SceneObjectGroup)
|
||||
{
|
||||
|
|
|
@ -244,6 +244,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
// set { m_sceneGraph.SceneObjects = value; }
|
||||
// }
|
||||
|
||||
/**
|
||||
/// <summary>
|
||||
/// The dictionary of all entities in this scene. The contents of this dictionary may be changed at any time.
|
||||
/// If you wish to add or remove entities, please use the appropriate method for that entity rather than
|
||||
|
@ -257,6 +258,11 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
get { return m_sceneGraph.Entities; }
|
||||
set { m_sceneGraph.Entities = value; }
|
||||
}
|
||||
*/
|
||||
public EntityManager Entities
|
||||
{
|
||||
get { return m_sceneGraph.Entities; }
|
||||
}
|
||||
|
||||
public Dictionary<UUID, ScenePresence> m_restorePresences
|
||||
{
|
||||
|
@ -605,7 +611,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_log.Info("Stopping all Scripts in Scene");
|
||||
lock (Entities)
|
||||
{
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
foreach (EntityBase ent in Entities)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
|
@ -619,7 +625,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
m_log.Info("Starting all Scripts in Scene");
|
||||
lock (Entities)
|
||||
{
|
||||
foreach (EntityBase ent in Entities.Values)
|
||||
foreach (EntityBase ent in Entities)
|
||||
{
|
||||
if (ent is SceneObjectGroup)
|
||||
{
|
||||
|
@ -1857,7 +1863,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
lock (Entities)
|
||||
{
|
||||
ICollection<EntityBase> entities = new List<EntityBase>(Entities.Values);
|
||||
ICollection<EntityBase> entities = new List<EntityBase>(Entities);
|
||||
|
||||
foreach (EntityBase e in entities)
|
||||
{
|
||||
|
|
|
@ -59,7 +59,8 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
protected internal Dictionary<UUID, ScenePresence> ScenePresences = new Dictionary<UUID, ScenePresence>();
|
||||
// SceneObjects is not currently populated or used.
|
||||
//public Dictionary<UUID, SceneObjectGroup> SceneObjects;
|
||||
protected internal Dictionary<UUID, EntityBase> Entities = new Dictionary<UUID, EntityBase>();
|
||||
protected internal EntityManager Entities = new EntityManager();
|
||||
// protected internal Dictionary<UUID, EntityBase> Entities = new Dictionary<UUID, EntityBase>();
|
||||
protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>();
|
||||
|
||||
protected internal BasicQuadTreeNode QuadTree;
|
||||
|
@ -972,10 +973,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <returns></returns>
|
||||
protected internal List<EntityBase> GetEntities()
|
||||
{
|
||||
lock (Entities)
|
||||
{
|
||||
return new List<EntityBase>(Entities.Values);
|
||||
}
|
||||
return Entities.GetEntities();
|
||||
}
|
||||
|
||||
protected internal Dictionary<uint, float> GetTopScripts()
|
||||
|
|
|
@ -600,7 +600,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
m_pendingObjects = new Queue<SceneObjectGroup>();
|
||||
|
||||
List<EntityBase> ents = new List<EntityBase>(m_scene.Entities.Values);
|
||||
List<EntityBase> ents = new List<EntityBase>(m_scene.Entities);
|
||||
if (!m_isChildAgent) // Proximity sort makes no sense for
|
||||
{ // Child agents
|
||||
ents.Sort(delegate(EntityBase a, EntityBase b)
|
||||
|
|
Loading…
Reference in New Issue