aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/Application.cs14
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs237
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/PriorityQueue.cs245
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs149
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandChannel.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs62
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs103
-rw-r--r--OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs53
-rw-r--r--OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs114
-rw-r--r--OpenSim/Region/CoreModules/World/Sun/SunModule.cs6
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateDataService.cs6
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs19
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs8
-rw-r--r--OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs3
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs122
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs26
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs20
23 files changed, 751 insertions, 470 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index d120f03..7e320e6 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -250,9 +250,7 @@ namespace OpenSim
250 m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false); 250 m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false);
251 251
252 // load Crash directory config 252 // load Crash directory config
253 m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir); 253 m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir);
254
255
256 254
257 if (background) 255 if (background)
258 { 256 {
@@ -260,15 +258,9 @@ namespace OpenSim
260 m_sim.Startup(); 258 m_sim.Startup();
261 } 259 }
262 else 260 else
263 { 261 {
264
265
266
267
268 m_sim = new OpenSim(configSource); 262 m_sim = new OpenSim(configSource);
269 263
270
271
272 m_sim.Startup(); 264 m_sim.Startup();
273 265
274 while (true) 266 while (true)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index e9e1fa3..8de31d7 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -3687,12 +3687,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3687 avgTimeDilation += update.TimeDilation; 3687 avgTimeDilation += update.TimeDilation;
3688 avgTimeDilation *= 0.5f; 3688 avgTimeDilation *= 0.5f;
3689 3689
3690// <MIC>
3691// DEBUGGING CODE... REMOVE
3692// if (update.Entity is ScenePresence)
3693// LogAvatarUpdateEvent(this.m_agentId,update.Entity.UUID,timeinqueue);
3694// </MIC>
3695
3696 if (update.Entity is SceneObjectPart) 3690 if (update.Entity is SceneObjectPart)
3697 { 3691 {
3698 SceneObjectPart part = (SceneObjectPart)update.Entity; 3692 SceneObjectPart part = (SceneObjectPart)update.Entity;
@@ -5017,7 +5011,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5017 AddLocalPacketHandler(PacketType.TeleportLocationRequest, HandleTeleportLocationRequest); 5011 AddLocalPacketHandler(PacketType.TeleportLocationRequest, HandleTeleportLocationRequest);
5018 AddLocalPacketHandler(PacketType.UUIDNameRequest, HandleUUIDNameRequest, false); 5012 AddLocalPacketHandler(PacketType.UUIDNameRequest, HandleUUIDNameRequest, false);
5019 AddLocalPacketHandler(PacketType.RegionHandleRequest, HandleRegionHandleRequest); 5013 AddLocalPacketHandler(PacketType.RegionHandleRequest, HandleRegionHandleRequest);
5020 AddLocalPacketHandler(PacketType.ParcelInfoRequest, HandleParcelInfoRequest, false); 5014 AddLocalPacketHandler(PacketType.ParcelInfoRequest, HandleParcelInfoRequest);
5021 AddLocalPacketHandler(PacketType.ParcelAccessListRequest, HandleParcelAccessListRequest, false); 5015 AddLocalPacketHandler(PacketType.ParcelAccessListRequest, HandleParcelAccessListRequest, false);
5022 AddLocalPacketHandler(PacketType.ParcelAccessListUpdate, HandleParcelAccessListUpdate, false); 5016 AddLocalPacketHandler(PacketType.ParcelAccessListUpdate, HandleParcelAccessListUpdate, false);
5023 AddLocalPacketHandler(PacketType.ParcelPropertiesRequest, HandleParcelPropertiesRequest, false); 5017 AddLocalPacketHandler(PacketType.ParcelPropertiesRequest, HandleParcelPropertiesRequest, false);
@@ -8888,13 +8882,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8888 case "instantmessage": 8882 case "instantmessage":
8889 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) 8883 if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
8890 { 8884 {
8891 if (messagePacket.ParamList.Length < 5) 8885 if (messagePacket.ParamList.Length < 2)
8892 return true; 8886 return true;
8887
8893 UUID invoice = messagePacket.MethodData.Invoice; 8888 UUID invoice = messagePacket.MethodData.Invoice;
8894 UUID SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter));
8895 string SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter);
8896 string Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter);
8897 UUID sessionID = messagePacket.AgentData.SessionID; 8889 UUID sessionID = messagePacket.AgentData.SessionID;
8890
8891 UUID SenderID;
8892 string SenderName;
8893 string Message;
8894
8895 if (messagePacket.ParamList.Length < 5)
8896 {
8897 SenderID = AgentId;
8898 SenderName = Utils.BytesToString(messagePacket.ParamList[0].Parameter);
8899 Message = Utils.BytesToString(messagePacket.ParamList[1].Parameter);
8900 }
8901 else
8902 {
8903 SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter));
8904 SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter);
8905 Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter);
8906 }
8907
8898 OnEstateBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message); 8908 OnEstateBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message);
8899 } 8909 }
8900 return true; 8910 return true;
@@ -11789,209 +11799,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11789 OutPacket(pack, ThrottleOutPacketType.Task); 11799 OutPacket(pack, ThrottleOutPacketType.Task);
11790 } 11800 }
11791 11801
11792 #region PriorityQueue
11793 public class PriorityQueue
11794 {
11795 internal delegate bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity);
11796
11797 // Heap[0] for self updates
11798 // Heap[1..12] for entity updates
11799
11800 internal const uint m_numberOfQueues = 12;
11801 private MinHeap<MinHeapItem>[] m_heaps = new MinHeap<MinHeapItem>[m_numberOfQueues];
11802 private Dictionary<uint, LookupItem> m_lookupTable;
11803 private object m_syncRoot = new object();
11804 private uint m_nextQueue = 0;
11805 private UInt64 m_nextRequest = 0;
11806
11807 internal PriorityQueue() :
11808 this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY) { }
11809 internal PriorityQueue(int capacity)
11810 {
11811 m_lookupTable = new Dictionary<uint, LookupItem>(capacity);
11812
11813 for (int i = 0; i < m_heaps.Length; ++i)
11814 m_heaps[i] = new MinHeap<MinHeapItem>(capacity);
11815 }
11816
11817 public object SyncRoot { get { return this.m_syncRoot; } }
11818
11819 internal int Count
11820 {
11821 get
11822 {
11823 int count = 0;
11824 for (int i = 0; i < m_heaps.Length; ++i)
11825 count += m_heaps[i].Count;
11826 return count;
11827 }
11828 }
11829
11830 public bool Enqueue(uint pqueue, EntityUpdate value)
11831 {
11832 LookupItem lookup;
11833
11834 uint localid = value.Entity.LocalId;
11835 UInt64 entry = m_nextRequest++;
11836 if (m_lookupTable.TryGetValue(localid, out lookup))
11837 {
11838 entry = lookup.Heap[lookup.Handle].EntryOrder;
11839 value.Flags |= lookup.Heap[lookup.Handle].Value.Flags;
11840 lookup.Heap.Remove(lookup.Handle);
11841 }
11842
11843 pqueue = Util.Clamp<uint>(pqueue, 0, m_numberOfQueues - 1);
11844 lookup.Heap = m_heaps[pqueue];
11845 lookup.Heap.Add(new MinHeapItem(pqueue, entry, value), ref lookup.Handle);
11846 m_lookupTable[localid] = lookup;
11847
11848 return true;
11849 }
11850
11851 internal bool TryDequeue(out EntityUpdate value, out Int32 timeinqueue)
11852 {
11853 for (int i = 0; i < m_numberOfQueues; ++i)
11854 {
11855 // To get the fair queing, we cycle through each of the
11856 // queues when finding an element to dequeue, this code
11857 // assumes that the distribution of updates in the queues
11858 // is polynomial, probably quadractic (eg distance of PI * R^2)
11859 uint h = (uint)((m_nextQueue + i) % m_numberOfQueues);
11860 if (m_heaps[h].Count > 0)
11861 {
11862 m_nextQueue = (uint)((h + 1) % m_numberOfQueues);
11863
11864 MinHeapItem item = m_heaps[h].RemoveMin();
11865 m_lookupTable.Remove(item.Value.Entity.LocalId);
11866 timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
11867 value = item.Value;
11868
11869 return true;
11870 }
11871 }
11872
11873 timeinqueue = 0;
11874 value = default(EntityUpdate);
11875 return false;
11876 }
11877
11878 internal void Reprioritize(UpdatePriorityHandler handler)
11879 {
11880 MinHeapItem item;
11881 foreach (LookupItem lookup in new List<LookupItem>(this.m_lookupTable.Values))
11882 {
11883 if (lookup.Heap.TryGetValue(lookup.Handle, out item))
11884 {
11885 uint pqueue = item.PriorityQueue;
11886 uint localid = item.Value.Entity.LocalId;
11887
11888 if (handler(ref pqueue, item.Value.Entity))
11889 {
11890 // unless the priority queue has changed, there is no need to modify
11891 // the entry
11892 pqueue = Util.Clamp<uint>(pqueue, 0, m_numberOfQueues - 1);
11893 if (pqueue != item.PriorityQueue)
11894 {
11895 lookup.Heap.Remove(lookup.Handle);
11896
11897 LookupItem litem = lookup;
11898 litem.Heap = m_heaps[pqueue];
11899 litem.Heap.Add(new MinHeapItem(pqueue, item), ref litem.Handle);
11900 m_lookupTable[localid] = litem;
11901 }
11902 }
11903 else
11904 {
11905 m_log.WarnFormat("[LLCLIENTVIEW]: UpdatePriorityHandler returned false for {0}",item.Value.Entity.UUID);
11906 lookup.Heap.Remove(lookup.Handle);
11907 this.m_lookupTable.Remove(localid);
11908 }
11909 }
11910 }
11911 }
11912
11913 public override string ToString()
11914 {
11915 string s = "";
11916 for (int i = 0; i < m_numberOfQueues; i++)
11917 {
11918 if (s != "") s += ",";
11919 s += m_heaps[i].Count.ToString();
11920 }
11921 return s;
11922 }
11923
11924 #region MinHeapItem
11925 private struct MinHeapItem : IComparable<MinHeapItem>
11926 {
11927 private EntityUpdate value;
11928 internal EntityUpdate Value {
11929 get {
11930 return this.value;
11931 }
11932 }
11933
11934 private uint pqueue;
11935 internal uint PriorityQueue {
11936 get {
11937 return this.pqueue;
11938 }
11939 }
11940
11941 private Int32 entrytime;
11942 internal Int32 EntryTime {
11943 get {
11944 return this.entrytime;
11945 }
11946 }
11947
11948 private UInt64 entryorder;
11949 internal UInt64 EntryOrder
11950 {
11951 get {
11952 return this.entryorder;
11953 }
11954 }
11955
11956 internal MinHeapItem(uint pqueue, MinHeapItem other)
11957 {
11958 this.entrytime = other.entrytime;
11959 this.entryorder = other.entryorder;
11960 this.value = other.value;
11961 this.pqueue = pqueue;
11962 }
11963
11964 internal MinHeapItem(uint pqueue, UInt64 entryorder, EntityUpdate value)
11965 {
11966 this.entrytime = Util.EnvironmentTickCount();
11967 this.entryorder = entryorder;
11968 this.value = value;
11969 this.pqueue = pqueue;
11970 }
11971
11972 public override string ToString()
11973 {
11974 return String.Format("[{0},{1},{2}]",pqueue,entryorder,value.Entity.LocalId);
11975 }
11976
11977 public int CompareTo(MinHeapItem other)
11978 {
11979 // I'm assuming that the root part of an SOG is added to the update queue
11980 // before the component parts
11981 return Comparer<UInt64>.Default.Compare(this.EntryOrder, other.EntryOrder);
11982 }
11983 }
11984 #endregion
11985
11986 #region LookupItem
11987 private struct LookupItem
11988 {
11989 internal MinHeap<MinHeapItem> Heap;
11990 internal IHandle Handle;
11991 }
11992 #endregion
11993 }
11994
11995 public struct PacketProcessor 11802 public struct PacketProcessor
11996 { 11803 {
11997 public PacketMethod method; 11804 public PacketMethod method;
@@ -12012,8 +11819,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
12012 } 11819 }
12013 } 11820 }
12014 11821
12015 #endregion
12016
12017 public static OSD BuildEvent(string eventName, OSD eventBody) 11822 public static OSD BuildEvent(string eventName, OSD eventBody)
12018 { 11823 {
12019 OSDMap osdEvent = new OSDMap(2); 11824 OSDMap osdEvent = new OSDMap(2);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/PriorityQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/PriorityQueue.cs
new file mode 100644
index 0000000..364ce4b
--- /dev/null
+++ b/OpenSim/Region/ClientStack/LindenUDP/PriorityQueue.cs
@@ -0,0 +1,245 @@
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
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Reflection;
32
33using OpenSim.Framework;
34using OpenSim.Framework.Client;
35using log4net;
36
37namespace OpenSim.Region.ClientStack.LindenUDP
38{
39 public class PriorityQueue
40 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42
43 internal delegate bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity);
44
45 // Heap[0] for self updates
46 // Heap[1..12] for entity updates
47
48 internal const uint m_numberOfQueues = 12;
49
50 private MinHeap<MinHeapItem>[] m_heaps = new MinHeap<MinHeapItem>[m_numberOfQueues];
51 private Dictionary<uint, LookupItem> m_lookupTable;
52 private uint m_nextQueue = 0;
53 private UInt64 m_nextRequest = 0;
54
55 private object m_syncRoot = new object();
56 public object SyncRoot {
57 get { return this.m_syncRoot; }
58 }
59
60 internal PriorityQueue() : this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY) { }
61
62 internal PriorityQueue(int capacity)
63 {
64 m_lookupTable = new Dictionary<uint, LookupItem>(capacity);
65
66 for (int i = 0; i < m_heaps.Length; ++i)
67 m_heaps[i] = new MinHeap<MinHeapItem>(capacity);
68 }
69
70 internal int Count
71 {
72 get
73 {
74 int count = 0;
75 for (int i = 0; i < m_heaps.Length; ++i)
76 count += m_heaps[i].Count;
77 return count;
78 }
79 }
80
81 public bool Enqueue(uint pqueue, EntityUpdate value)
82 {
83 LookupItem lookup;
84
85 uint localid = value.Entity.LocalId;
86 UInt64 entry = m_nextRequest++;
87 if (m_lookupTable.TryGetValue(localid, out lookup))
88 {
89 entry = lookup.Heap[lookup.Handle].EntryOrder;
90 value.Flags |= lookup.Heap[lookup.Handle].Value.Flags;
91 lookup.Heap.Remove(lookup.Handle);
92 }
93
94 pqueue = Util.Clamp<uint>(pqueue, 0, m_numberOfQueues - 1);
95 lookup.Heap = m_heaps[pqueue];
96 lookup.Heap.Add(new MinHeapItem(pqueue, entry, value), ref lookup.Handle);
97 m_lookupTable[localid] = lookup;
98
99 return true;
100 }
101
102 internal bool TryDequeue(out EntityUpdate value, out Int32 timeinqueue)
103 {
104 for (int i = 0; i < m_numberOfQueues; ++i)
105 {
106 // To get the fair queing, we cycle through each of the
107 // queues when finding an element to dequeue, this code
108 // assumes that the distribution of updates in the queues
109 // is polynomial, probably quadractic (eg distance of PI * R^2)
110 uint h = (uint)((m_nextQueue + i) % m_numberOfQueues);
111 if (m_heaps[h].Count > 0)
112 {
113 m_nextQueue = (uint)((h + 1) % m_numberOfQueues);
114
115 MinHeapItem item = m_heaps[h].RemoveMin();
116 m_lookupTable.Remove(item.Value.Entity.LocalId);
117 timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
118 value = item.Value;
119
120 return true;
121 }
122 }
123
124 timeinqueue = 0;
125 value = default(EntityUpdate);
126 return false;
127 }
128
129 internal void Reprioritize(UpdatePriorityHandler handler)
130 {
131 MinHeapItem item;
132 foreach (LookupItem lookup in new List<LookupItem>(this.m_lookupTable.Values))
133 {
134 if (lookup.Heap.TryGetValue(lookup.Handle, out item))
135 {
136 uint pqueue = item.PriorityQueue;
137 uint localid = item.Value.Entity.LocalId;
138
139 if (handler(ref pqueue, item.Value.Entity))
140 {
141 // unless the priority queue has changed, there is no need to modify
142 // the entry
143 pqueue = Util.Clamp<uint>(pqueue, 0, m_numberOfQueues - 1);
144 if (pqueue != item.PriorityQueue)
145 {
146 lookup.Heap.Remove(lookup.Handle);
147
148 LookupItem litem = lookup;
149 litem.Heap = m_heaps[pqueue];
150 litem.Heap.Add(new MinHeapItem(pqueue, item), ref litem.Handle);
151 m_lookupTable[localid] = litem;
152 }
153 }
154 else
155 {
156 // m_log.WarnFormat("[PQUEUE]: UpdatePriorityHandler returned false for {0}",item.Value.Entity.UUID);
157 lookup.Heap.Remove(lookup.Handle);
158 this.m_lookupTable.Remove(localid);
159 }
160 }
161 }
162 }
163
164 public override string ToString()
165 {
166 string s = "";
167 for (int i = 0; i < m_numberOfQueues; i++)
168 {
169 if (s != "") s += ",";
170 s += m_heaps[i].Count.ToString();
171 }
172 return s;
173 }
174
175#region MinHeapItem
176 private struct MinHeapItem : IComparable<MinHeapItem>
177 {
178 private EntityUpdate value;
179 internal EntityUpdate Value {
180 get {
181 return this.value;
182 }
183 }
184
185 private uint pqueue;
186 internal uint PriorityQueue {
187 get {
188 return this.pqueue;
189 }
190 }
191
192 private Int32 entrytime;
193 internal Int32 EntryTime {
194 get {
195 return this.entrytime;
196 }
197 }
198
199 private UInt64 entryorder;
200 internal UInt64 EntryOrder
201 {
202 get {
203 return this.entryorder;
204 }
205 }
206
207 internal MinHeapItem(uint pqueue, MinHeapItem other)
208 {
209 this.entrytime = other.entrytime;
210 this.entryorder = other.entryorder;
211 this.value = other.value;
212 this.pqueue = pqueue;
213 }
214
215 internal MinHeapItem(uint pqueue, UInt64 entryorder, EntityUpdate value)
216 {
217 this.entrytime = Util.EnvironmentTickCount();
218 this.entryorder = entryorder;
219 this.value = value;
220 this.pqueue = pqueue;
221 }
222
223 public override string ToString()
224 {
225 return String.Format("[{0},{1},{2}]",pqueue,entryorder,value.Entity.LocalId);
226 }
227
228 public int CompareTo(MinHeapItem other)
229 {
230 // I'm assuming that the root part of an SOG is added to the update queue
231 // before the component parts
232 return Comparer<UInt64>.Default.Compare(this.EntryOrder, other.EntryOrder);
233 }
234 }
235#endregion
236
237#region LookupItem
238 private struct LookupItem
239 {
240 internal MinHeap<MinHeapItem> Heap;
241 internal IHandle Handle;
242 }
243#endregion
244 }
245}
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 57ab135..b6d64ac 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -200,12 +200,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
200 } 200 }
201 Scene.RegionInfo.RegionSettings.Save(); 201 Scene.RegionInfo.RegionSettings.Save();
202 TriggerRegionInfoChange(); 202 TriggerRegionInfoChange();
203 sendRegionHandshakeToAll();
203 sendRegionInfoPacketToAll(); 204 sendRegionInfoPacketToAll();
204 } 205 }
205 206
206 private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient) 207 private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient)
207 { 208 {
208 sendRegionHandshakeToAll(); 209 // sendRegionHandshakeToAll();
209 } 210 }
210 211
211 public void setRegionTerrainSettings(float WaterHeight, 212 public void setRegionTerrainSettings(float WaterHeight,
@@ -274,8 +275,25 @@ namespace OpenSim.Region.CoreModules.World.Estate
274 { 275 {
275 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 276 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
276 { 277 {
278 if ((estateAccessType & 1) != 0) // All estates
279 {
280 List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
281 EstateSettings estateSettings;
282
283 foreach (int estateID in estateIDs)
284 {
285 if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
286 {
287 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
288 estateSettings.AddEstateUser(user);
289 estateSettings.Save();
290 }
291 }
292 }
293
277 Scene.RegionInfo.EstateSettings.AddEstateUser(user); 294 Scene.RegionInfo.EstateSettings.AddEstateUser(user);
278 Scene.RegionInfo.EstateSettings.Save(); 295 Scene.RegionInfo.EstateSettings.Save();
296
279 TriggerEstateInfoChange(); 297 TriggerEstateInfoChange();
280 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); 298 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID);
281 } 299 }
@@ -289,10 +307,26 @@ namespace OpenSim.Region.CoreModules.World.Estate
289 { 307 {
290 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 308 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
291 { 309 {
310 if ((estateAccessType & 1) != 0) // All estates
311 {
312 List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
313 EstateSettings estateSettings;
314
315 foreach (int estateID in estateIDs)
316 {
317 if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
318 {
319 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
320 estateSettings.RemoveEstateUser(user);
321 estateSettings.Save();
322 }
323 }
324 }
325
292 Scene.RegionInfo.EstateSettings.RemoveEstateUser(user); 326 Scene.RegionInfo.EstateSettings.RemoveEstateUser(user);
293 Scene.RegionInfo.EstateSettings.Save(); 327 Scene.RegionInfo.EstateSettings.Save();
294 TriggerEstateInfoChange();
295 328
329 TriggerEstateInfoChange();
296 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); 330 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID);
297 } 331 }
298 else 332 else
@@ -304,8 +338,25 @@ namespace OpenSim.Region.CoreModules.World.Estate
304 { 338 {
305 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 339 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
306 { 340 {
341 if ((estateAccessType & 1) != 0) // All estates
342 {
343 List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
344 EstateSettings estateSettings;
345
346 foreach (int estateID in estateIDs)
347 {
348 if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
349 {
350 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
351 estateSettings.AddEstateGroup(user);
352 estateSettings.Save();
353 }
354 }
355 }
356
307 Scene.RegionInfo.EstateSettings.AddEstateGroup(user); 357 Scene.RegionInfo.EstateSettings.AddEstateGroup(user);
308 Scene.RegionInfo.EstateSettings.Save(); 358 Scene.RegionInfo.EstateSettings.Save();
359
309 TriggerEstateInfoChange(); 360 TriggerEstateInfoChange();
310 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); 361 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID);
311 } 362 }
@@ -318,10 +369,26 @@ namespace OpenSim.Region.CoreModules.World.Estate
318 { 369 {
319 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 370 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
320 { 371 {
372 if ((estateAccessType & 1) != 0) // All estates
373 {
374 List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
375 EstateSettings estateSettings;
376
377 foreach (int estateID in estateIDs)
378 {
379 if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
380 {
381 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
382 estateSettings.RemoveEstateGroup(user);
383 estateSettings.Save();
384 }
385 }
386 }
387
321 Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); 388 Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user);
322 Scene.RegionInfo.EstateSettings.Save(); 389 Scene.RegionInfo.EstateSettings.Save();
323 TriggerEstateInfoChange();
324 390
391 TriggerEstateInfoChange();
325 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); 392 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID);
326 } 393 }
327 else 394 else
@@ -349,6 +416,29 @@ namespace OpenSim.Region.CoreModules.World.Estate
349 if (!alreadyInList) 416 if (!alreadyInList)
350 { 417 {
351 418
419 if ((estateAccessType & 1) != 0) // All estates
420 {
421 List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
422 EstateSettings estateSettings;
423
424 foreach (int estateID in estateIDs)
425 {
426 if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
427 {
428 EstateBan bitem = new EstateBan();
429
430 bitem.BannedUserID = user;
431 bitem.EstateID = (uint)estateID;
432 bitem.BannedHostAddress = "0.0.0.0";
433 bitem.BannedHostIPMask = "0.0.0.0";
434
435 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
436 estateSettings.AddBan(bitem);
437 estateSettings.Save();
438 }
439 }
440 }
441
352 EstateBan item = new EstateBan(); 442 EstateBan item = new EstateBan();
353 443
354 item.BannedUserID = user; 444 item.BannedUserID = user;
@@ -358,6 +448,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
358 448
359 Scene.RegionInfo.EstateSettings.AddBan(item); 449 Scene.RegionInfo.EstateSettings.AddBan(item);
360 Scene.RegionInfo.EstateSettings.Save(); 450 Scene.RegionInfo.EstateSettings.Save();
451
361 TriggerEstateInfoChange(); 452 TriggerEstateInfoChange();
362 453
363 ScenePresence s = Scene.GetScenePresence(user); 454 ScenePresence s = Scene.GetScenePresence(user);
@@ -403,8 +494,25 @@ namespace OpenSim.Region.CoreModules.World.Estate
403 494
404 if (alreadyInList && listitem != null) 495 if (alreadyInList && listitem != null)
405 { 496 {
497 if ((estateAccessType & 1) != 0) // All estates
498 {
499 List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
500 EstateSettings estateSettings;
501
502 foreach (int estateID in estateIDs)
503 {
504 if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
505 {
506 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
507 estateSettings.RemoveBan(user);
508 estateSettings.Save();
509 }
510 }
511 }
512
406 Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); 513 Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID);
407 Scene.RegionInfo.EstateSettings.Save(); 514 Scene.RegionInfo.EstateSettings.Save();
515
408 TriggerEstateInfoChange(); 516 TriggerEstateInfoChange();
409 } 517 }
410 else 518 else
@@ -424,8 +532,25 @@ namespace OpenSim.Region.CoreModules.World.Estate
424 { 532 {
425 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 533 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
426 { 534 {
535 if ((estateAccessType & 1) != 0) // All estates
536 {
537 List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
538 EstateSettings estateSettings;
539
540 foreach (int estateID in estateIDs)
541 {
542 if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
543 {
544 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
545 estateSettings.AddEstateManager(user);
546 estateSettings.Save();
547 }
548 }
549 }
550
427 Scene.RegionInfo.EstateSettings.AddEstateManager(user); 551 Scene.RegionInfo.EstateSettings.AddEstateManager(user);
428 Scene.RegionInfo.EstateSettings.Save(); 552 Scene.RegionInfo.EstateSettings.Save();
553
429 TriggerEstateInfoChange(); 554 TriggerEstateInfoChange();
430 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); 555 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID);
431 } 556 }
@@ -438,10 +563,26 @@ namespace OpenSim.Region.CoreModules.World.Estate
438 { 563 {
439 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 564 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
440 { 565 {
566 if ((estateAccessType & 1) != 0) // All estates
567 {
568 List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
569 EstateSettings estateSettings;
570
571 foreach (int estateID in estateIDs)
572 {
573 if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
574 {
575 estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
576 estateSettings.RemoveEstateManager(user);
577 estateSettings.Save();
578 }
579 }
580 }
581
441 Scene.RegionInfo.EstateSettings.RemoveEstateManager(user); 582 Scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
442 Scene.RegionInfo.EstateSettings.Save(); 583 Scene.RegionInfo.EstateSettings.Save();
443 TriggerEstateInfoChange();
444 584
585 TriggerEstateInfoChange();
445 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); 586 remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID);
446 } 587 }
447 else 588 else
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
index 7d990c2..7fc358d 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
@@ -133,16 +133,6 @@ namespace OpenSim.Region.CoreModules.World.Land
133 return new List<ILandObject>(); 133 return new List<ILandObject>();
134 } 134 }
135 135
136 public bool IsLandPrimCountTainted()
137 {
138 if (m_landManagementModule != null)
139 {
140 return m_landManagementModule.IsLandPrimCountTainted();
141 }
142
143 return false;
144 }
145
146 public bool IsForcefulBansAllowed() 136 public bool IsForcefulBansAllowed()
147 { 137 {
148 if (m_landManagementModule != null) 138 if (m_landManagementModule != null)
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 2b5f7a0..bfab7b8 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -62,8 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Land
62 62
63 public class LandManagementModule : INonSharedRegionModule 63 public class LandManagementModule : INonSharedRegionModule
64 { 64 {
65 private static readonly ILog m_log = 65 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
66 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
67 66
68 private static readonly string remoteParcelRequestPath = "0009/"; 67 private static readonly string remoteParcelRequestPath = "0009/";
69 68
@@ -89,7 +88,6 @@ namespace OpenSim.Region.CoreModules.World.Land
89 /// </value> 88 /// </value>
90 private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); 89 private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
91 90
92 private bool m_landPrimCountTainted;
93 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; 91 private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
94 92
95 private bool m_allowedForcefulBans = true; 93 private bool m_allowedForcefulBans = true;
@@ -122,18 +120,18 @@ namespace OpenSim.Region.CoreModules.World.Land
122 120
123 m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd; 121 m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd;
124 m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate; 122 m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate;
123 m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene;
124 m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
125
125 m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel; 126 m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel;
126 m_scene.EventManager.OnClientMovement += EventManagerOnClientMovement; 127 m_scene.EventManager.OnClientMovement += EventManagerOnClientMovement;
127 m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy; 128 m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy;
128 m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy; 129 m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy;
129 m_scene.EventManager.OnNewClient += EventManagerOnNewClient; 130 m_scene.EventManager.OnNewClient += EventManagerOnNewClient;
130 m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement; 131 m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement;
131 m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene;
132 m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage; 132 m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage;
133 m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage; 133 m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage;
134 m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; 134 m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan;
135 m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
136 m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted;
137 m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; 135 m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps;
138 m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole; 136 m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole;
139 137
@@ -308,8 +306,8 @@ namespace OpenSim.Region.CoreModules.World.Land
308 /// <returns>The parcel created.</returns> 306 /// <returns>The parcel created.</returns>
309 protected ILandObject CreateDefaultParcel() 307 protected ILandObject CreateDefaultParcel()
310 { 308 {
311// m_log.DebugFormat( 309 m_log.DebugFormat(
312// "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); 310 "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName);
313 311
314 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); 312 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
315 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); 313 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
@@ -614,6 +612,10 @@ namespace OpenSim.Region.CoreModules.World.Land
614 { 612 {
615 if (landBitmap[x, y]) 613 if (landBitmap[x, y])
616 { 614 {
615// m_log.DebugFormat(
616// "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}",
617// new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName);
618
617 m_landIDList[x, y] = newLandLocalID; 619 m_landIDList[x, y] = newLandLocalID;
618 } 620 }
619 } 621 }
@@ -743,8 +745,16 @@ namespace OpenSim.Region.CoreModules.World.Land
743 // Corner case. If an autoreturn happens during sim startup 745 // Corner case. If an autoreturn happens during sim startup
744 // we will come here with the list uninitialized 746 // we will come here with the list uninitialized
745 // 747 //
748 int landId = m_landIDList[x, y];
749
750// if (landId == 0)
751// m_log.DebugFormat(
752// "[LAND MANAGEMENT MODULE]: No land object found at ({0}, {1}) on {2}",
753// x, y, m_scene.RegionInfo.RegionName);
754
746 if (m_landList.ContainsKey(m_landIDList[x, y])) 755 if (m_landList.ContainsKey(m_landIDList[x, y]))
747 return m_landList[m_landIDList[x, y]]; 756 return m_landList[m_landIDList[x, y]];
757
748 return null; 758 return null;
749 } 759 }
750 } 760 }
@@ -779,34 +789,24 @@ namespace OpenSim.Region.CoreModules.World.Land
779 789
780 #region Parcel Modification 790 #region Parcel Modification
781 791
782 public void ResetAllLandPrimCounts() 792 public void ResetOverMeRecords()
783 { 793 {
784 lock (m_landList) 794 lock (m_landList)
785 { 795 {
786 foreach (LandObject p in m_landList.Values) 796 foreach (LandObject p in m_landList.Values)
787 { 797 {
788 p.ResetLandPrimCounts(); 798 p.ResetOverMeRecord();
789 } 799 }
790 } 800 }
791 } 801 }
792 802
793 public void EventManagerOnParcelPrimCountTainted()
794 {
795 m_landPrimCountTainted = true;
796 }
797
798 public bool IsLandPrimCountTainted()
799 {
800 return m_landPrimCountTainted;
801 }
802
803 public void EventManagerOnParcelPrimCountAdd(SceneObjectGroup obj) 803 public void EventManagerOnParcelPrimCountAdd(SceneObjectGroup obj)
804 { 804 {
805 Vector3 position = obj.AbsolutePosition; 805 Vector3 position = obj.AbsolutePosition;
806 ILandObject landUnderPrim = GetLandObject(position.X, position.Y); 806 ILandObject landUnderPrim = GetLandObject(position.X, position.Y);
807 if (landUnderPrim != null) 807 if (landUnderPrim != null)
808 { 808 {
809 ((LandObject)landUnderPrim).AddPrimToCount(obj); 809 ((LandObject)landUnderPrim).AddPrimOverMe(obj);
810 } 810 }
811 } 811 }
812 812
@@ -816,7 +816,7 @@ namespace OpenSim.Region.CoreModules.World.Land
816 { 816 {
817 foreach (LandObject p in m_landList.Values) 817 foreach (LandObject p in m_landList.Values)
818 { 818 {
819 p.RemovePrimFromCount(obj); 819 p.RemovePrimFromOverMe(obj);
820 } 820 }
821 } 821 }
822 } 822 }
@@ -849,8 +849,7 @@ namespace OpenSim.Region.CoreModules.World.Land
849 foreach (LandObject p in landOwnersAndParcels[owner]) 849 foreach (LandObject p in landOwnersAndParcels[owner])
850 { 850 {
851 simArea += p.LandData.Area; 851 simArea += p.LandData.Area;
852 simPrims += p.LandData.OwnerPrims + p.LandData.OtherPrims + p.LandData.GroupPrims + 852 simPrims += p.PrimCounts.Total;
853 p.LandData.SelectedPrims;
854 } 853 }
855 854
856 foreach (LandObject p in landOwnersAndParcels[owner]) 855 foreach (LandObject p in landOwnersAndParcels[owner])
@@ -867,7 +866,7 @@ namespace OpenSim.Region.CoreModules.World.Land
867// "[LAND MANAGEMENT MODULE]: Triggered EventManagerOnParcelPrimCountUpdate() for {0}", 866// "[LAND MANAGEMENT MODULE]: Triggered EventManagerOnParcelPrimCountUpdate() for {0}",
868// m_scene.RegionInfo.RegionName); 867// m_scene.RegionInfo.RegionName);
869 868
870 ResetAllLandPrimCounts(); 869 ResetOverMeRecords();
871 EntityBase[] entities = m_scene.Entities.GetEntities(); 870 EntityBase[] entities = m_scene.Entities.GetEntities();
872 foreach (EntityBase obj in entities) 871 foreach (EntityBase obj in entities)
873 { 872 {
@@ -880,15 +879,13 @@ namespace OpenSim.Region.CoreModules.World.Land
880 } 879 }
881 } 880 }
882 FinalizeLandPrimCountUpdate(); 881 FinalizeLandPrimCountUpdate();
883 m_landPrimCountTainted = false;
884 } 882 }
885 883
886 public void EventManagerOnRequestParcelPrimCountUpdate() 884 public void EventManagerOnRequestParcelPrimCountUpdate()
887 { 885 {
888 ResetAllLandPrimCounts(); 886 ResetOverMeRecords();
889 m_scene.EventManager.TriggerParcelPrimCountUpdate(); 887 m_scene.EventManager.TriggerParcelPrimCountUpdate();
890 FinalizeLandPrimCountUpdate(); 888 FinalizeLandPrimCountUpdate();
891 m_landPrimCountTainted = false;
892 } 889 }
893 890
894 /// <summary> 891 /// <summary>
@@ -952,8 +949,6 @@ namespace OpenSim.Region.CoreModules.World.Land
952 m_landList[startLandObjectIndex].ForceUpdateLandInfo(); 949 m_landList[startLandObjectIndex].ForceUpdateLandInfo();
953 } 950 }
954 951
955 EventManagerOnParcelPrimCountTainted();
956
957 //Now add the new land object 952 //Now add the new land object
958 ILandObject result = AddLandObject(newLand); 953 ILandObject result = AddLandObject(newLand);
959 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); 954 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData);
@@ -1020,7 +1015,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1020 performFinalLandJoin(masterLandObject, slaveLandObject); 1015 performFinalLandJoin(masterLandObject, slaveLandObject);
1021 } 1016 }
1022 } 1017 }
1023 EventManagerOnParcelPrimCountTainted();
1024 1018
1025 masterLandObject.SendLandUpdateToAvatarsOverMe(); 1019 masterLandObject.SendLandUpdateToAvatarsOverMe();
1026 } 1020 }
@@ -1210,6 +1204,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1210 1204
1211 if (land != null) 1205 if (land != null)
1212 { 1206 {
1207 m_scene.EventManager.TriggerParcelPrimCountUpdate();
1213 m_landList[local_id].SendLandObjectOwners(remote_client); 1208 m_landList[local_id].SendLandObjectOwners(remote_client);
1214 } 1209 }
1215 else 1210 else
@@ -1441,7 +1436,8 @@ namespace OpenSim.Region.CoreModules.World.Land
1441 private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) 1436 private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps)
1442 { 1437 {
1443 IClientAPI client; 1438 IClientAPI client;
1444 if (! m_scene.TryGetClient(agentID, out client)) { 1439 if (!m_scene.TryGetClient(agentID, out client))
1440 {
1445 m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to retrieve IClientAPI for {0}", agentID); 1441 m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to retrieve IClientAPI for {0}", agentID);
1446 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); 1442 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
1447 } 1443 }
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index e7bdb19..c2f104e 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -64,8 +64,6 @@ namespace OpenSim.Region.CoreModules.World.Land
64 64
65 #endregion 65 #endregion
66 66
67 #region ILandObject Members
68
69 public int GetPrimsFree() 67 public int GetPrimsFree()
70 { 68 {
71 m_scene.EventManager.TriggerParcelPrimCountUpdate(); 69 m_scene.EventManager.TriggerParcelPrimCountUpdate();
@@ -213,6 +211,7 @@ namespace OpenSim.Region.CoreModules.World.Land
213 return simMax; 211 return simMax;
214 } 212 }
215 } 213 }
214
216 #endregion 215 #endregion
217 216
218 #region Packet Request Handling 217 #region Packet Request Handling
@@ -702,23 +701,11 @@ namespace OpenSim.Region.CoreModules.World.Land
702 return LandBitmap; 701 return LandBitmap;
703 } 702 }
704 703
705 /// <summary>
706 /// Full sim land object creation
707 /// </summary>
708 /// <returns></returns>
709 public bool[,] BasicFullRegionLandBitmap() 704 public bool[,] BasicFullRegionLandBitmap()
710 { 705 {
711 return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); 706 return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize);
712 } 707 }
713 708
714 /// <summary>
715 /// Used to modify the bitmap between the x and y points. Points use 64 scale
716 /// </summary>
717 /// <param name="start_x"></param>
718 /// <param name="start_y"></param>
719 /// <param name="end_x"></param>
720 /// <param name="end_y"></param>
721 /// <returns></returns>
722 public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) 709 public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y)
723 { 710 {
724 bool[,] tempBitmap = new bool[64,64]; 711 bool[,] tempBitmap = new bool[64,64];
@@ -909,9 +896,12 @@ namespace OpenSim.Region.CoreModules.World.Land
909 896
910 lock (primsOverMe) 897 lock (primsOverMe)
911 { 898 {
899// m_log.DebugFormat(
900// "[LAND OBJECT]: Request for SendLandObjectOwners() from {0} with {1} known prims on region",
901// remote_client.Name, primsOverMe.Count);
902
912 try 903 try
913 { 904 {
914
915 foreach (SceneObjectGroup obj in primsOverMe) 905 foreach (SceneObjectGroup obj in primsOverMe)
916 { 906 {
917 try 907 try
@@ -923,7 +913,7 @@ namespace OpenSim.Region.CoreModules.World.Land
923 } 913 }
924 catch (NullReferenceException) 914 catch (NullReferenceException)
925 { 915 {
926 m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); 916 m_log.Error("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel");
927 } 917 }
928 try 918 try
929 { 919 {
@@ -950,6 +940,7 @@ namespace OpenSim.Region.CoreModules.World.Land
950 public Dictionary<UUID, int> GetLandObjectOwners() 940 public Dictionary<UUID, int> GetLandObjectOwners()
951 { 941 {
952 Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>(); 942 Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>();
943
953 lock (primsOverMe) 944 lock (primsOverMe)
954 { 945 {
955 try 946 try
@@ -986,8 +977,10 @@ namespace OpenSim.Region.CoreModules.World.Land
986 977
987 public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client) 978 public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client)
988 { 979 {
989 Dictionary<UUID,List<SceneObjectGroup>> returns = 980// m_log.DebugFormat(
990 new Dictionary<UUID,List<SceneObjectGroup>>(); 981// "[LAND OBJECT]: Request to return objects in {0} from {1}", LandData.Name, remote_client.Name);
982
983 Dictionary<UUID,List<SceneObjectGroup>> returns = new Dictionary<UUID,List<SceneObjectGroup>>();
991 984
992 lock (primsOverMe) 985 lock (primsOverMe)
993 { 986 {
@@ -1060,83 +1053,29 @@ namespace OpenSim.Region.CoreModules.World.Land
1060 1053
1061 #region Object Adding/Removing from Parcel 1054 #region Object Adding/Removing from Parcel
1062 1055
1063 public void ResetLandPrimCounts() 1056 public void ResetOverMeRecord()
1064 { 1057 {
1065 LandData.GroupPrims = 0;
1066 LandData.OwnerPrims = 0;
1067 LandData.OtherPrims = 0;
1068 LandData.SelectedPrims = 0;
1069
1070
1071 lock (primsOverMe) 1058 lock (primsOverMe)
1072 primsOverMe.Clear(); 1059 primsOverMe.Clear();
1073 } 1060 }
1074 1061
1075 public void AddPrimToCount(SceneObjectGroup obj) 1062 public void AddPrimOverMe(SceneObjectGroup obj)
1076 { 1063 {
1077 1064// m_log.DebugFormat("[LAND OBJECT]: Adding scene object {0} {1} over {2}", obj.Name, obj.LocalId, LandData.Name);
1078 UUID prim_owner = obj.OwnerID; 1065
1079 int prim_count = obj.PrimCount;
1080
1081 if (obj.IsSelected)
1082 {
1083 LandData.SelectedPrims += prim_count;
1084 }
1085 else
1086 {
1087 if (prim_owner == LandData.OwnerID)
1088 {
1089 LandData.OwnerPrims += prim_count;
1090 }
1091 else if ((obj.GroupID == LandData.GroupID ||
1092 prim_owner == LandData.GroupID) &&
1093 LandData.GroupID != UUID.Zero)
1094 {
1095 LandData.GroupPrims += prim_count;
1096 }
1097 else
1098 {
1099 LandData.OtherPrims += prim_count;
1100 }
1101 }
1102
1103 lock (primsOverMe) 1066 lock (primsOverMe)
1104 primsOverMe.Add(obj); 1067 primsOverMe.Add(obj);
1105 } 1068 }
1106 1069
1107 public void RemovePrimFromCount(SceneObjectGroup obj) 1070 public void RemovePrimFromOverMe(SceneObjectGroup obj)
1108 { 1071 {
1072// m_log.DebugFormat("[LAND OBJECT]: Removing scene object {0} {1} from over {2}", obj.Name, obj.LocalId, LandData.Name);
1073
1109 lock (primsOverMe) 1074 lock (primsOverMe)
1110 { 1075 primsOverMe.Remove(obj);
1111 if (primsOverMe.Contains(obj))
1112 {
1113 UUID prim_owner = obj.OwnerID;
1114 int prim_count = obj.PrimCount;
1115
1116 if (prim_owner == LandData.OwnerID)
1117 {
1118 LandData.OwnerPrims -= prim_count;
1119 }
1120 else if (obj.GroupID == LandData.GroupID ||
1121 prim_owner == LandData.GroupID)
1122 {
1123 LandData.GroupPrims -= prim_count;
1124 }
1125 else
1126 {
1127 LandData.OtherPrims -= prim_count;
1128 }
1129
1130 primsOverMe.Remove(obj);
1131 }
1132 }
1133 } 1076 }
1134 1077
1135 #endregion 1078 #endregion
1136
1137 #endregion
1138
1139 #endregion
1140 1079
1141 /// <summary> 1080 /// <summary>
1142 /// Set the media url for this land parcel 1081 /// Set the media url for this land parcel
@@ -1157,5 +1096,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1157 LandData.MusicURL = url; 1096 LandData.MusicURL = url;
1158 SendLandUpdateToAvatarsOverMe(); 1097 SendLandUpdateToAvatarsOverMe();
1159 } 1098 }
1099
1100 #endregion
1160 } 1101 }
1161} 1102}
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index bc140ae..dca842a 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -173,24 +173,32 @@ namespace OpenSim.Region.CoreModules.World.Land
173 173
174 // NOTE: Call under Taint Lock 174 // NOTE: Call under Taint Lock
175 private void AddObject(SceneObjectGroup obj) 175 private void AddObject(SceneObjectGroup obj)
176 { 176 {
177// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} {1} to prim count", obj.Name, obj.UUID);
178
179 if (obj.IsAttachment) 177 if (obj.IsAttachment)
180 return; 178 return;
181 if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)) 179 if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0))
182 return; 180 return;
183 181
184 Vector3 pos = obj.AbsolutePosition; 182 Vector3 pos = obj.AbsolutePosition;
185 ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y); 183 ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y);
186 184
187 // If for some reason there is no land object (perhaps the object is out of bounds) then we can't count it 185 // If for some reason there is no land object (perhaps the object is out of bounds) then we can't count it
188 if (landObject == null) 186 if (landObject == null)
187 {
188// m_log.WarnFormat(
189// "[PRIM COUNT MODULE]: Found no land object for {0} at position ({1}, {2}) on {3}",
190// obj.Name, pos.X, pos.Y, m_Scene.RegionInfo.RegionName);
191
189 return; 192 return;
193 }
190 194
191 LandData landData = landObject.LandData; 195 LandData landData = landObject.LandData;
192 196
193// m_log.DebugFormat( 197// m_log.DebugFormat(
198// "[PRIM COUNT MODULE]: Adding object {0} with {1} parts to prim count for parcel {2} on {3}",
199// obj.Name, obj.Parts.Length, landData.Name, m_Scene.RegionInfo.RegionName);
200
201// m_log.DebugFormat(
194// "[PRIM COUNT MODULE]: Object {0} is owned by {1} over land owned by {2}", 202// "[PRIM COUNT MODULE]: Object {0} is owned by {1} over land owned by {2}",
195// obj.Name, obj.OwnerID, landData.OwnerID); 203// obj.Name, obj.OwnerID, landData.OwnerID);
196 204
@@ -206,25 +214,29 @@ namespace OpenSim.Region.CoreModules.World.Land
206 else 214 else
207 parcelCounts.Users[obj.OwnerID] = partCount; 215 parcelCounts.Users[obj.OwnerID] = partCount;
208 216
209 if (landData.IsGroupOwned) 217 if (obj.IsSelected)
210 { 218 {
211 if (obj.OwnerID == landData.GroupID) 219 parcelCounts.Selected += partCount;
212 parcelCounts.Owner += partCount;
213 else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID)
214 parcelCounts.Group += partCount;
215 else
216 parcelCounts.Others += partCount;
217 } 220 }
218 else 221 else
219 { 222 {
220 if (obj.OwnerID == landData.OwnerID) 223 if (landData.IsGroupOwned)
221 parcelCounts.Owner += partCount; 224 {
225 if (obj.OwnerID == landData.GroupID)
226 parcelCounts.Owner += partCount;
227 else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID)
228 parcelCounts.Group += partCount;
229 else
230 parcelCounts.Others += partCount;
231 }
222 else 232 else
223 parcelCounts.Others += partCount; 233 {
234 if (obj.OwnerID == landData.OwnerID)
235 parcelCounts.Owner += partCount;
236 else
237 parcelCounts.Others += partCount;
238 }
224 } 239 }
225
226 if (obj.IsSelected)
227 parcelCounts.Selected += partCount;
228 } 240 }
229 } 241 }
230 242
@@ -380,6 +392,7 @@ namespace OpenSim.Region.CoreModules.World.Land
380 count = counts.Owner; 392 count = counts.Owner;
381 count += counts.Group; 393 count += counts.Group;
382 count += counts.Others; 394 count += counts.Others;
395 count += counts.Selected;
383 } 396 }
384 } 397 }
385 398
@@ -468,7 +481,9 @@ namespace OpenSim.Region.CoreModules.World.Land
468 481
469 m_OwnerMap[landData.GlobalID] = landData.OwnerID; 482 m_OwnerMap[landData.GlobalID] = landData.OwnerID;
470 m_SimwideCounts[landData.OwnerID] = 0; 483 m_SimwideCounts[landData.OwnerID] = 0;
471// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding parcel count for {0}", landData.GlobalID); 484// m_log.DebugFormat(
485// "[PRIM COUNT MODULE]: Initializing parcel count for {0} on {1}",
486// landData.Name, m_Scene.RegionInfo.RegionName);
472 m_ParcelCounts[landData.GlobalID] = new ParcelCounts(); 487 m_ParcelCounts[landData.GlobalID] = new ParcelCounts();
473 } 488 }
474 489
@@ -578,4 +593,4 @@ namespace OpenSim.Region.CoreModules.World.Land
578 } 593 }
579 } 594 }
580 } 595 }
581} 596} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index f006db2..67b00ac 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -49,7 +49,16 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
49 protected UUID m_otherUserId = new UUID("99999999-9999-9999-9999-999999999999"); 49 protected UUID m_otherUserId = new UUID("99999999-9999-9999-9999-999999999999");
50 protected TestScene m_scene; 50 protected TestScene m_scene;
51 protected PrimCountModule m_pcm; 51 protected PrimCountModule m_pcm;
52
53 /// <summary>
54 /// A parcel that covers the entire sim except for a 1 unit wide strip on the eastern side.
55 /// </summary>
52 protected ILandObject m_lo; 56 protected ILandObject m_lo;
57
58 /// <summary>
59 /// A parcel that covers just the eastern strip of the sim.
60 /// </summary>
61 protected ILandObject m_lo2;
53 62
54 [SetUp] 63 [SetUp]
55 public void SetUp() 64 public void SetUp()
@@ -59,10 +68,19 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
59 m_scene = SceneSetupHelpers.SetupScene(); 68 m_scene = SceneSetupHelpers.SetupScene();
60 SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); 69 SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm);
61 70
71 int xParcelDivider = (int)Constants.RegionSize - 1;
72
62 ILandObject lo = new LandObject(m_userId, false, m_scene); 73 ILandObject lo = new LandObject(m_userId, false, m_scene);
63 lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); 74 lo.LandData.Name = "m_lo";
64 m_lo = lmm.AddLandObject(lo); 75 lo.SetLandBitmap(
65 //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); 76 lo.GetSquareLandBitmap(0, 0, xParcelDivider, (int)Constants.RegionSize));
77 m_lo = lmm.AddLandObject(lo);
78
79 ILandObject lo2 = new LandObject(m_userId, false, m_scene);
80 lo2.SetLandBitmap(
81 lo2.GetSquareLandBitmap(xParcelDivider, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
82 lo2.LandData.Name = "m_lo2";
83 m_lo2 = lmm.AddLandObject(lo2);
66 } 84 }
67 85
68 /// <summary> 86 /// <summary>
@@ -94,7 +112,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
94 112
95 IPrimCounts pc = m_lo.PrimCounts; 113 IPrimCounts pc = m_lo.PrimCounts;
96 114
97 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); 115 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
98 m_scene.AddNewSceneObject(sog, false); 116 m_scene.AddNewSceneObject(sog, false);
99 117
100 Assert.That(pc.Owner, Is.EqualTo(3)); 118 Assert.That(pc.Owner, Is.EqualTo(3));
@@ -107,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
107 Assert.That(pc.Simulator, Is.EqualTo(3)); 125 Assert.That(pc.Simulator, Is.EqualTo(3));
108 126
109 // Add a second object and retest 127 // Add a second object and retest
110 SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10); 128 SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10);
111 m_scene.AddNewSceneObject(sog2, false); 129 m_scene.AddNewSceneObject(sog2, false);
112 130
113 Assert.That(pc.Owner, Is.EqualTo(5)); 131 Assert.That(pc.Owner, Is.EqualTo(5));
@@ -124,14 +142,14 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
124 /// Test count after a parcel owner owned copied object is added. 142 /// Test count after a parcel owner owned copied object is added.
125 /// </summary> 143 /// </summary>
126 [Test] 144 [Test]
127 public void TestCopiedOwnerObject() 145 public void TestCopyOwnerObject()
128 { 146 {
129 TestHelper.InMethod(); 147 TestHelper.InMethod();
130// log4net.Config.XmlConfigurator.Configure(); 148// log4net.Config.XmlConfigurator.Configure();
131 149
132 IPrimCounts pc = m_lo.PrimCounts; 150 IPrimCounts pc = m_lo.PrimCounts;
133 151
134 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); 152 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
135 m_scene.AddNewSceneObject(sog, false); 153 m_scene.AddNewSceneObject(sog, false);
136 m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity); 154 m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity);
137 155
@@ -143,7 +161,69 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
143 Assert.That(pc.Users[m_userId], Is.EqualTo(6)); 161 Assert.That(pc.Users[m_userId], Is.EqualTo(6));
144 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); 162 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
145 Assert.That(pc.Simulator, Is.EqualTo(6)); 163 Assert.That(pc.Simulator, Is.EqualTo(6));
146 } 164 }
165
166 /// <summary>
167 /// Test that parcel counts update correctly when an object is moved between parcels, where that movement
168 /// is not done directly by the user/
169 /// </summary>
170 [Test]
171 public void TestMoveOwnerObject()
172 {
173 TestHelper.InMethod();
174// log4net.Config.XmlConfigurator.Configure();
175
176 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
177 m_scene.AddNewSceneObject(sog, false);
178 SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10);
179 m_scene.AddNewSceneObject(sog2, false);
180
181 // Move the first scene object to the eastern strip parcel
182 sog.AbsolutePosition = new Vector3(254, 2, 2);
183
184 IPrimCounts pclo1 = m_lo.PrimCounts;
185
186 Assert.That(pclo1.Owner, Is.EqualTo(2));
187 Assert.That(pclo1.Group, Is.EqualTo(0));
188 Assert.That(pclo1.Others, Is.EqualTo(0));
189 Assert.That(pclo1.Total, Is.EqualTo(2));
190 Assert.That(pclo1.Selected, Is.EqualTo(0));
191 Assert.That(pclo1.Users[m_userId], Is.EqualTo(2));
192 Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0));
193 Assert.That(pclo1.Simulator, Is.EqualTo(5));
194
195 IPrimCounts pclo2 = m_lo2.PrimCounts;
196
197 Assert.That(pclo2.Owner, Is.EqualTo(3));
198 Assert.That(pclo2.Group, Is.EqualTo(0));
199 Assert.That(pclo2.Others, Is.EqualTo(0));
200 Assert.That(pclo2.Total, Is.EqualTo(3));
201 Assert.That(pclo2.Selected, Is.EqualTo(0));
202 Assert.That(pclo2.Users[m_userId], Is.EqualTo(3));
203 Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0));
204 Assert.That(pclo2.Simulator, Is.EqualTo(5));
205
206 // Now move it back again
207 sog.AbsolutePosition = new Vector3(2, 2, 2);
208
209 Assert.That(pclo1.Owner, Is.EqualTo(5));
210 Assert.That(pclo1.Group, Is.EqualTo(0));
211 Assert.That(pclo1.Others, Is.EqualTo(0));
212 Assert.That(pclo1.Total, Is.EqualTo(5));
213 Assert.That(pclo1.Selected, Is.EqualTo(0));
214 Assert.That(pclo1.Users[m_userId], Is.EqualTo(5));
215 Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0));
216 Assert.That(pclo1.Simulator, Is.EqualTo(5));
217
218 Assert.That(pclo2.Owner, Is.EqualTo(0));
219 Assert.That(pclo2.Group, Is.EqualTo(0));
220 Assert.That(pclo2.Others, Is.EqualTo(0));
221 Assert.That(pclo2.Total, Is.EqualTo(0));
222 Assert.That(pclo2.Selected, Is.EqualTo(0));
223 Assert.That(pclo2.Users[m_userId], Is.EqualTo(0));
224 Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0));
225 Assert.That(pclo2.Simulator, Is.EqualTo(5));
226 }
147 227
148 /// <summary> 228 /// <summary>
149 /// Test count after a parcel owner owned object is removed. 229 /// Test count after a parcel owner owned object is removed.
@@ -156,8 +236,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
156 236
157 IPrimCounts pc = m_lo.PrimCounts; 237 IPrimCounts pc = m_lo.PrimCounts;
158 238
159 m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1), false); 239 m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1), false);
160 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10); 240 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10);
161 m_scene.AddNewSceneObject(sogToDelete, false); 241 m_scene.AddNewSceneObject(sogToDelete, false);
162 m_scene.DeleteSceneObject(sogToDelete, false); 242 m_scene.DeleteSceneObject(sogToDelete, false);
163 243
@@ -181,7 +261,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
181 261
182 IPrimCounts pc = m_lo.PrimCounts; 262 IPrimCounts pc = m_lo.PrimCounts;
183 263
184 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x01); 264 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01);
185 sog.GroupID = m_groupId; 265 sog.GroupID = m_groupId;
186 m_scene.AddNewSceneObject(sog, false); 266 m_scene.AddNewSceneObject(sog, false);
187 267
@@ -212,11 +292,11 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
212 292
213 IPrimCounts pc = m_lo.PrimCounts; 293 IPrimCounts pc = m_lo.PrimCounts;
214 294
215 SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1); 295 SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1);
216 sogToKeep.GroupID = m_groupId; 296 sogToKeep.GroupID = m_groupId;
217 m_scene.AddNewSceneObject(sogToKeep, false); 297 m_scene.AddNewSceneObject(sogToKeep, false);
218 298
219 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10); 299 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10);
220 m_scene.AddNewSceneObject(sogToDelete, false); 300 m_scene.AddNewSceneObject(sogToDelete, false);
221 m_scene.DeleteSceneObject(sogToDelete, false); 301 m_scene.DeleteSceneObject(sogToDelete, false);
222 302
@@ -239,7 +319,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
239 319
240 IPrimCounts pc = m_lo.PrimCounts; 320 IPrimCounts pc = m_lo.PrimCounts;
241 321
242 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x01); 322 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01);
243 m_scene.AddNewSceneObject(sog, false); 323 m_scene.AddNewSceneObject(sog, false);
244 324
245 Assert.That(pc.Owner, Is.EqualTo(0)); 325 Assert.That(pc.Owner, Is.EqualTo(0));
@@ -260,8 +340,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
260 340
261 IPrimCounts pc = m_lo.PrimCounts; 341 IPrimCounts pc = m_lo.PrimCounts;
262 342
263 m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, 0x1), false); 343 m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, "a", 0x1), false);
264 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x10); 344 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "b", 0x10);
265 m_scene.AddNewSceneObject(sogToDelete, false); 345 m_scene.AddNewSceneObject(sogToDelete, false);
266 m_scene.DeleteSceneObject(sogToDelete, false); 346 m_scene.DeleteSceneObject(sogToDelete, false);
267 347
@@ -284,7 +364,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
284 TestHelper.InMethod(); 364 TestHelper.InMethod();
285 IPrimCounts pc = m_lo.PrimCounts; 365 IPrimCounts pc = m_lo.PrimCounts;
286 366
287 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); 367 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
288 m_scene.AddNewSceneObject(sog, false); 368 m_scene.AddNewSceneObject(sog, false);
289 369
290 m_pcm.TaintPrimCount(); 370 m_pcm.TaintPrimCount();
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
index cea7c78..4e14c73 100644
--- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
@@ -469,8 +469,8 @@ namespace OpenSim.Region.CoreModules
469 m_SunFixedHour = FixedSunHour; 469 m_SunFixedHour = FixedSunHour;
470 m_SunFixed = FixedSun; 470 m_SunFixed = FixedSun;
471 471
472 m_log.DebugFormat("[SUN]: Sun Settings Update: Fixed Sun? : {0}", m_SunFixed.ToString()); 472 // m_log.DebugFormat("[SUN]: Sun Settings Update: Fixed Sun? : {0}", m_SunFixed.ToString());
473 m_log.DebugFormat("[SUN]: Sun Settings Update: Sun Hour : {0}", m_SunFixedHour.ToString()); 473 // m_log.DebugFormat("[SUN]: Sun Settings Update: Sun Hour : {0}", m_SunFixedHour.ToString());
474 474
475 receivedEstateToolsSunUpdate = true; 475 receivedEstateToolsSunUpdate = true;
476 476
@@ -480,7 +480,7 @@ namespace OpenSim.Region.CoreModules
480 // When sun settings are updated, we should update all clients with new settings. 480 // When sun settings are updated, we should update all clients with new settings.
481 SunUpdateToAllClients(); 481 SunUpdateToAllClients();
482 482
483 m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); 483 // m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString());
484 } 484 }
485 } 485 }
486 486
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
index 38c10a6..7066cf2 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
@@ -71,6 +71,12 @@ namespace OpenSim.Region.Framework.Interfaces
71 List<int> GetEstates(string search); 71 List<int> GetEstates(string search);
72 72
73 /// <summary> 73 /// <summary>
74 /// Get the IDs of all estates owned by the given user.
75 /// </summary>
76 /// <returns>An empty list if no estates were found.</returns>
77 List<int> GetEstatesByOwner(UUID ownerID);
78
79 /// <summary>
74 /// Get the IDs of all estates. 80 /// Get the IDs of all estates.
75 /// </summary> 81 /// </summary>
76 /// <returns>An empty list if no estates were found.</returns> 82 /// <returns>An empty list if no estates were found.</returns>
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
index c82661d..d790a30 100644
--- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs
@@ -74,6 +74,12 @@ namespace OpenSim.Region.Framework.Interfaces
74 /// <param name="search">Name of estate to search for. This is the exact name, no parttern matching is done.</param> 74 /// <param name="search">Name of estate to search for. This is the exact name, no parttern matching is done.</param>
75 /// <returns></returns> 75 /// <returns></returns>
76 List<int> GetEstates(string search); 76 List<int> GetEstates(string search);
77
78 /// <summary>
79 /// Get the IDs of all estates owned by the given user.
80 /// </summary>
81 /// <returns>An empty list if no estates were found.</returns>
82 List<int> GetEstatesByOwner(UUID ownerID);
77 83
78 /// <summary> 84 /// <summary>
79 /// Get the IDs of all estates. 85 /// Get the IDs of all estates.
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index a14bb70..4694e2b 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -166,8 +166,9 @@ namespace OpenSim.Region.Framework.Scenes
166 ScenePresence presence = m_scene.GetScenePresence(client.AgentId); 166 ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
167 if (presence == null) 167 if (presence == null)
168 { 168 {
169 m_log.WarnFormat("[PRIORITIZER] attempt to prioritize agent no longer in the scene"); 169 m_log.WarnFormat("[PRIORITIZER] attempt to use agent {0} not in the scene",client.AgentId);
170 throw new InvalidOperationException("Prioritization agent not defined"); 170 // throw new InvalidOperationException("Prioritization agent not defined");
171 return Int32.MaxValue;
171 } 172 }
172 173
173 // Use group position for child prims, since we are putting child prims in 174 // Use group position for child prims, since we are putting child prims in
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 35a798e..f0acc38 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1428,20 +1428,6 @@ namespace OpenSim.Region.Framework.Scenes
1428 } 1428 }
1429 1429
1430 /// <summary> 1430 /// <summary>
1431 /// Recount SceneObjectPart in parcel aabb
1432 /// </summary>
1433 private void UpdateLand()
1434 {
1435 if (LandChannel != null)
1436 {
1437 if (LandChannel.IsLandPrimCountTainted())
1438 {
1439 EventManager.TriggerParcelPrimCountUpdate();
1440 }
1441 }
1442 }
1443
1444 /// <summary>
1445 /// Update the terrain if it needs to be updated. 1431 /// Update the terrain if it needs to be updated.
1446 /// </summary> 1432 /// </summary>
1447 private void UpdateTerrain() 1433 private void UpdateTerrain()
@@ -1535,8 +1521,11 @@ namespace OpenSim.Region.Framework.Scenes
1535 } 1521 }
1536 1522
1537 /// <summary> 1523 /// <summary>
1538 /// Return object to avatar Message 1524 /// Tell an agent that their object has been returned.
1539 /// </summary> 1525 /// </summary>
1526 /// <remarks>
1527 /// The actual return is handled by the caller.
1528 /// </remarks>
1540 /// <param name="agentID">Avatar Unique Id</param> 1529 /// <param name="agentID">Avatar Unique Id</param>
1541 /// <param name="objectName">Name of object returned</param> 1530 /// <param name="objectName">Name of object returned</param>
1542 /// <param name="location">Location of object returned</param> 1531 /// <param name="location">Location of object returned</param>
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 60855b2..97af0a0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1855,7 +1855,7 @@ namespace OpenSim.Region.Framework.Scenes
1855 { 1855 {
1856 SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; 1856 SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
1857 foreach (SceneObjectPart part in children) 1857 foreach (SceneObjectPart part in children)
1858 SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; 1858 SceneObjectGroupsByLocalPartID[part.LocalId] = copy;
1859 } 1859 }
1860 // PROBABLE END OF FIXME 1860 // PROBABLE END OF FIXME
1861 1861
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index f17fb28..ca7d9d9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -325,6 +325,8 @@ namespace OpenSim.Region.Framework.Scenes
325 //m_rootPart.GroupPosition.Z); 325 //m_rootPart.GroupPosition.Z);
326 //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor); 326 //m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
327 //} 327 //}
328
329 m_scene.EventManager.TriggerParcelPrimCountTainted();
328 } 330 }
329 } 331 }
330 332
@@ -1313,8 +1315,10 @@ namespace OpenSim.Region.Framework.Scenes
1313 parcel.LandData.OtherCleanTime) 1315 parcel.LandData.OtherCleanTime)
1314 { 1316 {
1315 DetachFromBackup(); 1317 DetachFromBackup();
1316 m_log.InfoFormat("[SCENE]: Returning object {0} due to parcel auto return", RootPart.UUID.ToString()); 1318 m_log.DebugFormat(
1317 m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel auto return"); 1319 "[SCENE OBJECT GROUP]: Returning object {0} due to parcel autoreturn",
1320 RootPart.UUID);
1321 m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel autoreturn");
1318 m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero, 1322 m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero,
1319 DeRezAction.Return, UUID.Zero); 1323 DeRezAction.Return, UUID.Zero);
1320 1324
diff --git a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs
index 781fe95..dddea3e 100644
--- a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs
+++ b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs
@@ -33,6 +33,9 @@ using Nini.Config;
33using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
35 35
36[assembly: Addin("BareBonesSharedModule", "0.1")]
37[assembly: AddinDependency("OpenSim", "0.5")]
38
36namespace OpenSim.Region.OptionalModules.Example.BareBonesShared 39namespace OpenSim.Region.OptionalModules.Example.BareBonesShared
37{ 40{
38 /// <summary> 41 /// <summary>
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
index 98e5453..a133e51 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
@@ -130,11 +130,6 @@ public class RegionCombinerLargeLandChannel : ILandChannel
130 } 130 }
131 } 131 }
132 132
133 public bool IsLandPrimCountTainted()
134 {
135 return RootRegionLandChannel.IsLandPrimCountTainted();
136 }
137
138 public bool IsForcefulBansAllowed() 133 public bool IsForcefulBansAllowed()
139 { 134 {
140 return RootRegionLandChannel.IsForcefulBansAllowed(); 135 return RootRegionLandChannel.IsForcefulBansAllowed();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 43b0da3..c16a985 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -9835,63 +9835,42 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9835 public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) 9835 public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide)
9836 { 9836 {
9837 m_host.AddScriptLPS(1); 9837 m_host.AddScriptLPS(1);
9838
9839 ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y);
9838 9840
9839 LandData land = World.GetLandData((float)pos.x, (float)pos.y); 9841 if (lo == null)
9840
9841 if (land == null)
9842 {
9843 return 0; 9842 return 0;
9844 } 9843
9844 IPrimCounts pc = lo.PrimCounts;
9845 9845
9846 else 9846 if (sim_wide != ScriptBaseClass.FALSE)
9847 { 9847 {
9848 if (sim_wide != 0) 9848 if (category == ScriptBaseClass.PARCEL_COUNT_TOTAL)
9849 { 9849 {
9850 if (category == 0) 9850 return pc.Simulator;
9851 {
9852 return land.SimwidePrims;
9853 }
9854
9855 else
9856 {
9857 //public int simwideArea = 0;
9858 return 0;
9859 }
9860 } 9851 }
9861
9862 else 9852 else
9863 { 9853 {
9864 if (category == 0)//Total Prims 9854 // counts not implemented yet
9865 { 9855 return 0;
9866 return 0;//land.
9867 }
9868
9869 else if (category == 1)//Owner Prims
9870 {
9871 return land.OwnerPrims;
9872 }
9873
9874 else if (category == 2)//Group Prims
9875 {
9876 return land.GroupPrims;
9877 }
9878
9879 else if (category == 3)//Other Prims
9880 {
9881 return land.OtherPrims;
9882 }
9883
9884 else if (category == 4)//Selected
9885 {
9886 return land.SelectedPrims;
9887 }
9888
9889 else if (category == 5)//Temp
9890 {
9891 return 0;//land.
9892 }
9893 } 9856 }
9894 } 9857 }
9858 else
9859 {
9860 if (category == ScriptBaseClass.PARCEL_COUNT_TOTAL)
9861 return pc.Total;
9862 else if (category == ScriptBaseClass.PARCEL_COUNT_OWNER)
9863 return pc.Owner;
9864 else if (category == ScriptBaseClass.PARCEL_COUNT_GROUP)
9865 return pc.Group;
9866 else if (category == ScriptBaseClass.PARCEL_COUNT_OTHER)
9867 return pc.Others;
9868 else if (category == ScriptBaseClass.PARCEL_COUNT_SELECTED)
9869 return pc.Selected;
9870 else if (category == ScriptBaseClass.PARCEL_COUNT_TEMP)
9871 return 0; // counts not implemented yet
9872 }
9873
9895 return 0; 9874 return 0;
9896 } 9875 }
9897 9876
@@ -10289,6 +10268,55 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10289 m_log.Info("LSL print():" + str); 10268 m_log.Info("LSL print():" + str);
10290 } 10269 }
10291 } 10270 }
10271
10272 private string Name2Username(string name)
10273 {
10274 string[] parts = name.Split(new char[] {' '});
10275 if (parts.Length < 2)
10276 return name.ToLower();
10277 if (parts[1] == "Resident")
10278 return parts[0].ToLower();
10279
10280 return name.Replace(" ", ".").ToLower();
10281 }
10282
10283 public LSL_String llGetUsername(string id)
10284 {
10285 return Name2Username(llKey2Name(id));
10286 }
10287
10288 public LSL_String llRequestUsername(string id)
10289 {
10290 UUID rq = UUID.Random();
10291
10292 UUID tid = AsyncCommands.
10293 DataserverPlugin.RegisterRequest(m_localID,
10294 m_itemID, rq.ToString());
10295
10296 AsyncCommands.
10297 DataserverPlugin.DataserverReply(rq.ToString(), Name2Username(llKey2Name(id)));
10298
10299 return rq.ToString();
10300 }
10301
10302 public LSL_String llGetDisplayName(string id)
10303 {
10304 return llKey2Name(id);
10305 }
10306
10307 public LSL_String llRequestDisplayName(string id)
10308 {
10309 UUID rq = UUID.Random();
10310
10311 UUID tid = AsyncCommands.
10312 DataserverPlugin.RegisterRequest(m_localID,
10313 m_itemID, rq.ToString());
10314
10315 AsyncCommands.
10316 DataserverPlugin.DataserverReply(rq.ToString(), llKey2Name(id));
10317
10318 return rq.ToString();
10319 }
10292 } 10320 }
10293 10321
10294 public class NotecardCache 10322 public class NotecardCache
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index fefbb35..47c7915 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -50,6 +50,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
50 private Object SenseLock = new Object(); 50 private Object SenseLock = new Object();
51 51
52 private const int AGENT = 1; 52 private const int AGENT = 1;
53 private const int AGENT_BY_USERNAME = 0x10;
53 private const int ACTIVE = 2; 54 private const int ACTIVE = 2;
54 private const int PASSIVE = 4; 55 private const int PASSIVE = 4;
55 private const int SCRIPTED = 8; 56 private const int SCRIPTED = 8;
@@ -202,7 +203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
202 List<SensedEntity> sensedEntities = new List<SensedEntity>(); 203 List<SensedEntity> sensedEntities = new List<SensedEntity>();
203 204
204 // Is the sensor type is AGENT and not SCRIPTED then include agents 205 // Is the sensor type is AGENT and not SCRIPTED then include agents
205 if ((ts.type & AGENT) != 0 && (ts.type & SCRIPTED) == 0) 206 if ((ts.type & (AGENT | AGENT_BY_USERNAME)) != 0 && (ts.type & SCRIPTED) == 0)
206 { 207 {
207 sensedEntities.AddRange(doAgentSensor(ts)); 208 sensedEntities.AddRange(doAgentSensor(ts));
208 } 209 }
@@ -493,9 +494,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
493 { 494 {
494 ScenePresence sp; 495 ScenePresence sp;
495 // Try lookup by name will return if/when found 496 // Try lookup by name will return if/when found
496 if (!m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp)) 497 if (((ts.type & AGENT) != 0) && m_CmdManager.m_ScriptEngine.World.TryGetAvatarByName(ts.name, out sp))
497 return sensedEntities; 498 senseEntity(sp);
498 senseEntity(sp); 499 if ((ts.type & AGENT_BY_USERNAME) != 0)
500 {
501 m_CmdManager.m_ScriptEngine.World.ForEachScenePresence(
502 delegate (ScenePresence ssp)
503 {
504 if (ssp.Lastname == "Resident")
505 {
506 if (ssp.Firstname.ToLower() == ts.name)
507 senseEntity(ssp);
508 return;
509 }
510 if (ssp.Name.Replace(" ", ".").ToLower() == ts.name)
511 senseEntity(ssp);
512 }
513 );
514 }
515
516 return sensedEntities;
499 } 517 }
500 else 518 else
501 { 519 {
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index bd6a094..654ea81 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -209,6 +209,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
209 void llInstantMessage(string user, string message); 209 void llInstantMessage(string user, string message);
210 LSL_String llIntegerToBase64(int number); 210 LSL_String llIntegerToBase64(int number);
211 LSL_String llKey2Name(string id); 211 LSL_String llKey2Name(string id);
212 LSL_String llGetUsername(string id);
213 LSL_String llRequestUsername(string id);
214 LSL_String llGetDisplayName(string id);
215 LSL_String llRequestDisplayName(string id);
212 void llLinkParticleSystem(int linknum, LSL_List rules); 216 void llLinkParticleSystem(int linknum, LSL_List rules);
213 LSL_String llList2CSV(LSL_List src); 217 LSL_String llList2CSV(LSL_List src);
214 LSL_Float llList2Float(LSL_List src, int index); 218 LSL_Float llList2Float(LSL_List src, int index);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index b3c4d95..9377cda 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -50,6 +50,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
50 public const int STATUS_CAST_SHADOWS = 512; 50 public const int STATUS_CAST_SHADOWS = 512;
51 51
52 public const int AGENT = 1; 52 public const int AGENT = 1;
53 public const int AGENT_BY_LEGACY_NAME = 1;
54 public const int AGENT_BY_USERNAME = 0x10;
53 public const int ACTIVE = 2; 55 public const int ACTIVE = 2;
54 public const int PASSIVE = 4; 56 public const int PASSIVE = 4;
55 public const int SCRIPTED = 8; 57 public const int SCRIPTED = 8;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 3b29861..303d75e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -894,6 +894,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
894 return m_LSL_Functions.llKey2Name(id); 894 return m_LSL_Functions.llKey2Name(id);
895 } 895 }
896 896
897 public LSL_String llGetUsername(string id)
898 {
899 return m_LSL_Functions.llGetUsername(id);
900 }
901
902 public LSL_String llRequestUsername(string id)
903 {
904 return m_LSL_Functions.llRequestUsername(id);
905 }
906
907 public LSL_String llGetDisplayName(string id)
908 {
909 return m_LSL_Functions.llGetDisplayName(id);
910 }
911
912 public LSL_String llRequestDisplayName(string id)
913 {
914 return m_LSL_Functions.llRequestDisplayName(id);
915 }
916
897 public void llLinkParticleSystem(int linknum, LSL_List rules) 917 public void llLinkParticleSystem(int linknum, LSL_List rules)
898 { 918 {
899 m_LSL_Functions.llLinkParticleSystem(linknum, rules); 919 m_LSL_Functions.llLinkParticleSystem(linknum, rules);