From 202406c522306cc641d1403ec367cd2cca4d8efb Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Mon, 24 Nov 2008 13:14:52 +0000 Subject: * Makes EntityManager IEnumerable - meaning we should be good to go to enable this. --- OpenSim/Region/Environment/Scenes/EntityManager.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/EntityManager.cs') 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 @@ using System; +using System.Collections; using System.Collections.Generic; using OpenMetaverse; namespace OpenSim.Region.Environment.Scenes { - public class EntityManager + public class EntityManager : IEnumerable { private readonly Dictionary m_eb_uuid = new Dictionary(); private readonly Dictionary m_eb_localID = new Dictionary(); @@ -106,7 +107,6 @@ namespace OpenSim.Region.Environment.Scenes return tmp; } - [Obsolete("Please used indexed access to this instead. Indexes can be accessed via EntitiesManager[index]. LocalID and UUID are supported.")] public List GetEntities() { lock (m_lock) @@ -144,5 +144,19 @@ namespace OpenSim.Region.Environment.Scenes InsertOrReplace(value); } } + + /// + /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that. + /// + /// + public IEnumerator GetEnumerator() + { + return GetEntities().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } } } -- cgit v1.1