aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/EntityManager.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-11-24 14:45:05 +0000
committerAdam Frisby2008-11-24 14:45:05 +0000
commit47829849d99e1ec6e11ac26e1f892cbaf94d5503 (patch)
tree8f6d4371874f1716312bf0752e9251f20dc920c2 /OpenSim/Region/Environment/Scenes/EntityManager.cs
parent* Makes EntityManager IEnumerable - meaning we should be good to go to enable... (diff)
downloadopensim-SC_OLD-47829849d99e1ec6e11ac26e1f892cbaf94d5503.zip
opensim-SC_OLD-47829849d99e1ec6e11ac26e1f892cbaf94d5503.tar.gz
opensim-SC_OLD-47829849d99e1ec6e11ac26e1f892cbaf94d5503.tar.bz2
opensim-SC_OLD-47829849d99e1ec6e11ac26e1f892cbaf94d5503.tar.xz
* 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.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/EntityManager.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityManager.cs32
1 files changed, 26 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EntityManager.cs b/OpenSim/Region/Environment/Scenes/EntityManager.cs
index 43bf090..be39878 100644
--- a/OpenSim/Region/Environment/Scenes/EntityManager.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityManager.cs
@@ -71,21 +71,25 @@ namespace OpenSim.Region.Environment.Scenes
71 } 71 }
72 } 72 }
73 73
74 public void Remove(uint localID) 74 public bool Remove(uint localID)
75 { 75 {
76 lock(m_lock) 76 lock(m_lock)
77 { 77 {
78 m_eb_uuid.Remove(m_eb_localID[localID].UUID); 78 bool a = m_eb_uuid.Remove(m_eb_localID[localID].UUID);
79 m_eb_localID.Remove(localID); 79 bool b = m_eb_localID.Remove(localID);
80
81 return a && b;
80 } 82 }
81 } 83 }
82 84
83 public void Remove(UUID id) 85 public bool Remove(UUID id)
84 { 86 {
85 lock(m_lock) 87 lock(m_lock)
86 { 88 {
87 m_eb_localID.Remove(m_eb_uuid[id].LocalId); 89 bool a = m_eb_localID.Remove(m_eb_uuid[id].LocalId);
88 m_eb_uuid.Remove(id); 90 bool b = m_eb_uuid.Remove(id);
91
92 return a && b;
89 } 93 }
90 } 94 }
91 95
@@ -145,6 +149,22 @@ namespace OpenSim.Region.Environment.Scenes
145 } 149 }
146 } 150 }
147 151
152 public bool TryGetValue(UUID key, out EntityBase obj)
153 {
154 lock(m_lock)
155 {
156 return m_eb_uuid.TryGetValue(key, out obj);
157 }
158 }
159
160 public bool TryGetValue(uint key, out EntityBase obj)
161 {
162 lock (m_lock)
163 {
164 return m_eb_localID.TryGetValue(key, out obj);
165 }
166 }
167
148 /// <summary> 168 /// <summary>
149 /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that. 169 /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that.
150 /// </summary> 170 /// </summary>