aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorAdam Frisby2008-11-24 13:14:52 +0000
committerAdam Frisby2008-11-24 13:14:52 +0000
commit202406c522306cc641d1403ec367cd2cca4d8efb (patch)
tree9986a9217960676b5b20e8919c68e5356cfcdbd9 /OpenSim/Region
parent* Adding EntityManager.cs (diff)
downloadopensim-SC_OLD-202406c522306cc641d1403ec367cd2cca4d8efb.zip
opensim-SC_OLD-202406c522306cc641d1403ec367cd2cca4d8efb.tar.gz
opensim-SC_OLD-202406c522306cc641d1403ec367cd2cca4d8efb.tar.bz2
opensim-SC_OLD-202406c522306cc641d1403ec367cd2cca4d8efb.tar.xz
* Makes EntityManager IEnumerable - meaning we should be good to go to enable this.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityManager.cs18
1 files changed, 16 insertions, 2 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EntityManager.cs b/OpenSim/Region/Environment/Scenes/EntityManager.cs
index f515cba..43bf090 100644
--- a/OpenSim/Region/Environment/Scenes/EntityManager.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityManager.cs
@@ -1,10 +1,11 @@
1using System; 1using System;
2using System.Collections;
2using System.Collections.Generic; 3using System.Collections.Generic;
3using OpenMetaverse; 4using OpenMetaverse;
4 5
5namespace OpenSim.Region.Environment.Scenes 6namespace OpenSim.Region.Environment.Scenes
6{ 7{
7 public class EntityManager 8 public class EntityManager : IEnumerable<EntityBase>
8 { 9 {
9 private readonly Dictionary<UUID,EntityBase> m_eb_uuid = new Dictionary<UUID, EntityBase>(); 10 private readonly Dictionary<UUID,EntityBase> m_eb_uuid = new Dictionary<UUID, EntityBase>();
10 private readonly Dictionary<uint, EntityBase> m_eb_localID = new Dictionary<uint, EntityBase>(); 11 private readonly Dictionary<uint, EntityBase> m_eb_localID = new Dictionary<uint, EntityBase>();
@@ -106,7 +107,6 @@ namespace OpenSim.Region.Environment.Scenes
106 return tmp; 107 return tmp;
107 } 108 }
108 109
109 [Obsolete("Please used indexed access to this instead. Indexes can be accessed via EntitiesManager[index]. LocalID and UUID are supported.")]
110 public List<EntityBase> GetEntities() 110 public List<EntityBase> GetEntities()
111 { 111 {
112 lock (m_lock) 112 lock (m_lock)
@@ -144,5 +144,19 @@ namespace OpenSim.Region.Environment.Scenes
144 InsertOrReplace(value); 144 InsertOrReplace(value);
145 } 145 }
146 } 146 }
147
148 /// <summary>
149 /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that.
150 /// </summary>
151 /// <returns></returns>
152 public IEnumerator<EntityBase> GetEnumerator()
153 {
154 return GetEntities().GetEnumerator();
155 }
156
157 IEnumerator IEnumerable.GetEnumerator()
158 {
159 return GetEnumerator();
160 }
147 } 161 }
148} 162}