diff options
-rw-r--r-- | OpenSim/Region/Environment/Scenes/EntityManager.cs | 18 |
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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | ||
2 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
3 | using OpenMetaverse; | 4 | using OpenMetaverse; |
4 | 5 | ||
5 | namespace OpenSim.Region.Environment.Scenes | 6 | namespace 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 | } |