diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/EntityManager.cs | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EntityManager.cs b/OpenSim/Region/Environment/Scenes/EntityManager.cs index eb29ead..25f73b4 100644 --- a/OpenSim/Region/Environment/Scenes/EntityManager.cs +++ b/OpenSim/Region/Environment/Scenes/EntityManager.cs | |||
@@ -1,4 +1,31 @@ | |||
1 | using System; | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
2 | using System.Collections; | 29 | using System.Collections; |
3 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
4 | using OpenMetaverse; | 31 | using OpenMetaverse; |
@@ -19,7 +46,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
19 | 46 | ||
20 | public void Add(EntityBase entity) | 47 | public void Add(EntityBase entity) |
21 | { | 48 | { |
22 | lock(m_lock) | 49 | lock (m_lock) |
23 | { | 50 | { |
24 | m_eb_uuid.Add(entity.UUID, entity); | 51 | m_eb_uuid.Add(entity.UUID, entity); |
25 | m_eb_localID.Add(entity.LocalId, entity); | 52 | m_eb_localID.Add(entity.LocalId, entity); |
@@ -28,7 +55,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
28 | 55 | ||
29 | public void InsertOrReplace(EntityBase entity) | 56 | public void InsertOrReplace(EntityBase entity) |
30 | { | 57 | { |
31 | lock(m_lock) | 58 | lock (m_lock) |
32 | { | 59 | { |
33 | m_eb_uuid[entity.UUID] = entity; | 60 | m_eb_uuid[entity.UUID] = entity; |
34 | m_eb_localID[entity.LocalId] = entity; | 61 | m_eb_localID[entity.LocalId] = entity; |
@@ -57,7 +84,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
57 | 84 | ||
58 | public bool ContainsKey(UUID id) | 85 | public bool ContainsKey(UUID id) |
59 | { | 86 | { |
60 | lock(m_lock) | 87 | lock (m_lock) |
61 | { | 88 | { |
62 | return m_eb_uuid.ContainsKey(id); | 89 | return m_eb_uuid.ContainsKey(id); |
63 | } | 90 | } |
@@ -73,7 +100,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
73 | 100 | ||
74 | public bool Remove(uint localID) | 101 | public bool Remove(uint localID) |
75 | { | 102 | { |
76 | lock(m_lock) | 103 | lock (m_lock) |
77 | { | 104 | { |
78 | bool a = m_eb_uuid.Remove(m_eb_localID[localID].UUID); | 105 | bool a = m_eb_uuid.Remove(m_eb_localID[localID].UUID); |
79 | bool b = m_eb_localID.Remove(localID); | 106 | bool b = m_eb_localID.Remove(localID); |
@@ -84,7 +111,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
84 | 111 | ||
85 | public bool Remove(UUID id) | 112 | public bool Remove(UUID id) |
86 | { | 113 | { |
87 | lock(m_lock) | 114 | lock (m_lock) |
88 | { | 115 | { |
89 | bool a = m_eb_localID.Remove(m_eb_uuid[id].LocalId); | 116 | bool a = m_eb_localID.Remove(m_eb_uuid[id].LocalId); |
90 | bool b = m_eb_uuid.Remove(id); | 117 | bool b = m_eb_uuid.Remove(id); |
@@ -97,11 +124,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
97 | { | 124 | { |
98 | List<EntityBase> tmp = new List<EntityBase>(); | 125 | List<EntityBase> tmp = new List<EntityBase>(); |
99 | 126 | ||
100 | lock(m_lock) | 127 | lock (m_lock) |
101 | { | 128 | { |
102 | foreach (KeyValuePair<UUID, EntityBase> pair in m_eb_uuid) | 129 | foreach (KeyValuePair<UUID, EntityBase> pair in m_eb_uuid) |
103 | { | 130 | { |
104 | if(pair.Value is T) | 131 | if (pair.Value is T) |
105 | { | 132 | { |
106 | tmp.Add(pair.Value); | 133 | tmp.Add(pair.Value); |
107 | } | 134 | } |
@@ -151,7 +178,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
151 | 178 | ||
152 | public bool TryGetValue(UUID key, out EntityBase obj) | 179 | public bool TryGetValue(UUID key, out EntityBase obj) |
153 | { | 180 | { |
154 | lock(m_lock) | 181 | lock (m_lock) |
155 | { | 182 | { |
156 | return m_eb_uuid.TryGetValue(key, out obj); | 183 | return m_eb_uuid.TryGetValue(key, out obj); |
157 | } | 184 | } |