diff options
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | 120 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs | 2 |
2 files changed, 122 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index c39ac73..9689e04 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | |||
@@ -46,6 +46,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
46 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | private Scene m_Scene; | 48 | private Scene m_Scene; |
49 | private Dictionary<UUID, PrimCounts> m_PrimCounts = | ||
50 | new Dictionary<UUID, PrimCounts>(); | ||
49 | 51 | ||
50 | public Type ReplaceableInterface | 52 | public Type ReplaceableInterface |
51 | { | 53 | { |
@@ -108,5 +110,123 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
108 | public void TaintPrimCount() | 110 | public void TaintPrimCount() |
109 | { | 111 | { |
110 | } | 112 | } |
113 | |||
114 | public IPrimCounts GetPrimCounts(UUID parcelID) | ||
115 | { | ||
116 | PrimCounts primCounts; | ||
117 | |||
118 | lock (m_PrimCounts) | ||
119 | { | ||
120 | if (m_PrimCounts.TryGetValue(parcelID, out primCounts)) | ||
121 | return primCounts; | ||
122 | |||
123 | primCounts = new PrimCounts(parcelID, this); | ||
124 | m_PrimCounts[parcelID] = primCounts; | ||
125 | } | ||
126 | return primCounts; | ||
127 | } | ||
128 | |||
129 | public int GetOwnerCount(UUID parcelID) | ||
130 | { | ||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | public int GetGroupCount(UUID parcelID) | ||
135 | { | ||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | public int GetOthersCount(UUID parcelID) | ||
140 | { | ||
141 | return 0; | ||
142 | } | ||
143 | |||
144 | public int GetSimulatorCount(UUID parcelID) | ||
145 | { | ||
146 | return 0; | ||
147 | } | ||
148 | |||
149 | public int GetUserCount(UUID parcelID, UUID userID) | ||
150 | { | ||
151 | return 0; | ||
152 | } | ||
153 | } | ||
154 | |||
155 | public class PrimCounts : IPrimCounts | ||
156 | { | ||
157 | private PrimCountModule m_Parent; | ||
158 | private UUID m_ParcelID; | ||
159 | private UserPrimCounts m_UserPrimCounts; | ||
160 | |||
161 | public PrimCounts (UUID parcelID, PrimCountModule parent) | ||
162 | { | ||
163 | m_ParcelID = parcelID; | ||
164 | m_Parent = parent; | ||
165 | |||
166 | m_UserPrimCounts = new UserPrimCounts(this); | ||
167 | } | ||
168 | |||
169 | public int Owner | ||
170 | { | ||
171 | get | ||
172 | { | ||
173 | return m_Parent.GetOwnerCount(m_ParcelID); | ||
174 | } | ||
175 | } | ||
176 | |||
177 | public int Group | ||
178 | { | ||
179 | get | ||
180 | { | ||
181 | return m_Parent.GetGroupCount(m_ParcelID); | ||
182 | } | ||
183 | } | ||
184 | |||
185 | public int Others | ||
186 | { | ||
187 | get | ||
188 | { | ||
189 | return m_Parent.GetOthersCount(m_ParcelID); | ||
190 | } | ||
191 | } | ||
192 | |||
193 | public int Simulator | ||
194 | { | ||
195 | get | ||
196 | { | ||
197 | return m_Parent.GetSimulatorCount(m_ParcelID); | ||
198 | } | ||
199 | } | ||
200 | |||
201 | public IUserPrimCounts Users | ||
202 | { | ||
203 | get | ||
204 | { | ||
205 | return m_UserPrimCounts; | ||
206 | } | ||
207 | } | ||
208 | |||
209 | public int GetUserCount(UUID userID) | ||
210 | { | ||
211 | return m_Parent.GetUserCount(m_ParcelID, userID); | ||
212 | } | ||
213 | } | ||
214 | |||
215 | public class UserPrimCounts : IUserPrimCounts | ||
216 | { | ||
217 | private PrimCounts m_Parent; | ||
218 | |||
219 | public UserPrimCounts(PrimCounts parent) | ||
220 | { | ||
221 | m_Parent = parent; | ||
222 | } | ||
223 | |||
224 | public int this[UUID userID] | ||
225 | { | ||
226 | get | ||
227 | { | ||
228 | return m_Parent.GetUserCount(userID); | ||
229 | } | ||
230 | } | ||
111 | } | 231 | } |
112 | } | 232 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs b/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs index 7b77b30..65158e1 100644 --- a/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IPrimCountModule.cs | |||
@@ -35,6 +35,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
35 | void TaintPrimCount(ILandObject land); | 35 | void TaintPrimCount(ILandObject land); |
36 | void TaintPrimCount(int x, int y); | 36 | void TaintPrimCount(int x, int y); |
37 | void TaintPrimCount(); | 37 | void TaintPrimCount(); |
38 | |||
39 | IPrimCounts GetPrimCounts(UUID parcelID); | ||
38 | } | 40 | } |
39 | 41 | ||
40 | public interface IPrimCounts | 42 | public interface IPrimCounts |