diff options
author | Adam Frisby | 2008-11-24 13:14:52 +0000 |
---|---|---|
committer | Adam Frisby | 2008-11-24 13:14:52 +0000 |
commit | 202406c522306cc641d1403ec367cd2cca4d8efb (patch) | |
tree | 9986a9217960676b5b20e8919c68e5356cfcdbd9 | |
parent | * Adding EntityManager.cs (diff) | |
download | opensim-SC-202406c522306cc641d1403ec367cd2cca4d8efb.zip opensim-SC-202406c522306cc641d1403ec367cd2cca4d8efb.tar.gz opensim-SC-202406c522306cc641d1403ec367cd2cca4d8efb.tar.bz2 opensim-SC-202406c522306cc641d1403ec367cd2cca4d8efb.tar.xz |
* Makes EntityManager IEnumerable - meaning we should be good to go to enable this.
Diffstat (limited to '')
-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 | } |