aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs42
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs11
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs113
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandChannel.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs266
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs233
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs39
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs89
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs16
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModule.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Sun/SunModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/WindModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs98
25 files changed, 621 insertions, 400 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 376ea8a..54acbc4 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -53,6 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 54
55 private static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); 55 private static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding();
56 private static UTF8Encoding m_utf8Encoding = new UTF8Encoding();
56 57
57 private Scene m_scene; 58 private Scene m_scene;
58 private Stream m_loadStream; 59 private Stream m_loadStream;
@@ -100,6 +101,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
100 int successfulAssetRestores = 0; 101 int successfulAssetRestores = 0;
101 int failedAssetRestores = 0; 102 int failedAssetRestores = 0;
102 List<string> serialisedSceneObjects = new List<string>(); 103 List<string> serialisedSceneObjects = new List<string>();
104 List<string> serialisedParcels = new List<string>();
103 string filePath = "NONE"; 105 string filePath = "NONE";
104 106
105 try 107 try
@@ -110,16 +112,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
110 TarArchiveReader.TarEntryType entryType; 112 TarArchiveReader.TarEntryType entryType;
111 113
112 while ((data = archive.ReadEntry(out filePath, out entryType)) != null) 114 while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
113 { 115 {
114 //m_log.DebugFormat( 116 //m_log.DebugFormat(
115 // "[ARCHIVER]: Successfully read {0} ({1} bytes)", filePath, data.Length); 117 // "[ARCHIVER]: Successfully read {0} ({1} bytes)", filePath, data.Length);
116 118
117 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType) 119 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType)
118 continue; 120 continue;
119 121
120 if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) 122 if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH))
121 { 123 {
122 serialisedSceneObjects.Add(m_asciiEncoding.GetString(data)); 124 serialisedSceneObjects.Add(m_utf8Encoding.GetString(data));
123 } 125 }
124 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) 126 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
125 { 127 {
@@ -136,6 +138,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
136 { 138 {
137 LoadRegionSettings(filePath, data); 139 LoadRegionSettings(filePath, data);
138 } 140 }
141 else if (!m_merge && filePath.StartsWith(ArchiveConstants.LANDDATA_PATH))
142 {
143 serialisedParcels.Add(m_utf8Encoding.GetString(data));
144 }
139 else if (filePath == ArchiveConstants.CONTROL_FILE_PATH) 145 else if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
140 { 146 {
141 LoadControlFile(filePath, data); 147 LoadControlFile(filePath, data);
@@ -169,11 +175,31 @@ namespace OpenSim.Region.CoreModules.World.Archiver
169 m_scene.DeleteAllSceneObjects(); 175 m_scene.DeleteAllSceneObjects();
170 } 176 }
171 177
178 // Try to retain the original creator/owner/lastowner if their uuid is present on this grid
179 // otherwise, use the master avatar uuid instead
180 UUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID;
181
182 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)
183 masterAvatarId = m_scene.RegionInfo.EstateSettings.EstateOwner;
184
185 // Reload serialized parcels
186 m_log.InfoFormat("[ARCHIVER]: Loading {0} parcels. Please wait.", serialisedParcels.Count);
187 List<LandData> landData = new List<LandData>();
188 foreach (string serialisedParcel in serialisedParcels)
189 {
190 LandData parcel = LandDataSerializer.Deserialize(serialisedParcel);
191 if (!ResolveUserUuid(parcel.OwnerID))
192 parcel.OwnerID = masterAvatarId;
193 landData.Add(parcel);
194 }
195 m_scene.EventManager.TriggerIncomingLandDataFromStorage(landData);
196 m_log.InfoFormat("[ARCHIVER]: Restored {0} parcels.", landData.Count);
197
172 // Reload serialized prims 198 // Reload serialized prims
173 m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); 199 m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count);
174 200
175 IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface<IRegionSerialiserModule>(); 201 IRegionSerialiserModule serialiser = m_scene.RequestModuleInterface<IRegionSerialiserModule>();
176 int sceneObjectsLoadedCount = 0; 202 int sceneObjectsLoadedCount = 0;
177 203
178 foreach (string serialisedSceneObject in serialisedSceneObjects) 204 foreach (string serialisedSceneObject in serialisedSceneObjects)
179 { 205 {
@@ -198,12 +224,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
198 // to the same scene (when this is possible). 224 // to the same scene (when this is possible).
199 sceneObject.ResetIDs(); 225 sceneObject.ResetIDs();
200 226
201 // Try to retain the original creator/owner/lastowner if their uuid is present on this grid
202 // otherwise, use the master avatar uuid instead
203 UUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID;
204
205 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)
206 masterAvatarId = m_scene.RegionInfo.EstateSettings.EstateOwner;
207 227
208 foreach (SceneObjectPart part in sceneObject.Children.Values) 228 foreach (SceneObjectPart part in sceneObject.Children.Values)
209 { 229 {
@@ -499,7 +519,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
499 XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); 519 XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
500 520
501 XmlTextReader xtr 521 XmlTextReader xtr
502 = new XmlTextReader(m_asciiEncoding.GetString(data), XmlNodeType.Document, context); 522 = new XmlTextReader(m_asciiEncoding.GetString(data), XmlNodeType.Document, context);
503 523
504 RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; 524 RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings;
505 525
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
index a62c5b3..f039be8 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
@@ -102,6 +102,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver
102 102
103 m_log.InfoFormat("[ARCHIVER]: Added region settings to archive."); 103 m_log.InfoFormat("[ARCHIVER]: Added region settings to archive.");
104 104
105 // Write out land data (aka parcel) settings
106 List<ILandObject>landObjects = m_scene.LandChannel.AllParcels();
107 foreach (ILandObject lo in landObjects)
108 {
109 LandData landData = lo.LandData;
110 string landDataPath = String.Format("{0}{1}.xml", ArchiveConstants.LANDDATA_PATH,
111 landData.GlobalID.ToString());
112 m_archiveWriter.WriteFile(landDataPath, LandDataSerializer.Serialize(landData));
113 }
114 m_log.InfoFormat("[ARCHIVER]: Added parcel settings to archive.");
115
105 // Write out terrain 116 // Write out terrain
106 string terrainPath 117 string terrainPath
107 = String.Format("{0}{1}.r32", ArchiveConstants.TERRAINS_PATH, m_scene.RegionInfo.RegionName); 118 = String.Format("{0}{1}.r32", ArchiveConstants.TERRAINS_PATH, m_scene.RegionInfo.RegionName);
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index 63608a8..9e4fbbe 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -74,14 +74,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
74 m_scene = scene; 74 m_scene = scene;
75 m_saveStream = saveStream; 75 m_saveStream = saveStream;
76 m_requestId = requestId; 76 m_requestId = requestId;
77 } 77 }
78 78
79 /// <summary> 79 /// <summary>
80 /// Archive the region requested. 80 /// Archive the region requested.
81 /// </summary> 81 /// </summary>
82 /// <exception cref="System.IO.IOException">if there was an io problem with creating the file</exception> 82 /// <exception cref="System.IO.IOException">if there was an io problem with creating the file</exception>
83 public void ArchiveRegion() 83 public void ArchiveRegion()
84 { 84 {
85 Dictionary<UUID, int> assetUuids = new Dictionary<UUID, int>(); 85 Dictionary<UUID, int> assetUuids = new Dictionary<UUID, int>();
86 86
87 List<EntityBase> entities = m_scene.GetEntities(); 87 List<EntityBase> entities = m_scene.GetEntities();
@@ -137,7 +137,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
137 m_scene.RequestModuleInterface<IRegionSerialiserModule>(), 137 m_scene.RequestModuleInterface<IRegionSerialiserModule>(),
138 m_scene, 138 m_scene,
139 archiveWriter, 139 archiveWriter,
140 m_requestId); 140 m_requestId);
141 141
142 new AssetsRequest( 142 new AssetsRequest(
143 new AssetsArchiver(archiveWriter), assetUuids.Keys, 143 new AssetsArchiver(archiveWriter), assetUuids.Keys,
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index 5c58b69..8d4f91b 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -78,7 +78,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
78 78
79 public void Close() 79 public void Close()
80 { 80 {
81 } 81 }
82 82
83 public void ArchiveRegion(string savePath) 83 public void ArchiveRegion(string savePath)
84 { 84 {
@@ -90,7 +90,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
90 m_log.InfoFormat( 90 m_log.InfoFormat(
91 "[ARCHIVER]: Writing archive for region {0} to {1}", m_scene.RegionInfo.RegionName, savePath); 91 "[ARCHIVER]: Writing archive for region {0} to {1}", m_scene.RegionInfo.RegionName, savePath);
92 92
93 new ArchiveWriteRequestPreparation(m_scene, savePath, requestId).ArchiveRegion(); 93 new ArchiveWriteRequestPreparation(m_scene, savePath, requestId).ArchiveRegion();
94 } 94 }
95 95
96 public void ArchiveRegion(Stream saveStream) 96 public void ArchiveRegion(Stream saveStream)
@@ -101,7 +101,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
101 public void ArchiveRegion(Stream saveStream, Guid requestId) 101 public void ArchiveRegion(Stream saveStream, Guid requestId)
102 { 102 {
103 new ArchiveWriteRequestPreparation(m_scene, saveStream, requestId).ArchiveRegion(); 103 new ArchiveWriteRequestPreparation(m_scene, saveStream, requestId).ArchiveRegion();
104 } 104 }
105 105
106 public void DearchiveRegion(string loadPath) 106 public void DearchiveRegion(string loadPath)
107 { 107 {
@@ -114,7 +114,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
114 "[ARCHIVER]: Loading archive to region {0} from {1}", m_scene.RegionInfo.RegionName, loadPath); 114 "[ARCHIVER]: Loading archive to region {0} from {1}", m_scene.RegionInfo.RegionName, loadPath);
115 115
116 new ArchiveReadRequest(m_scene, loadPath, merge, requestId).DearchiveRegion(); 116 new ArchiveReadRequest(m_scene, loadPath, merge, requestId).DearchiveRegion();
117 } 117 }
118 118
119 public void DearchiveRegion(Stream loadStream) 119 public void DearchiveRegion(Stream loadStream)
120 { 120 {
@@ -124,6 +124,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
124 public void DearchiveRegion(Stream loadStream, bool merge, Guid requestId) 124 public void DearchiveRegion(Stream loadStream, bool merge, Guid requestId)
125 { 125 {
126 new ArchiveReadRequest(m_scene, loadStream, merge, requestId).DearchiveRegion(); 126 new ArchiveReadRequest(m_scene, loadStream, merge, requestId).DearchiveRegion();
127 } 127 }
128 } 128 }
129} 129}
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs
index 330fa3f..95d109c 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
65 /// </summary> 65 /// </summary>
66 /// <param name="archive"></param> 66 /// <param name="archive"></param>
67 public void WriteAsset(AssetBase asset) 67 public void WriteAsset(AssetBase asset)
68 { 68 {
69 //WriteMetadata(archive); 69 //WriteMetadata(archive);
70 WriteData(asset); 70 WriteData(asset);
71 } 71 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
index 82803bf..fe9c8d9 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
@@ -115,7 +115,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
115 115
116 m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT); 116 m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT);
117 m_requestCallbackTimer.AutoReset = false; 117 m_requestCallbackTimer.AutoReset = false;
118 m_requestCallbackTimer.Elapsed += new ElapsedEventHandler(OnRequestCallbackTimeout); 118 m_requestCallbackTimer.Elapsed += new ElapsedEventHandler(OnRequestCallbackTimeout);
119 } 119 }
120 120
121 protected internal void Execute() 121 protected internal void Execute()
@@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
143 protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args) 143 protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args)
144 { 144 {
145 try 145 try
146 { 146 {
147 lock (this) 147 lock (this)
148 { 148 {
149 // Take care of the possibilty that this thread started but was paused just outside the lock before 149 // Take care of the possibilty that this thread started but was paused just outside the lock before
@@ -155,7 +155,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
155 } 155 }
156 156
157 // Calculate which uuids were not found. This is an expensive way of doing it, but this is a failure 157 // Calculate which uuids were not found. This is an expensive way of doing it, but this is a failure
158 // case anyway. 158 // case anyway.
159 List<UUID> uuids = new List<UUID>(); 159 List<UUID> uuids = new List<UUID>();
160 foreach (UUID uuid in m_uuids) 160 foreach (UUID uuid in m_uuids)
161 { 161 {
@@ -188,7 +188,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
188 m_log.ErrorFormat( 188 m_log.ErrorFormat(
189 "[ARCHIVER]: (... {0} more not shown)", uuids.Count - MAX_UUID_DISPLAY_ON_TIMEOUT); 189 "[ARCHIVER]: (... {0} more not shown)", uuids.Count - MAX_UUID_DISPLAY_ON_TIMEOUT);
190 190
191 m_log.Error("[ARCHIVER]: OAR save aborted."); 191 m_log.Error("[ARCHIVER]: OAR save aborted.");
192 } 192 }
193 catch (Exception e) 193 catch (Exception e)
194 { 194 {
@@ -213,7 +213,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
213 { 213 {
214 //m_log.DebugFormat("[ARCHIVER]: Received callback for asset {0}", id); 214 //m_log.DebugFormat("[ARCHIVER]: Received callback for asset {0}", id);
215 215
216 m_requestCallbackTimer.Stop(); 216 m_requestCallbackTimer.Stop();
217 217
218 if (m_requestState == RequestState.Aborted) 218 if (m_requestState == RequestState.Aborted)
219 { 219 {
@@ -258,7 +258,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
258 } 258 }
259 catch (Exception e) 259 catch (Exception e)
260 { 260 {
261 m_log.ErrorFormat("[ARCHIVER]: AssetRequestCallback failed with {0}", e); 261 m_log.ErrorFormat("[ARCHIVER]: AssetRequestCallback failed with {0}", e);
262 } 262 }
263 } 263 }
264 264
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 5c42e94..edac4a4 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
59 m_lastErrorMessage = errorMessage; 59 m_lastErrorMessage = errorMessage;
60 Console.WriteLine("About to pulse ArchiverTests on LoadCompleted"); 60 Console.WriteLine("About to pulse ArchiverTests on LoadCompleted");
61 61
62 Monitor.PulseAll(this); 62 Monitor.PulseAll(this);
63 } 63 }
64 } 64 }
65 65
@@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
138 archiverModule.ArchiveRegion(archiveWriteStream, requestId); 138 archiverModule.ArchiveRegion(archiveWriteStream, requestId);
139 //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer; 139 //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer;
140 //while (assetServer.HasWaitingRequests()) 140 //while (assetServer.HasWaitingRequests())
141 // assetServer.ProcessNextRequest(); 141 // assetServer.ProcessNextRequest();
142 142
143 Monitor.Wait(this, 60000); 143 Monitor.Wait(this, 60000);
144 } 144 }
@@ -213,7 +213,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
213 213
214 // Also check that direct entries which will also have a file entry containing that directory doesn't 214 // Also check that direct entries which will also have a file entry containing that directory doesn't
215 // upset load 215 // upset load
216 tar.WriteDir(ArchiveConstants.TERRAINS_PATH); 216 tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
217 217
218 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); 218 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
219 219
@@ -251,7 +251,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
251 { 251 {
252 scene.EventManager.OnOarFileLoaded += LoadCompleted; 252 scene.EventManager.OnOarFileLoaded += LoadCompleted;
253 archiverModule.DearchiveRegion(archiveReadStream); 253 archiverModule.DearchiveRegion(archiveReadStream);
254 } 254 }
255 255
256 Assert.That(m_lastErrorMessage, Is.Null); 256 Assert.That(m_lastErrorMessage, Is.Null);
257 257
@@ -271,7 +271,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
271 271
272 /// <summary> 272 /// <summary>
273 /// Test merging a V0.2 OpenSim Region Archive into an existing scene 273 /// Test merging a V0.2 OpenSim Region Archive into an existing scene
274 /// </summary> 274 /// </summary>
275 //[Test] 275 //[Test]
276 public void TestMergeOarV0_2() 276 public void TestMergeOarV0_2()
277 { 277 {
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 75b3fe6..4896edf 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -33,7 +33,6 @@ using log4net;
33using Nini.Config; 33using Nini.Config;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.CoreModules.World.Terrain;
37using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
39 38
@@ -47,7 +46,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
47 46
48 private Scene m_scene; 47 private Scene m_scene;
49 48
50 private EstateTerrainXferHandler TerrainUploader = null; 49 private EstateTerrainXferHandler TerrainUploader;
51 50
52 #region Packet Data Responders 51 #region Packet Data Responders
53 52
@@ -155,6 +154,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
155 break; 154 break;
156 } 155 }
157 m_scene.RegionInfo.RegionSettings.Save(); 156 m_scene.RegionInfo.RegionSettings.Save();
157 sendRegionInfoPacketToAll();
158 } 158 }
159 159
160 public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) 160 public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue)
@@ -179,6 +179,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
179 break; 179 break;
180 } 180 }
181 m_scene.RegionInfo.RegionSettings.Save(); 181 m_scene.RegionInfo.RegionSettings.Save();
182 sendRegionInfoPacketToAll();
182 } 183 }
183 184
184 private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient) 185 private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient)
@@ -668,7 +669,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
668 LookupUUID(uuidNameLookupList); 669 LookupUUID(uuidNameLookupList);
669 } 670 }
670 671
671 private void LookupUUIDSCompleted(IAsyncResult iar) 672 private static void LookupUUIDSCompleted(IAsyncResult iar)
672 { 673 {
673 LookupUUIDS icon = (LookupUUIDS)iar.AsyncState; 674 LookupUUIDS icon = (LookupUUIDS)iar.AsyncState;
674 icon.EndInvoke(iar); 675 icon.EndInvoke(iar);
@@ -683,7 +684,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
683 } 684 }
684 private void LookupUUIDsAsync(List<UUID> uuidLst) 685 private void LookupUUIDsAsync(List<UUID> uuidLst)
685 { 686 {
686 UUID[] uuidarr = new UUID[0]; 687 UUID[] uuidarr;
687 688
688 lock (uuidLst) 689 lock (uuidLst)
689 { 690 {
@@ -707,7 +708,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
707 708
708 for (int i = 0; i < avatars.Count; i++) 709 for (int i = 0; i < avatars.Count; i++)
709 { 710 {
710 HandleRegionInfoRequest(avatars[i].ControllingClient); ; 711 HandleRegionInfoRequest(avatars[i].ControllingClient);
711 } 712 }
712 } 713 }
713 714
@@ -768,7 +769,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
768 else 769 else
769 { 770 {
770 m_scene.RegionInfo.EstateSettings.UseGlobalTime = false; 771 m_scene.RegionInfo.EstateSettings.UseGlobalTime = false;
771 m_scene.RegionInfo.EstateSettings.SunPosition = (double)(parms2 - 0x1800)/1024.0; 772 m_scene.RegionInfo.EstateSettings.SunPosition = (parms2 - 0x1800)/1024.0;
772 } 773 }
773 774
774 if ((parms1 & 0x00000010) != 0) 775 if ((parms1 & 0x00000010) != 0)
@@ -828,8 +829,108 @@ namespace OpenSim.Region.CoreModules.World.Estate
828 m_scene.RegisterModuleInterface<IEstateModule>(this); 829 m_scene.RegisterModuleInterface<IEstateModule>(this);
829 m_scene.EventManager.OnNewClient += EventManager_OnNewClient; 830 m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
830 m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; 831 m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight;
832
833 m_scene.AddCommand(this, "set terrain texture",
834 "set terrain texture <number> <uuid> [<x>] [<y>]",
835 "Sets the terrain <number> to <uuid>, if <x> or <y> are specified, it will only " +
836 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
837 " that coordinate.",
838 consoleSetTerrainTexture);
839
840 m_scene.AddCommand(this, "set terrain heights",
841 "set terrain heights <corner> <min> <max> [<x>] [<y>]",
842 "Sets the terrain texture heights on corner #<corner> to <min>/<max>, if <x> or <y> are specified, it will only " +
843 "set it on regions with a matching coordinate. Specify -1 in <x> or <y> to wildcard" +
844 " that coordinate. Corner # SW = 0, NW = 1, SE = 2, NE = 3.",
845 consoleSetTerrainHeights);
846 }
847
848 #region Console Commands
849
850 public void consoleSetTerrainTexture(string module, string[] args)
851 {
852 string num = args[3];
853 string uuid = args[4];
854 int x = (args.Length > 5 ? int.Parse(args[5]) : -1);
855 int y = (args.Length > 6 ? int.Parse(args[6]) : -1);
856
857 if (x == -1 || m_scene.RegionInfo.RegionLocX == x)
858 {
859 if (y == -1 || m_scene.RegionInfo.RegionLocY == y)
860 {
861 int corner = int.Parse(num);
862 UUID texture = UUID.Parse(uuid);
863
864 m_log.Debug("[ESTATEMODULE] Setting terrain textures for " + m_scene.RegionInfo.RegionName +
865 string.Format(" (C#{0} = {1})", corner, texture));
866
867 switch (corner)
868 {
869 case 0:
870 m_scene.RegionInfo.RegionSettings.TerrainTexture1 = texture;
871 break;
872 case 1:
873 m_scene.RegionInfo.RegionSettings.TerrainTexture2 = texture;
874 break;
875 case 2:
876 m_scene.RegionInfo.RegionSettings.TerrainTexture3 = texture;
877 break;
878 case 3:
879 m_scene.RegionInfo.RegionSettings.TerrainTexture4 = texture;
880 break;
881 }
882 m_scene.RegionInfo.RegionSettings.Save();
883 sendRegionInfoPacketToAll();
884
885 }
886 }
887 }
888
889 public void consoleSetTerrainHeights(string module, string[] args)
890 {
891 string num = args[3];
892 string min = args[4];
893 string max = args[5];
894 int x = (args.Length > 6 ? int.Parse(args[6]) : -1);
895 int y = (args.Length > 7 ? int.Parse(args[7]) : -1);
896
897 if (x == -1 || m_scene.RegionInfo.RegionLocX == x)
898 {
899 if (y == -1 || m_scene.RegionInfo.RegionLocY == y)
900 {
901 int corner = int.Parse(num);
902 float lowValue = float.Parse(min);
903 float highValue = float.Parse(max);
904
905 m_log.Debug("[ESTATEMODULE] Setting terrain heights " + m_scene.RegionInfo.RegionName +
906 string.Format(" (C{0}, {1}-{2}", corner, lowValue, highValue));
907
908 switch (corner)
909 {
910 case 0:
911 m_scene.RegionInfo.RegionSettings.Elevation1SW = lowValue;
912 m_scene.RegionInfo.RegionSettings.Elevation2SW = highValue;
913 break;
914 case 1:
915 m_scene.RegionInfo.RegionSettings.Elevation1NW = lowValue;
916 m_scene.RegionInfo.RegionSettings.Elevation2NW = highValue;
917 break;
918 case 2:
919 m_scene.RegionInfo.RegionSettings.Elevation1SE = lowValue;
920 m_scene.RegionInfo.RegionSettings.Elevation2SE = highValue;
921 break;
922 case 3:
923 m_scene.RegionInfo.RegionSettings.Elevation1NE = lowValue;
924 m_scene.RegionInfo.RegionSettings.Elevation2NE = highValue;
925 break;
926 }
927 m_scene.RegionInfo.RegionSettings.Save();
928 sendRegionHandshakeToAll();
929 }
930 }
831 } 931 }
832 932
933 #endregion
833 934
834 public void PostInitialise() 935 public void PostInitialise()
835 { 936 {
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
index 8767332..4ed23bb 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
@@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.World.Land
82 } 82 }
83 83
84 ILandObject obj = new LandObject(UUID.Zero, false, m_scene); 84 ILandObject obj = new LandObject(UUID.Zero, false, m_scene);
85 obj.landData.Name = "NO LAND"; 85 obj.LandData.Name = "NO LAND";
86 return obj; 86 return obj;
87 } 87 }
88 88
@@ -103,7 +103,7 @@ namespace OpenSim.Region.CoreModules.World.Land
103 } 103 }
104 104
105 ILandObject obj = new LandObject(UUID.Zero, false, m_scene); 105 ILandObject obj = new LandObject(UUID.Zero, false, m_scene);
106 obj.landData.Name = "NO LAND"; 106 obj.LandData.Name = "NO LAND";
107 return obj; 107 return obj;
108 } 108 }
109 109
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 76ff6da..d2b5cb1 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -36,18 +36,20 @@ using OpenSim.Framework;
36using OpenSim.Framework.Capabilities; 36using OpenSim.Framework.Capabilities;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using OpenSim.Framework.Servers.HttpServer; 38using OpenSim.Framework.Servers.HttpServer;
39using OpenSim.Services.Interfaces;
39using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Physics.Manager; 42using OpenSim.Region.Physics.Manager;
42using Caps=OpenSim.Framework.Capabilities.Caps; 43using Caps=OpenSim.Framework.Capabilities.Caps;
44using GridRegion = OpenSim.Services.Interfaces.GridRegion;
43 45
44namespace OpenSim.Region.CoreModules.World.Land 46namespace OpenSim.Region.CoreModules.World.Land
45{ 47{
46 // used for caching 48 // used for caching
47 internal class ExtendedLandData { 49 internal class ExtendedLandData {
48 public LandData landData; 50 public LandData LandData;
49 public ulong regionHandle; 51 public ulong RegionHandle;
50 public uint x, y; 52 public uint X, Y;
51 } 53 }
52 54
53 public class LandManagementModule : INonSharedRegionModule 55 public class LandManagementModule : INonSharedRegionModule
@@ -189,7 +191,7 @@ namespace OpenSim.Region.CoreModules.World.Land
189 { 191 {
190 if (m_landList.ContainsKey(local_id)) 192 if (m_landList.ContainsKey(local_id))
191 { 193 {
192 m_landList[local_id].landData = newData; 194 m_landList[local_id].LandData = newData;
193 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]); 195 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]);
194 } 196 }
195 } 197 }
@@ -216,12 +218,12 @@ namespace OpenSim.Region.CoreModules.World.Land
216 218
217 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); 219 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
218 220
219 fullSimParcel.setLandBitmap(fullSimParcel.getSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); 221 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
220 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) 222 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)
221 fullSimParcel.landData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 223 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
222 else 224 else
223 fullSimParcel.landData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; 225 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID;
224 fullSimParcel.landData.ClaimDate = Util.UnixTimeSinceEpoch(); 226 fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
225 AddLandObject(fullSimParcel); 227 AddLandObject(fullSimParcel);
226 } 228 }
227 229
@@ -287,11 +289,11 @@ namespace OpenSim.Region.CoreModules.World.Land
287 { 289 {
288 if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) 290 if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT)
289 { 291 {
290 if (parcelAvatarIsEntering.isBannedFromLand(avatar.UUID)) 292 if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID))
291 { 293 {
292 SendYouAreBannedNotice(avatar); 294 SendYouAreBannedNotice(avatar);
293 } 295 }
294 else if (parcelAvatarIsEntering.isRestrictedFromLand(avatar.UUID)) 296 else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID))
295 { 297 {
296 avatar.ControllingClient.SendAlertMessage( 298 avatar.ControllingClient.SendAlertMessage(
297 "You are not allowed on this parcel because the land owner has restricted access. For now, you can enter, but please respect the land owner's decisions (or he can ban you!)."); 299 "You are not allowed on this parcel because the land owner has restricted access. For now, you can enter, but please respect the land owner's decisions (or he can ban you!).");
@@ -319,14 +321,14 @@ namespace OpenSim.Region.CoreModules.World.Land
319 List<ILandObject> checkLandParcels = ParcelsNearPoint(presence.AbsolutePosition); 321 List<ILandObject> checkLandParcels = ParcelsNearPoint(presence.AbsolutePosition);
320 foreach (ILandObject checkBan in checkLandParcels) 322 foreach (ILandObject checkBan in checkLandParcels)
321 { 323 {
322 if (checkBan.isBannedFromLand(avatar.AgentId)) 324 if (checkBan.IsBannedFromLand(avatar.AgentId))
323 { 325 {
324 checkBan.sendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar); 326 checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar);
325 return; //Only send one 327 return; //Only send one
326 } 328 }
327 if (checkBan.isRestrictedFromLand(avatar.AgentId)) 329 if (checkBan.IsRestrictedFromLand(avatar.AgentId))
328 { 330 {
329 checkBan.sendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar); 331 checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar);
330 return; //Only send one 332 return; //Only send one
331 } 333 }
332 } 334 }
@@ -346,19 +348,19 @@ namespace OpenSim.Region.CoreModules.World.Land
346 { 348 {
347 if (!avatar.IsChildAgent) 349 if (!avatar.IsChildAgent)
348 { 350 {
349 over.sendLandUpdateToClient(avatar.ControllingClient); 351 over.SendLandUpdateToClient(avatar.ControllingClient);
350 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.LocalID, 352 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID,
351 m_scene.RegionInfo.RegionID); 353 m_scene.RegionInfo.RegionID);
352 } 354 }
353 } 355 }
354 356
355 if (avatar.currentParcelUUID != over.landData.GlobalID) 357 if (avatar.currentParcelUUID != over.LandData.GlobalID)
356 { 358 {
357 if (!avatar.IsChildAgent) 359 if (!avatar.IsChildAgent)
358 { 360 {
359 over.sendLandUpdateToClient(avatar.ControllingClient); 361 over.SendLandUpdateToClient(avatar.ControllingClient);
360 avatar.currentParcelUUID = over.landData.GlobalID; 362 avatar.currentParcelUUID = over.LandData.GlobalID;
361 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.LocalID, 363 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID,
362 m_scene.RegionInfo.RegionID); 364 m_scene.RegionInfo.RegionID);
363 } 365 }
364 } 366 }
@@ -384,16 +386,16 @@ namespace OpenSim.Region.CoreModules.World.Land
384 if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && 386 if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT &&
385 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) 387 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown)
386 { 388 {
387 EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.landData.LocalID, 389 EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID,
388 m_scene.RegionInfo.RegionID); 390 m_scene.RegionInfo.RegionID);
389 //They are going under the safety line! 391 //They are going under the safety line!
390 if (!parcel.isBannedFromLand(clientAvatar.UUID)) 392 if (!parcel.IsBannedFromLand(clientAvatar.UUID))
391 { 393 {
392 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false; 394 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false;
393 } 395 }
394 } 396 }
395 else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && 397 else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT &&
396 parcel.isBannedFromLand(clientAvatar.UUID)) 398 parcel.IsBannedFromLand(clientAvatar.UUID))
397 { 399 {
398 SendYouAreBannedNotice(clientAvatar); 400 SendYouAreBannedNotice(clientAvatar);
399 } 401 }
@@ -407,7 +409,7 @@ namespace OpenSim.Region.CoreModules.World.Land
407 ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 409 ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
408 if (over != null) 410 if (over != null)
409 { 411 {
410 if (!over.isBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= LandChannel.BAN_LINE_SAFETY_HIEGHT) 412 if (!over.IsBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= LandChannel.BAN_LINE_SAFETY_HIEGHT)
411 { 413 {
412 avatar.lastKnownAllowedPosition = 414 avatar.lastKnownAllowedPosition =
413 new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); 415 new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z);
@@ -427,7 +429,7 @@ namespace OpenSim.Region.CoreModules.World.Land
427 429
428 if (land != null) 430 if (land != null)
429 { 431 {
430 m_landList[landLocalID].sendAccessList(agentID, sessionID, flags, sequenceID, remote_client); 432 m_landList[landLocalID].SendAccessList(agentID, sessionID, flags, sequenceID, remote_client);
431 } 433 }
432 } 434 }
433 435
@@ -443,9 +445,9 @@ namespace OpenSim.Region.CoreModules.World.Land
443 445
444 if (land != null) 446 if (land != null)
445 { 447 {
446 if (agentID == land.landData.OwnerID) 448 if (agentID == land.LandData.OwnerID)
447 { 449 {
448 land.updateAccessList(flags, entries, remote_client); 450 land.UpdateAccessList(flags, entries, remote_client);
449 } 451 }
450 } 452 }
451 else 453 else
@@ -474,9 +476,9 @@ namespace OpenSim.Region.CoreModules.World.Land
474 lock (m_landList) 476 lock (m_landList)
475 { 477 {
476 int newLandLocalID = ++m_lastLandLocalID; 478 int newLandLocalID = ++m_lastLandLocalID;
477 new_land.landData.LocalID = newLandLocalID; 479 new_land.LandData.LocalID = newLandLocalID;
478 480
479 bool[,] landBitmap = new_land.getLandBitmap(); 481 bool[,] landBitmap = new_land.GetLandBitmap();
480 for (int x = 0; x < landArrayMax; x++) 482 for (int x = 0; x < landArrayMax; x++)
481 { 483 {
482 for (int y = 0; y < landArrayMax; y++) 484 for (int y = 0; y < landArrayMax; y++)
@@ -491,7 +493,7 @@ namespace OpenSim.Region.CoreModules.World.Land
491 m_landList.Add(newLandLocalID, new_land); 493 m_landList.Add(newLandLocalID, new_land);
492 } 494 }
493 495
494 new_land.forceUpdateLandInfo(); 496 new_land.ForceUpdateLandInfo();
495 m_scene.EventManager.TriggerLandObjectAdded(new_land); 497 m_scene.EventManager.TriggerLandObjectAdded(new_land);
496 return new_land; 498 return new_land;
497 } 499 }
@@ -518,14 +520,14 @@ namespace OpenSim.Region.CoreModules.World.Land
518 } 520 }
519 } 521 }
520 522
521 m_scene.EventManager.TriggerLandObjectRemoved(m_landList[local_id].landData.GlobalID); 523 m_scene.EventManager.TriggerLandObjectRemoved(m_landList[local_id].LandData.GlobalID);
522 m_landList.Remove(local_id); 524 m_landList.Remove(local_id);
523 } 525 }
524 } 526 }
525 527
526 private void performFinalLandJoin(ILandObject master, ILandObject slave) 528 private void performFinalLandJoin(ILandObject master, ILandObject slave)
527 { 529 {
528 bool[,] landBitmapSlave = slave.getLandBitmap(); 530 bool[,] landBitmapSlave = slave.GetLandBitmap();
529 lock (m_landList) 531 lock (m_landList)
530 { 532 {
531 for (int x = 0; x < 64; x++) 533 for (int x = 0; x < 64; x++)
@@ -534,14 +536,14 @@ namespace OpenSim.Region.CoreModules.World.Land
534 { 536 {
535 if (landBitmapSlave[x, y]) 537 if (landBitmapSlave[x, y])
536 { 538 {
537 m_landIDList[x, y] = master.landData.LocalID; 539 m_landIDList[x, y] = master.LandData.LocalID;
538 } 540 }
539 } 541 }
540 } 542 }
541 } 543 }
542 544
543 removeLandObject(slave.landData.LocalID); 545 removeLandObject(slave.LandData.LocalID);
544 UpdateLandObject(master.landData.LocalID, master.landData); 546 UpdateLandObject(master.LandData.LocalID, master.LandData);
545 } 547 }
546 548
547 public ILandObject GetLandObject(int parcelLocalID) 549 public ILandObject GetLandObject(int parcelLocalID)
@@ -628,7 +630,7 @@ namespace OpenSim.Region.CoreModules.World.Land
628 { 630 {
629 foreach (LandObject p in m_landList.Values) 631 foreach (LandObject p in m_landList.Values)
630 { 632 {
631 p.resetLandPrimCounts(); 633 p.ResetLandPrimCounts();
632 } 634 }
633 } 635 }
634 } 636 }
@@ -649,7 +651,7 @@ namespace OpenSim.Region.CoreModules.World.Land
649 ILandObject landUnderPrim = GetLandObject(position.X, position.Y); 651 ILandObject landUnderPrim = GetLandObject(position.X, position.Y);
650 if (landUnderPrim != null) 652 if (landUnderPrim != null)
651 { 653 {
652 landUnderPrim.addPrimToCount(obj); 654 landUnderPrim.AddPrimToCount(obj);
653 } 655 }
654 } 656 }
655 657
@@ -660,7 +662,7 @@ namespace OpenSim.Region.CoreModules.World.Land
660 { 662 {
661 foreach (LandObject p in m_landList.Values) 663 foreach (LandObject p in m_landList.Values)
662 { 664 {
663 p.removePrimFromCount(obj); 665 p.RemovePrimFromCount(obj);
664 } 666 }
665 } 667 }
666 } 668 }
@@ -673,15 +675,15 @@ namespace OpenSim.Region.CoreModules.World.Land
673 { 675 {
674 foreach (LandObject p in m_landList.Values) 676 foreach (LandObject p in m_landList.Values)
675 { 677 {
676 if (!landOwnersAndParcels.ContainsKey(p.landData.OwnerID)) 678 if (!landOwnersAndParcels.ContainsKey(p.LandData.OwnerID))
677 { 679 {
678 List<LandObject> tempList = new List<LandObject>(); 680 List<LandObject> tempList = new List<LandObject>();
679 tempList.Add(p); 681 tempList.Add(p);
680 landOwnersAndParcels.Add(p.landData.OwnerID, tempList); 682 landOwnersAndParcels.Add(p.LandData.OwnerID, tempList);
681 } 683 }
682 else 684 else
683 { 685 {
684 landOwnersAndParcels[p.landData.OwnerID].Add(p); 686 landOwnersAndParcels[p.LandData.OwnerID].Add(p);
685 } 687 }
686 } 688 }
687 } 689 }
@@ -692,15 +694,15 @@ namespace OpenSim.Region.CoreModules.World.Land
692 int simPrims = 0; 694 int simPrims = 0;
693 foreach (LandObject p in landOwnersAndParcels[owner]) 695 foreach (LandObject p in landOwnersAndParcels[owner])
694 { 696 {
695 simArea += p.landData.Area; 697 simArea += p.LandData.Area;
696 simPrims += p.landData.OwnerPrims + p.landData.OtherPrims + p.landData.GroupPrims + 698 simPrims += p.LandData.OwnerPrims + p.LandData.OtherPrims + p.LandData.GroupPrims +
697 p.landData.SelectedPrims; 699 p.LandData.SelectedPrims;
698 } 700 }
699 701
700 foreach (LandObject p in landOwnersAndParcels[owner]) 702 foreach (LandObject p in landOwnersAndParcels[owner])
701 { 703 {
702 p.landData.SimwideArea = simArea; 704 p.LandData.SimwideArea = simArea;
703 p.landData.SimwidePrims = simPrims; 705 p.LandData.SimwidePrims = simPrims;
704 } 706 }
705 } 707 }
706 } 708 }
@@ -777,26 +779,26 @@ namespace OpenSim.Region.CoreModules.World.Land
777 779
778 //Lets create a new land object with bitmap activated at that point (keeping the old land objects info) 780 //Lets create a new land object with bitmap activated at that point (keeping the old land objects info)
779 ILandObject newLand = startLandObject.Copy(); 781 ILandObject newLand = startLandObject.Copy();
780 newLand.landData.Name = newLand.landData.Name; 782 newLand.LandData.Name = newLand.LandData.Name;
781 newLand.landData.GlobalID = UUID.Random(); 783 newLand.LandData.GlobalID = UUID.Random();
782 784
783 newLand.setLandBitmap(newLand.getSquareLandBitmap(start_x, start_y, end_x, end_y)); 785 newLand.SetLandBitmap(newLand.GetSquareLandBitmap(start_x, start_y, end_x, end_y));
784 786
785 //Now, lets set the subdivision area of the original to false 787 //Now, lets set the subdivision area of the original to false
786 int startLandObjectIndex = startLandObject.landData.LocalID; 788 int startLandObjectIndex = startLandObject.LandData.LocalID;
787 lock (m_landList) 789 lock (m_landList)
788 { 790 {
789 m_landList[startLandObjectIndex].setLandBitmap( 791 m_landList[startLandObjectIndex].SetLandBitmap(
790 newLand.modifyLandBitmapSquare(startLandObject.getLandBitmap(), start_x, start_y, end_x, end_y, false)); 792 newLand.ModifyLandBitmapSquare(startLandObject.GetLandBitmap(), start_x, start_y, end_x, end_y, false));
791 m_landList[startLandObjectIndex].forceUpdateLandInfo(); 793 m_landList[startLandObjectIndex].ForceUpdateLandInfo();
792 } 794 }
793 795
794 EventManagerOnParcelPrimCountTainted(); 796 EventManagerOnParcelPrimCountTainted();
795 797
796 //Now add the new land object 798 //Now add the new land object
797 ILandObject result = AddLandObject(newLand); 799 ILandObject result = AddLandObject(newLand);
798 UpdateLandObject(startLandObject.landData.LocalID, startLandObject.landData); 800 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData);
799 result.sendLandUpdateToAvatarsOverMe(); 801 result.SendLandUpdateToAvatarsOverMe();
800 } 802 }
801 803
802 /// <summary> 804 /// <summary>
@@ -844,7 +846,7 @@ namespace OpenSim.Region.CoreModules.World.Land
844 } 846 }
845 foreach (ILandObject p in selectedLandObjects) 847 foreach (ILandObject p in selectedLandObjects)
846 { 848 {
847 if (p.landData.OwnerID != masterLandObject.landData.OwnerID) 849 if (p.LandData.OwnerID != masterLandObject.LandData.OwnerID)
848 { 850 {
849 return; 851 return;
850 } 852 }
@@ -854,14 +856,14 @@ namespace OpenSim.Region.CoreModules.World.Land
854 { 856 {
855 foreach (ILandObject slaveLandObject in selectedLandObjects) 857 foreach (ILandObject slaveLandObject in selectedLandObjects)
856 { 858 {
857 m_landList[masterLandObject.landData.LocalID].setLandBitmap( 859 m_landList[masterLandObject.LandData.LocalID].SetLandBitmap(
858 slaveLandObject.mergeLandBitmaps(masterLandObject.getLandBitmap(), slaveLandObject.getLandBitmap())); 860 slaveLandObject.MergeLandBitmaps(masterLandObject.GetLandBitmap(), slaveLandObject.GetLandBitmap()));
859 performFinalLandJoin(masterLandObject, slaveLandObject); 861 performFinalLandJoin(masterLandObject, slaveLandObject);
860 } 862 }
861 } 863 }
862 EventManagerOnParcelPrimCountTainted(); 864 EventManagerOnParcelPrimCountTainted();
863 865
864 masterLandObject.sendLandUpdateToAvatarsOverMe(); 866 masterLandObject.SendLandUpdateToAvatarsOverMe();
865 } 867 }
866 868
867 #endregion 869 #endregion
@@ -892,19 +894,19 @@ namespace OpenSim.Region.CoreModules.World.Land
892 894
893 if (currentParcelBlock != null) 895 if (currentParcelBlock != null)
894 { 896 {
895 if (currentParcelBlock.landData.OwnerID == remote_client.AgentId) 897 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId)
896 { 898 {
897 //Owner Flag 899 //Owner Flag
898 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); 900 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER);
899 } 901 }
900 else if (currentParcelBlock.landData.SalePrice > 0 && 902 else if (currentParcelBlock.LandData.SalePrice > 0 &&
901 (currentParcelBlock.landData.AuthBuyerID == UUID.Zero || 903 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero ||
902 currentParcelBlock.landData.AuthBuyerID == remote_client.AgentId)) 904 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId))
903 { 905 {
904 //Sale Flag 906 //Sale Flag
905 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_IS_FOR_SALE); 907 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_IS_FOR_SALE);
906 } 908 }
907 else if (currentParcelBlock.landData.OwnerID == UUID.Zero) 909 else if (currentParcelBlock.LandData.OwnerID == UUID.Zero)
908 { 910 {
909 //Public Flag 911 //Public Flag
910 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_PUBLIC); 912 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_PUBLIC);
@@ -978,7 +980,7 @@ namespace OpenSim.Region.CoreModules.World.Land
978 { 980 {
979 if (!temp.Contains(currentParcel)) 981 if (!temp.Contains(currentParcel))
980 { 982 {
981 currentParcel.forceUpdateLandInfo(); 983 currentParcel.ForceUpdateLandInfo();
982 temp.Add(currentParcel); 984 temp.Add(currentParcel);
983 } 985 }
984 } 986 }
@@ -994,7 +996,7 @@ namespace OpenSim.Region.CoreModules.World.Land
994 996
995 for (int i = 0; i < temp.Count; i++) 997 for (int i = 0; i < temp.Count; i++)
996 { 998 {
997 temp[i].sendLandProperties(sequence_id, snap_selection, requestResult, remote_client); 999 temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client);
998 } 1000 }
999 1001
1000 SendParcelOverlay(remote_client); 1002 SendParcelOverlay(remote_client);
@@ -1008,7 +1010,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1008 m_landList.TryGetValue(localID, out land); 1010 m_landList.TryGetValue(localID, out land);
1009 } 1011 }
1010 1012
1011 if (land != null) land.updateLandProperties(args, remote_client); 1013 if (land != null) land.UpdateLandProperties(args, remote_client);
1012 } 1014 }
1013 1015
1014 public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) 1016 public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client)
@@ -1024,7 +1026,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1024 public void ClientOnParcelSelectObjects(int local_id, int request_type, 1026 public void ClientOnParcelSelectObjects(int local_id, int request_type,
1025 List<UUID> returnIDs, IClientAPI remote_client) 1027 List<UUID> returnIDs, IClientAPI remote_client)
1026 { 1028 {
1027 m_landList[local_id].sendForceObjectSelect(local_id, request_type, returnIDs, remote_client); 1029 m_landList[local_id].SendForceObjectSelect(local_id, request_type, returnIDs, remote_client);
1028 } 1030 }
1029 1031
1030 public void ClientOnParcelObjectOwnerRequest(int local_id, IClientAPI remote_client) 1032 public void ClientOnParcelObjectOwnerRequest(int local_id, IClientAPI remote_client)
@@ -1037,7 +1039,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1037 1039
1038 if (land != null) 1040 if (land != null)
1039 { 1041 {
1040 m_landList[local_id].sendLandObjectOwners(remote_client); 1042 m_landList[local_id].SendLandObjectOwners(remote_client);
1041 } 1043 }
1042 else 1044 else
1043 { 1045 {
@@ -1057,10 +1059,10 @@ namespace OpenSim.Region.CoreModules.World.Land
1057 { 1059 {
1058 if (m_scene.Permissions.IsGod(remote_client.AgentId)) 1060 if (m_scene.Permissions.IsGod(remote_client.AgentId))
1059 { 1061 {
1060 land.landData.OwnerID = ownerID; 1062 land.LandData.OwnerID = ownerID;
1061 1063
1062 m_scene.Broadcast(SendParcelOverlay); 1064 m_scene.Broadcast(SendParcelOverlay);
1063 land.sendLandUpdateToClient(remote_client); 1065 land.SendLandUpdateToClient(remote_client);
1064 } 1066 }
1065 } 1067 }
1066 } 1068 }
@@ -1078,11 +1080,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1078 if (m_scene.Permissions.CanAbandonParcel(remote_client.AgentId, land)) 1080 if (m_scene.Permissions.CanAbandonParcel(remote_client.AgentId, land))
1079 { 1081 {
1080 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) 1082 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)
1081 land.landData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 1083 land.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
1082 else 1084 else
1083 land.landData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; 1085 land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID;
1084 m_scene.Broadcast(SendParcelOverlay); 1086 m_scene.Broadcast(SendParcelOverlay);
1085 land.sendLandUpdateToClient(remote_client); 1087 land.SendLandUpdateToClient(remote_client);
1086 } 1088 }
1087 } 1089 }
1088 } 1090 }
@@ -1100,13 +1102,13 @@ namespace OpenSim.Region.CoreModules.World.Land
1100 if (m_scene.Permissions.CanReclaimParcel(remote_client.AgentId, land)) 1102 if (m_scene.Permissions.CanReclaimParcel(remote_client.AgentId, land))
1101 { 1103 {
1102 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) 1104 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)
1103 land.landData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 1105 land.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
1104 else 1106 else
1105 land.landData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; 1107 land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID;
1106 land.landData.ClaimDate = Util.UnixTimeSinceEpoch(); 1108 land.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
1107 land.landData.IsGroupOwned = false; 1109 land.LandData.IsGroupOwned = false;
1108 m_scene.Broadcast(SendParcelOverlay); 1110 m_scene.Broadcast(SendParcelOverlay);
1109 land.sendLandUpdateToClient(remote_client); 1111 land.SendLandUpdateToClient(remote_client);
1110 } 1112 }
1111 } 1113 }
1112 } 1114 }
@@ -1128,7 +1130,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1128 1130
1129 if (land != null) 1131 if (land != null)
1130 { 1132 {
1131 land.updateLandSold(e.agentId, e.groupId, e.groupOwned, (uint)e.transactionID, e.parcelPrice, e.parcelArea); 1133 land.UpdateLandSold(e.agentId, e.groupId, e.groupOwned, (uint)e.transactionID, e.parcelPrice, e.parcelArea);
1132 } 1134 }
1133 } 1135 }
1134 } 1136 }
@@ -1149,11 +1151,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1149 1151
1150 if (lob != null) 1152 if (lob != null)
1151 { 1153 {
1152 UUID AuthorizedID = lob.landData.AuthBuyerID; 1154 UUID AuthorizedID = lob.LandData.AuthBuyerID;
1153 int saleprice = lob.landData.SalePrice; 1155 int saleprice = lob.LandData.SalePrice;
1154 UUID pOwnerID = lob.landData.OwnerID; 1156 UUID pOwnerID = lob.LandData.OwnerID;
1155 1157
1156 bool landforsale = ((lob.landData.Flags & 1158 bool landforsale = ((lob.LandData.Flags &
1157 (uint)(ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects)) != 0); 1159 (uint)(ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects)) != 0);
1158 if ((AuthorizedID == UUID.Zero || AuthorizedID == e.agentId) && e.parcelPrice >= saleprice && landforsale) 1160 if ((AuthorizedID == UUID.Zero || AuthorizedID == e.agentId) && e.parcelPrice >= saleprice && landforsale)
1159 { 1161 {
@@ -1182,7 +1184,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1182 1184
1183 if (land != null) 1185 if (land != null)
1184 { 1186 {
1185 land.deedToGroup(groupID); 1187 land.DeedToGroup(groupID);
1186 } 1188 }
1187 1189
1188 } 1190 }
@@ -1201,8 +1203,8 @@ namespace OpenSim.Region.CoreModules.World.Land
1201 public void IncomingLandObjectFromStorage(LandData data) 1203 public void IncomingLandObjectFromStorage(LandData data)
1202 { 1204 {
1203 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); 1205 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
1204 new_land.landData = data.Copy(); 1206 new_land.LandData = data.Copy();
1205 new_land.setLandBitmapFromByteArray(); 1207 new_land.SetLandBitmapFromByteArray();
1206 AddLandObject(new_land); 1208 AddLandObject(new_land);
1207 } 1209 }
1208 1210
@@ -1216,7 +1218,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1216 1218
1217 if (selectedParcel == null) return; 1219 if (selectedParcel == null) return;
1218 1220
1219 selectedParcel.returnLandObjects(returnType, agentIDs, taskIDs, remoteClient); 1221 selectedParcel.ReturnLandObjects(returnType, agentIDs, taskIDs, remoteClient);
1220 } 1222 }
1221 1223
1222 public void EventManagerOnNoLandDataFromStorage() 1224 public void EventManagerOnNoLandDataFromStorage()
@@ -1232,7 +1234,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1232 { 1234 {
1233 foreach (LandObject obj in m_landList.Values) 1235 foreach (LandObject obj in m_landList.Values)
1234 { 1236 {
1235 obj.setParcelObjectMaxOverride(overrideDel); 1237 obj.SetParcelObjectMaxOverride(overrideDel);
1236 } 1238 }
1237 } 1239 }
1238 } 1240 }
@@ -1301,7 +1303,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1301 else 1303 else
1302 { 1304 {
1303 // a parcel request for a parcel in another region. Ask the grid about the region 1305 // a parcel request for a parcel in another region. Ask the grid about the region
1304 RegionInfo info = m_scene.CommsManager.GridService.RequestNeighbourInfo(regionID); 1306 GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, regionID);
1305 if (info != null) 1307 if (info != null)
1306 parcelID = Util.BuildFakeParcelID(info.RegionHandle, x, y); 1308 parcelID = Util.BuildFakeParcelID(info.RegionHandle, x, y);
1307 } 1309 }
@@ -1335,7 +1337,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1335 return; 1337 return;
1336 } 1338 }
1337 1339
1338 remoteClient.SendParcelDwellReply(localID, selectedParcel.landData.GlobalID, selectedParcel.landData.Dwell); 1340 remoteClient.SendParcelDwellReply(localID, selectedParcel.LandData.GlobalID, selectedParcel.LandData.Dwell);
1339 } 1341 }
1340 1342
1341 private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID) 1343 private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID)
@@ -1343,50 +1345,62 @@ namespace OpenSim.Region.CoreModules.World.Land
1343 if (parcelID == UUID.Zero) 1345 if (parcelID == UUID.Zero)
1344 return; 1346 return;
1345 1347
1346 ExtendedLandData data = (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(), delegate(string id) { 1348 ExtendedLandData data =
1347 UUID parcel = UUID.Zero; 1349 (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(),
1348 UUID.TryParse(id, out parcel); 1350 delegate(string id)
1349 // assume we've got the parcelID we just computed in RemoteParcelRequest 1351 {
1350 ExtendedLandData extLandData = new ExtendedLandData(); 1352 UUID parcel = UUID.Zero;
1351 Util.ParseFakeParcelID(parcel, out extLandData.regionHandle, out extLandData.x, out extLandData.y); 1353 UUID.TryParse(id, out parcel);
1352 m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", 1354 // assume we've got the parcelID we just computed in RemoteParcelRequest
1353 extLandData.regionHandle, extLandData.x, extLandData.y); 1355 ExtendedLandData extLandData = new ExtendedLandData();
1354 1356 Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
1355 // for this region or for somewhere else? 1357 out extLandData.X, out extLandData.Y);
1356 if (extLandData.regionHandle == m_scene.RegionInfo.RegionHandle) 1358 m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
1357 { 1359 extLandData.RegionHandle, extLandData.X, extLandData.Y);
1358 extLandData.landData = this.GetLandObject(extLandData.x, extLandData.y).landData; 1360
1359 } 1361 // for this region or for somewhere else?
1360 else 1362 if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle)
1361 { 1363 {
1362 extLandData.landData = m_scene.CommsManager.GridService.RequestLandData(extLandData.regionHandle, 1364 extLandData.LandData = this.GetLandObject(extLandData.X, extLandData.Y).LandData;
1363 extLandData.x, 1365 }
1364 extLandData.y); 1366 else
1365 if (extLandData.landData == null) 1367 {
1366 { 1368 ILandService landService = m_scene.RequestModuleInterface<ILandService>();
1367 // we didn't find the region/land => don't cache 1369 extLandData.LandData = landService.GetLandData(extLandData.RegionHandle,
1368 return null; 1370 extLandData.X,
1369 } 1371 extLandData.Y);
1370 } 1372 if (extLandData.LandData == null)
1371 return extLandData; 1373 {
1372 }); 1374 // we didn't find the region/land => don't cache
1375 return null;
1376 }
1377 }
1378 return extLandData;
1379 });
1373 1380
1374 if (data != null) // if we found some data, send it 1381 if (data != null) // if we found some data, send it
1375 { 1382 {
1376 RegionInfo info; 1383 GridRegion info;
1377 if (data.regionHandle == m_scene.RegionInfo.RegionHandle) 1384 if (data.RegionHandle == m_scene.RegionInfo.RegionHandle)
1378 { 1385 {
1379 info = m_scene.RegionInfo; 1386 info = new GridRegion(m_scene.RegionInfo);
1380 } 1387 }
1381 else 1388 else
1382 { 1389 {
1383 // most likely still cached from building the extLandData entry 1390 // most likely still cached from building the extLandData entry
1384 info = m_scene.CommsManager.GridService.RequestNeighbourInfo(data.regionHandle); 1391 uint x = 0, y = 0;
1392 Utils.LongToUInts(data.RegionHandle, out x, out y);
1393 info = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
1385 } 1394 }
1386 // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark. 1395 // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark.
1387 m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...", 1396 m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...",
1388 data.landData.Name, data.regionHandle); 1397 data.LandData.Name, data.RegionHandle);
1389 remoteClient.SendParcelInfo(info, data.landData, parcelID, data.x, data.y); 1398 // HACK for now
1399 RegionInfo r = new RegionInfo();
1400 r.RegionName = info.RegionName;
1401 r.RegionLocX = (uint)info.RegionLocX;
1402 r.RegionLocY = (uint)info.RegionLocY;
1403 remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y);
1390 } 1404 }
1391 else 1405 else
1392 m_log.Debug("[LAND] got no parcelinfo; not sending"); 1406 m_log.Debug("[LAND] got no parcelinfo; not sending");
@@ -1405,9 +1419,9 @@ namespace OpenSim.Region.CoreModules.World.Land
1405 if (!m_scene.Permissions.CanEditParcel(remoteClient.AgentId, land)) 1419 if (!m_scene.Permissions.CanEditParcel(remoteClient.AgentId, land))
1406 return; 1420 return;
1407 1421
1408 land.landData.OtherCleanTime = otherCleanTime; 1422 land.LandData.OtherCleanTime = otherCleanTime;
1409 1423
1410 UpdateLandObject(localID, land.landData); 1424 UpdateLandObject(localID, land.LandData);
1411 } 1425 }
1412 } 1426 }
1413} 1427}
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 2701f60..b9b7da5 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Land
53 protected Scene m_scene; 53 protected Scene m_scene;
54 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); 54 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
55 55
56 public bool[,] landBitmap 56 public bool[,] LandBitmap
57 { 57 {
58 get { return m_landBitmap; } 58 get { return m_landBitmap; }
59 set { m_landBitmap = value; } 59 set { m_landBitmap = value; }
@@ -63,14 +63,14 @@ namespace OpenSim.Region.CoreModules.World.Land
63 63
64 #region ILandObject Members 64 #region ILandObject Members
65 65
66 public LandData landData 66 public LandData LandData
67 { 67 {
68 get { return m_landData; } 68 get { return m_landData; }
69 69
70 set { m_landData = value; } 70 set { m_landData = value; }
71 } 71 }
72 72
73 public UUID regionUUID 73 public UUID RegionUUID
74 { 74 {
75 get { return m_scene.RegionInfo.RegionID; } 75 get { return m_scene.RegionInfo.RegionID; }
76 } 76 }
@@ -80,8 +80,8 @@ namespace OpenSim.Region.CoreModules.World.Land
80 public LandObject(UUID owner_id, bool is_group_owned, Scene scene) 80 public LandObject(UUID owner_id, bool is_group_owned, Scene scene)
81 { 81 {
82 m_scene = scene; 82 m_scene = scene;
83 landData.OwnerID = owner_id; 83 LandData.OwnerID = owner_id;
84 landData.IsGroupOwned = is_group_owned; 84 LandData.IsGroupOwned = is_group_owned;
85 } 85 }
86 86
87 #endregion 87 #endregion
@@ -96,11 +96,11 @@ namespace OpenSim.Region.CoreModules.World.Land
96 /// <param name="x"></param> 96 /// <param name="x"></param>
97 /// <param name="y"></param> 97 /// <param name="y"></param>
98 /// <returns>Returns true if the piece of land contains the specified point</returns> 98 /// <returns>Returns true if the piece of land contains the specified point</returns>
99 public bool containsPoint(int x, int y) 99 public bool ContainsPoint(int x, int y)
100 { 100 {
101 if (x >= 0 && y >= 0 && x <= Constants.RegionSize && x <= Constants.RegionSize) 101 if (x >= 0 && y >= 0 && x <= Constants.RegionSize && x <= Constants.RegionSize)
102 { 102 {
103 return (landBitmap[x / 4, y / 4] == true); 103 return (LandBitmap[x / 4, y / 4] == true);
104 } 104 }
105 else 105 else
106 { 106 {
@@ -110,11 +110,11 @@ namespace OpenSim.Region.CoreModules.World.Land
110 110
111 public ILandObject Copy() 111 public ILandObject Copy()
112 { 112 {
113 ILandObject newLand = new LandObject(landData.OwnerID, landData.IsGroupOwned, m_scene); 113 ILandObject newLand = new LandObject(LandData.OwnerID, LandData.IsGroupOwned, m_scene);
114 114
115 //Place all new variables here! 115 //Place all new variables here!
116 newLand.landBitmap = (bool[,]) (landBitmap.Clone()); 116 newLand.LandBitmap = (bool[,]) (LandBitmap.Clone());
117 newLand.landData = landData.Copy(); 117 newLand.LandData = LandData.Copy();
118 118
119 return newLand; 119 return newLand;
120 } 120 }
@@ -122,16 +122,16 @@ namespace OpenSim.Region.CoreModules.World.Land
122 static overrideParcelMaxPrimCountDelegate overrideParcelMaxPrimCount; 122 static overrideParcelMaxPrimCountDelegate overrideParcelMaxPrimCount;
123 static overrideSimulatorMaxPrimCountDelegate overrideSimulatorMaxPrimCount; 123 static overrideSimulatorMaxPrimCountDelegate overrideSimulatorMaxPrimCount;
124 124
125 public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel) 125 public void SetParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel)
126 { 126 {
127 overrideParcelMaxPrimCount = overrideDel; 127 overrideParcelMaxPrimCount = overrideDel;
128 } 128 }
129 public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) 129 public void SetSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
130 { 130 {
131 overrideSimulatorMaxPrimCount = overrideDel; 131 overrideSimulatorMaxPrimCount = overrideDel;
132 } 132 }
133 133
134 public int getParcelMaxPrimCount(ILandObject thisObject) 134 public int GetParcelMaxPrimCount(ILandObject thisObject)
135 { 135 {
136 if (overrideParcelMaxPrimCount != null) 136 if (overrideParcelMaxPrimCount != null)
137 { 137 {
@@ -141,11 +141,11 @@ namespace OpenSim.Region.CoreModules.World.Land
141 { 141 {
142 //Normal Calculations 142 //Normal Calculations
143 return Convert.ToInt32( 143 return Convert.ToInt32(
144 Math.Round((Convert.ToDecimal(landData.Area) / Convert.ToDecimal(65536)) * m_scene.objectCapacity * 144 Math.Round((Convert.ToDecimal(LandData.Area) / Convert.ToDecimal(65536)) * m_scene.objectCapacity *
145 Convert.ToDecimal(m_scene.RegionInfo.RegionSettings.ObjectBonus))); ; 145 Convert.ToDecimal(m_scene.RegionInfo.RegionSettings.ObjectBonus))); ;
146 } 146 }
147 } 147 }
148 public int getSimulatorMaxPrimCount(ILandObject thisObject) 148 public int GetSimulatorMaxPrimCount(ILandObject thisObject)
149 { 149 {
150 if (overrideSimulatorMaxPrimCount != null) 150 if (overrideSimulatorMaxPrimCount != null)
151 { 151 {
@@ -161,7 +161,7 @@ namespace OpenSim.Region.CoreModules.World.Land
161 161
162 #region Packet Request Handling 162 #region Packet Request Handling
163 163
164 public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) 164 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client)
165 { 165 {
166 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); 166 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>();
167 uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome)); 167 uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome));
@@ -175,18 +175,18 @@ namespace OpenSim.Region.CoreModules.World.Land
175// if (landData.OwnerID == remote_client.AgentId) 175// if (landData.OwnerID == remote_client.AgentId)
176// regionFlags |= (uint)RegionFlags.AllowSetHome; 176// regionFlags |= (uint)RegionFlags.AllowSetHome;
177 remote_client.SendLandProperties(sequence_id, 177 remote_client.SendLandProperties(sequence_id,
178 snap_selection, request_result, landData, 178 snap_selection, request_result, LandData,
179 (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, 179 (float)m_scene.RegionInfo.RegionSettings.ObjectBonus,
180 getParcelMaxPrimCount(this), 180 GetParcelMaxPrimCount(this),
181 getSimulatorMaxPrimCount(this), regionFlags); 181 GetSimulatorMaxPrimCount(this), regionFlags);
182 } 182 }
183 183
184 public void updateLandProperties(LandUpdateArgs args, IClientAPI remote_client) 184 public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client)
185 { 185 {
186 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this)) 186 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this))
187 { 187 {
188 //Needs later group support 188 //Needs later group support
189 LandData newData = landData.Copy(); 189 LandData newData = LandData.Copy();
190 190
191 if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice) 191 if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice)
192 { 192 {
@@ -212,15 +212,15 @@ namespace OpenSim.Region.CoreModules.World.Land
212 newData.UserLocation = args.UserLocation; 212 newData.UserLocation = args.UserLocation;
213 newData.UserLookAt = args.UserLookAt; 213 newData.UserLookAt = args.UserLookAt;
214 214
215 m_scene.LandChannel.UpdateLandObject(landData.LocalID, newData); 215 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
216 216
217 sendLandUpdateToAvatarsOverMe(); 217 SendLandUpdateToAvatarsOverMe();
218 } 218 }
219 } 219 }
220 220
221 public void updateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) 221 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area)
222 { 222 {
223 LandData newData = landData.Copy(); 223 LandData newData = LandData.Copy();
224 newData.OwnerID = avatarID; 224 newData.OwnerID = avatarID;
225 newData.GroupID = groupID; 225 newData.GroupID = groupID;
226 newData.IsGroupOwned = groupOwned; 226 newData.IsGroupOwned = groupOwned;
@@ -230,45 +230,45 @@ namespace OpenSim.Region.CoreModules.World.Land
230 newData.SalePrice = 0; 230 newData.SalePrice = 0;
231 newData.AuthBuyerID = UUID.Zero; 231 newData.AuthBuyerID = UUID.Zero;
232 newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects); 232 newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects);
233 m_scene.LandChannel.UpdateLandObject(landData.LocalID, newData); 233 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
234 234
235 sendLandUpdateToAvatarsOverMe(); 235 SendLandUpdateToAvatarsOverMe();
236 } 236 }
237 237
238 public void deedToGroup(UUID groupID) 238 public void DeedToGroup(UUID groupID)
239 { 239 {
240 LandData newData = landData.Copy(); 240 LandData newData = LandData.Copy();
241 newData.OwnerID = groupID; 241 newData.OwnerID = groupID;
242 newData.GroupID = groupID; 242 newData.GroupID = groupID;
243 newData.IsGroupOwned = true; 243 newData.IsGroupOwned = true;
244 244
245 m_scene.LandChannel.UpdateLandObject(landData.LocalID, newData); 245 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
246 246
247 sendLandUpdateToAvatarsOverMe(); 247 SendLandUpdateToAvatarsOverMe();
248 } 248 }
249 249
250 public bool isEitherBannedOrRestricted(UUID avatar) 250 public bool IsEitherBannedOrRestricted(UUID avatar)
251 { 251 {
252 if (isBannedFromLand(avatar)) 252 if (IsBannedFromLand(avatar))
253 { 253 {
254 return true; 254 return true;
255 } 255 }
256 else if (isRestrictedFromLand(avatar)) 256 else if (IsRestrictedFromLand(avatar))
257 { 257 {
258 return true; 258 return true;
259 } 259 }
260 return false; 260 return false;
261 } 261 }
262 262
263 public bool isBannedFromLand(UUID avatar) 263 public bool IsBannedFromLand(UUID avatar)
264 { 264 {
265 if ((landData.Flags & (uint) ParcelFlags.UseBanList) > 0) 265 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0)
266 { 266 {
267 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 267 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
268 entry.AgentID = avatar; 268 entry.AgentID = avatar;
269 entry.Flags = AccessList.Ban; 269 entry.Flags = AccessList.Ban;
270 entry.Time = new DateTime(); 270 entry.Time = new DateTime();
271 if (landData.ParcelAccessList.Contains(entry)) 271 if (LandData.ParcelAccessList.Contains(entry))
272 { 272 {
273 //They are banned, so lets send them a notice about this parcel 273 //They are banned, so lets send them a notice about this parcel
274 return true; 274 return true;
@@ -277,15 +277,15 @@ namespace OpenSim.Region.CoreModules.World.Land
277 return false; 277 return false;
278 } 278 }
279 279
280 public bool isRestrictedFromLand(UUID avatar) 280 public bool IsRestrictedFromLand(UUID avatar)
281 { 281 {
282 if ((landData.Flags & (uint) ParcelFlags.UseAccessList) > 0) 282 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
283 { 283 {
284 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 284 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
285 entry.AgentID = avatar; 285 entry.AgentID = avatar;
286 entry.Flags = AccessList.Access; 286 entry.Flags = AccessList.Access;
287 entry.Time = new DateTime(); 287 entry.Time = new DateTime();
288 if (!landData.ParcelAccessList.Contains(entry)) 288 if (!LandData.ParcelAccessList.Contains(entry))
289 { 289 {
290 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel 290 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
291 return true; 291 return true;
@@ -294,12 +294,12 @@ namespace OpenSim.Region.CoreModules.World.Land
294 return false; 294 return false;
295 } 295 }
296 296
297 public void sendLandUpdateToClient(IClientAPI remote_client) 297 public void SendLandUpdateToClient(IClientAPI remote_client)
298 { 298 {
299 sendLandProperties(0, false, 0, remote_client); 299 SendLandProperties(0, false, 0, remote_client);
300 } 300 }
301 301
302 public void sendLandUpdateToAvatarsOverMe() 302 public void SendLandUpdateToAvatarsOverMe()
303 { 303 {
304 List<ScenePresence> avatars = m_scene.GetAvatars(); 304 List<ScenePresence> avatars = m_scene.GetAvatars();
305 ILandObject over = null; 305 ILandObject over = null;
@@ -319,14 +319,15 @@ namespace OpenSim.Region.CoreModules.World.Land
319 319
320 if (over != null) 320 if (over != null)
321 { 321 {
322 if (over.landData.LocalID == landData.LocalID) 322 if (over.LandData.LocalID == LandData.LocalID)
323 { 323 {
324 if (((over.landData.Flags & (uint)ParcelFlags.AllowDamage) != 0) && m_scene.RegionInfo.RegionSettings.AllowDamage) 324 if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) &&
325 m_scene.RegionInfo.RegionSettings.AllowDamage)
325 avatars[i].Invulnerable = false; 326 avatars[i].Invulnerable = false;
326 else 327 else
327 avatars[i].Invulnerable = true; 328 avatars[i].Invulnerable = true;
328 329
329 sendLandUpdateToClient(avatars[i].ControllingClient); 330 SendLandUpdateToClient(avatars[i].ControllingClient);
330 } 331 }
331 } 332 }
332 } 333 }
@@ -336,10 +337,10 @@ namespace OpenSim.Region.CoreModules.World.Land
336 337
337 #region AccessList Functions 338 #region AccessList Functions
338 339
339 public List<UUID> createAccessListArrayByFlag(AccessList flag) 340 public List<UUID> CreateAccessListArrayByFlag(AccessList flag)
340 { 341 {
341 List<UUID> list = new List<UUID>(); 342 List<UUID> list = new List<UUID>();
342 foreach (ParcelManager.ParcelAccessEntry entry in landData.ParcelAccessList) 343 foreach (ParcelManager.ParcelAccessEntry entry in LandData.ParcelAccessList)
343 { 344 {
344 if (entry.Flags == flag) 345 if (entry.Flags == flag)
345 { 346 {
@@ -354,26 +355,26 @@ namespace OpenSim.Region.CoreModules.World.Land
354 return list; 355 return list;
355 } 356 }
356 357
357 public void sendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, 358 public void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID,
358 IClientAPI remote_client) 359 IClientAPI remote_client)
359 { 360 {
360 361
361 if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both) 362 if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both)
362 { 363 {
363 List<UUID> avatars = createAccessListArrayByFlag(AccessList.Access); 364 List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Access);
364 remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,landData.LocalID); 365 remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,LandData.LocalID);
365 } 366 }
366 367
367 if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both) 368 if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both)
368 { 369 {
369 List<UUID> avatars = createAccessListArrayByFlag(AccessList.Ban); 370 List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Ban);
370 remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, landData.LocalID); 371 remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, LandData.LocalID);
371 } 372 }
372 } 373 }
373 374
374 public void updateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) 375 public void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client)
375 { 376 {
376 LandData newData = landData.Copy(); 377 LandData newData = LandData.Copy();
377 378
378 if (entries.Count == 1 && entries[0].AgentID == UUID.Zero) 379 if (entries.Count == 1 && entries[0].AgentID == UUID.Zero)
379 { 380 {
@@ -406,36 +407,36 @@ namespace OpenSim.Region.CoreModules.World.Land
406 } 407 }
407 } 408 }
408 409
409 m_scene.LandChannel.UpdateLandObject(landData.LocalID, newData); 410 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
410 } 411 }
411 412
412 #endregion 413 #endregion
413 414
414 #region Update Functions 415 #region Update Functions
415 416
416 public void updateLandBitmapByteArray() 417 public void UpdateLandBitmapByteArray()
417 { 418 {
418 landData.Bitmap = convertLandBitmapToBytes(); 419 LandData.Bitmap = ConvertLandBitmapToBytes();
419 } 420 }
420 421
421 /// <summary> 422 /// <summary>
422 /// Update all settings in land such as area, bitmap byte array, etc 423 /// Update all settings in land such as area, bitmap byte array, etc
423 /// </summary> 424 /// </summary>
424 public void forceUpdateLandInfo() 425 public void ForceUpdateLandInfo()
425 { 426 {
426 updateAABBAndAreaValues(); 427 UpdateAABBAndAreaValues();
427 updateLandBitmapByteArray(); 428 UpdateLandBitmapByteArray();
428 } 429 }
429 430
430 public void setLandBitmapFromByteArray() 431 public void SetLandBitmapFromByteArray()
431 { 432 {
432 landBitmap = convertBytesToLandBitmap(); 433 LandBitmap = ConvertBytesToLandBitmap();
433 } 434 }
434 435
435 /// <summary> 436 /// <summary>
436 /// Updates the AABBMin and AABBMax values after area/shape modification of the land object 437 /// Updates the AABBMin and AABBMax values after area/shape modification of the land object
437 /// </summary> 438 /// </summary>
438 private void updateAABBAndAreaValues() 439 private void UpdateAABBAndAreaValues()
439 { 440 {
440 int min_x = 64; 441 int min_x = 64;
441 int min_y = 64; 442 int min_y = 64;
@@ -447,7 +448,7 @@ namespace OpenSim.Region.CoreModules.World.Land
447 { 448 {
448 for (y = 0; y < 64; y++) 449 for (y = 0; y < 64; y++)
449 { 450 {
450 if (landBitmap[x, y] == true) 451 if (LandBitmap[x, y] == true)
451 { 452 {
452 if (min_x > x) min_x = x; 453 if (min_x > x) min_x = x;
453 if (min_y > y) min_y = y; 454 if (min_y > y) min_y = y;
@@ -463,7 +464,7 @@ namespace OpenSim.Region.CoreModules.World.Land
463 int ty = min_y * 4; 464 int ty = min_y * 4;
464 if (ty > ((int)Constants.RegionSize - 1)) 465 if (ty > ((int)Constants.RegionSize - 1))
465 ty = ((int)Constants.RegionSize - 1); 466 ty = ((int)Constants.RegionSize - 1);
466 landData.AABBMin = 467 LandData.AABBMin =
467 new Vector3((float) (min_x * 4), (float) (min_y * 4), 468 new Vector3((float) (min_x * 4), (float) (min_y * 4),
468 (float) m_scene.Heightmap[tx, ty]); 469 (float) m_scene.Heightmap[tx, ty]);
469 470
@@ -473,10 +474,10 @@ namespace OpenSim.Region.CoreModules.World.Land
473 ty = max_y * 4; 474 ty = max_y * 4;
474 if (ty > ((int)Constants.RegionSize - 1)) 475 if (ty > ((int)Constants.RegionSize - 1))
475 ty = ((int)Constants.RegionSize - 1); 476 ty = ((int)Constants.RegionSize - 1);
476 landData.AABBMax = 477 LandData.AABBMax =
477 new Vector3((float) (max_x * 4), (float) (max_y * 4), 478 new Vector3((float) (max_x * 4), (float) (max_y * 4),
478 (float) m_scene.Heightmap[tx, ty]); 479 (float) m_scene.Heightmap[tx, ty]);
479 landData.Area = tempArea; 480 LandData.Area = tempArea;
480 } 481 }
481 482
482 #endregion 483 #endregion
@@ -487,7 +488,7 @@ namespace OpenSim.Region.CoreModules.World.Land
487 /// Sets the land's bitmap manually 488 /// Sets the land's bitmap manually
488 /// </summary> 489 /// </summary>
489 /// <param name="bitmap">64x64 block representing where this land is on a map</param> 490 /// <param name="bitmap">64x64 block representing where this land is on a map</param>
490 public void setLandBitmap(bool[,] bitmap) 491 public void SetLandBitmap(bool[,] bitmap)
491 { 492 {
492 if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) 493 if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2)
493 { 494 {
@@ -497,8 +498,8 @@ namespace OpenSim.Region.CoreModules.World.Land
497 else 498 else
498 { 499 {
499 //Valid: Lets set it 500 //Valid: Lets set it
500 landBitmap = bitmap; 501 LandBitmap = bitmap;
501 forceUpdateLandInfo(); 502 ForceUpdateLandInfo();
502 } 503 }
503 } 504 }
504 505
@@ -506,18 +507,18 @@ namespace OpenSim.Region.CoreModules.World.Land
506 /// Gets the land's bitmap manually 507 /// Gets the land's bitmap manually
507 /// </summary> 508 /// </summary>
508 /// <returns></returns> 509 /// <returns></returns>
509 public bool[,] getLandBitmap() 510 public bool[,] GetLandBitmap()
510 { 511 {
511 return landBitmap; 512 return LandBitmap;
512 } 513 }
513 514
514 /// <summary> 515 /// <summary>
515 /// Full sim land object creation 516 /// Full sim land object creation
516 /// </summary> 517 /// </summary>
517 /// <returns></returns> 518 /// <returns></returns>
518 public bool[,] basicFullRegionLandBitmap() 519 public bool[,] BasicFullRegionLandBitmap()
519 { 520 {
520 return getSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); 521 return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize);
521 } 522 }
522 523
523 /// <summary> 524 /// <summary>
@@ -528,12 +529,12 @@ namespace OpenSim.Region.CoreModules.World.Land
528 /// <param name="end_x"></param> 529 /// <param name="end_x"></param>
529 /// <param name="end_y"></param> 530 /// <param name="end_y"></param>
530 /// <returns></returns> 531 /// <returns></returns>
531 public bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) 532 public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y)
532 { 533 {
533 bool[,] tempBitmap = new bool[64,64]; 534 bool[,] tempBitmap = new bool[64,64];
534 tempBitmap.Initialize(); 535 tempBitmap.Initialize();
535 536
536 tempBitmap = modifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); 537 tempBitmap = ModifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true);
537 return tempBitmap; 538 return tempBitmap;
538 } 539 }
539 540
@@ -547,7 +548,7 @@ namespace OpenSim.Region.CoreModules.World.Land
547 /// <param name="end_y"></param> 548 /// <param name="end_y"></param>
548 /// <param name="set_value"></param> 549 /// <param name="set_value"></param>
549 /// <returns></returns> 550 /// <returns></returns>
550 public bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, 551 public bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y,
551 bool set_value) 552 bool set_value)
552 { 553 {
553 if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2) 554 if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2)
@@ -577,7 +578,7 @@ namespace OpenSim.Region.CoreModules.World.Land
577 /// <param name="bitmap_base"></param> 578 /// <param name="bitmap_base"></param>
578 /// <param name="bitmap_add"></param> 579 /// <param name="bitmap_add"></param>
579 /// <returns></returns> 580 /// <returns></returns>
580 public bool[,] mergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) 581 public bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add)
581 { 582 {
582 if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) 583 if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2)
583 { 584 {
@@ -608,7 +609,7 @@ namespace OpenSim.Region.CoreModules.World.Land
608 /// Converts the land bitmap to a packet friendly byte array 609 /// Converts the land bitmap to a packet friendly byte array
609 /// </summary> 610 /// </summary>
610 /// <returns></returns> 611 /// <returns></returns>
611 private byte[] convertLandBitmapToBytes() 612 private byte[] ConvertLandBitmapToBytes()
612 { 613 {
613 byte[] tempConvertArr = new byte[512]; 614 byte[] tempConvertArr = new byte[512];
614 byte tempByte = 0; 615 byte tempByte = 0;
@@ -618,7 +619,7 @@ namespace OpenSim.Region.CoreModules.World.Land
618 { 619 {
619 for (x = 0; x < 64; x++) 620 for (x = 0; x < 64; x++)
620 { 621 {
621 tempByte = Convert.ToByte(tempByte | Convert.ToByte(landBitmap[x, y]) << (i++ % 8)); 622 tempByte = Convert.ToByte(tempByte | Convert.ToByte(LandBitmap[x, y]) << (i++ % 8));
622 if (i % 8 == 0) 623 if (i % 8 == 0)
623 { 624 {
624 tempConvertArr[byteNum] = tempByte; 625 tempConvertArr[byteNum] = tempByte;
@@ -631,7 +632,7 @@ namespace OpenSim.Region.CoreModules.World.Land
631 return tempConvertArr; 632 return tempConvertArr;
632 } 633 }
633 634
634 private bool[,] convertBytesToLandBitmap() 635 private bool[,] ConvertBytesToLandBitmap()
635 { 636 {
636 bool[,] tempConvertMap = new bool[landArrayMax, landArrayMax]; 637 bool[,] tempConvertMap = new bool[landArrayMax, landArrayMax];
637 tempConvertMap.Initialize(); 638 tempConvertMap.Initialize();
@@ -639,7 +640,7 @@ namespace OpenSim.Region.CoreModules.World.Land
639 int x = 0, y = 0, i = 0, bitNum = 0; 640 int x = 0, y = 0, i = 0, bitNum = 0;
640 for (i = 0; i < 512; i++) 641 for (i = 0; i < 512; i++)
641 { 642 {
642 tempByte = landData.Bitmap[i]; 643 tempByte = LandData.Bitmap[i];
643 for (bitNum = 0; bitNum < 8; bitNum++) 644 for (bitNum = 0; bitNum < 8; bitNum++)
644 { 645 {
645 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1); 646 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1);
@@ -659,7 +660,7 @@ namespace OpenSim.Region.CoreModules.World.Land
659 660
660 #region Object Select and Object Owner Listing 661 #region Object Select and Object Owner Listing
661 662
662 public void sendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) 663 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client)
663 { 664 {
664 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) 665 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this))
665 { 666 {
@@ -672,11 +673,11 @@ namespace OpenSim.Region.CoreModules.World.Land
672 { 673 {
673 if (obj.LocalId > 0) 674 if (obj.LocalId > 0)
674 { 675 {
675 if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == landData.OwnerID) 676 if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == LandData.OwnerID)
676 { 677 {
677 resultLocalIDs.Add(obj.LocalId); 678 resultLocalIDs.Add(obj.LocalId);
678 } 679 }
679 else if (request_type == LandChannel.LAND_SELECT_OBJECTS_GROUP && obj.GroupID == landData.GroupID && landData.GroupID != UUID.Zero) 680 else if (request_type == LandChannel.LAND_SELECT_OBJECTS_GROUP && obj.GroupID == LandData.GroupID && LandData.GroupID != UUID.Zero)
680 { 681 {
681 resultLocalIDs.Add(obj.LocalId); 682 resultLocalIDs.Add(obj.LocalId);
682 } 683 }
@@ -709,7 +710,7 @@ namespace OpenSim.Region.CoreModules.World.Land
709 /// <param name="remote_client"> 710 /// <param name="remote_client">
710 /// A <see cref="IClientAPI"/> 711 /// A <see cref="IClientAPI"/>
711 /// </param> 712 /// </param>
712 public void sendLandObjectOwners(IClientAPI remote_client) 713 public void SendLandObjectOwners(IClientAPI remote_client)
713 { 714 {
714 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) 715 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this))
715 { 716 {
@@ -752,11 +753,11 @@ namespace OpenSim.Region.CoreModules.World.Land
752 } 753 }
753 } 754 }
754 755
755 remote_client.SendLandObjectOwners(landData, groups, primCount); 756 remote_client.SendLandObjectOwners(LandData, groups, primCount);
756 } 757 }
757 } 758 }
758 759
759 public Dictionary<UUID, int> getLandObjectOwners() 760 public Dictionary<UUID, int> GetLandObjectOwners()
760 { 761 {
761 Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>(); 762 Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>();
762 lock (primsOverMe) 763 lock (primsOverMe)
@@ -786,14 +787,14 @@ namespace OpenSim.Region.CoreModules.World.Land
786 787
787 #region Object Returning 788 #region Object Returning
788 789
789 public void returnObject(SceneObjectGroup obj) 790 public void ReturnObject(SceneObjectGroup obj)
790 { 791 {
791 SceneObjectGroup[] objs = new SceneObjectGroup[1]; 792 SceneObjectGroup[] objs = new SceneObjectGroup[1];
792 objs[0] = obj; 793 objs[0] = obj;
793 m_scene.returnObjects(objs, obj.OwnerID); 794 m_scene.returnObjects(objs, obj.OwnerID);
794 } 795 }
795 796
796 public void returnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client) 797 public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client)
797 { 798 {
798 Dictionary<UUID,List<SceneObjectGroup>> returns = 799 Dictionary<UUID,List<SceneObjectGroup>> returns =
799 new Dictionary<UUID,List<SceneObjectGroup>>(); 800 new Dictionary<UUID,List<SceneObjectGroup>>();
@@ -869,19 +870,19 @@ namespace OpenSim.Region.CoreModules.World.Land
869 870
870 #region Object Adding/Removing from Parcel 871 #region Object Adding/Removing from Parcel
871 872
872 public void resetLandPrimCounts() 873 public void ResetLandPrimCounts()
873 { 874 {
874 landData.GroupPrims = 0; 875 LandData.GroupPrims = 0;
875 landData.OwnerPrims = 0; 876 LandData.OwnerPrims = 0;
876 landData.OtherPrims = 0; 877 LandData.OtherPrims = 0;
877 landData.SelectedPrims = 0; 878 LandData.SelectedPrims = 0;
878 879
879 880
880 lock (primsOverMe) 881 lock (primsOverMe)
881 primsOverMe.Clear(); 882 primsOverMe.Clear();
882 } 883 }
883 884
884 public void addPrimToCount(SceneObjectGroup obj) 885 public void AddPrimToCount(SceneObjectGroup obj)
885 { 886 {
886 887
887 UUID prim_owner = obj.OwnerID; 888 UUID prim_owner = obj.OwnerID;
@@ -889,23 +890,23 @@ namespace OpenSim.Region.CoreModules.World.Land
889 890
890 if (obj.IsSelected) 891 if (obj.IsSelected)
891 { 892 {
892 landData.SelectedPrims += prim_count; 893 LandData.SelectedPrims += prim_count;
893 } 894 }
894 else 895 else
895 { 896 {
896 if (prim_owner == landData.OwnerID) 897 if (prim_owner == LandData.OwnerID)
897 { 898 {
898 landData.OwnerPrims += prim_count; 899 LandData.OwnerPrims += prim_count;
899 } 900 }
900 else if ((obj.GroupID == landData.GroupID || 901 else if ((obj.GroupID == LandData.GroupID ||
901 prim_owner == landData.GroupID) && 902 prim_owner == LandData.GroupID) &&
902 landData.GroupID != UUID.Zero) 903 LandData.GroupID != UUID.Zero)
903 { 904 {
904 landData.GroupPrims += prim_count; 905 LandData.GroupPrims += prim_count;
905 } 906 }
906 else 907 else
907 { 908 {
908 landData.OtherPrims += prim_count; 909 LandData.OtherPrims += prim_count;
909 } 910 }
910 } 911 }
911 912
@@ -913,7 +914,7 @@ namespace OpenSim.Region.CoreModules.World.Land
913 primsOverMe.Add(obj); 914 primsOverMe.Add(obj);
914 } 915 }
915 916
916 public void removePrimFromCount(SceneObjectGroup obj) 917 public void RemovePrimFromCount(SceneObjectGroup obj)
917 { 918 {
918 lock (primsOverMe) 919 lock (primsOverMe)
919 { 920 {
@@ -922,18 +923,18 @@ namespace OpenSim.Region.CoreModules.World.Land
922 UUID prim_owner = obj.OwnerID; 923 UUID prim_owner = obj.OwnerID;
923 int prim_count = obj.PrimCount; 924 int prim_count = obj.PrimCount;
924 925
925 if (prim_owner == landData.OwnerID) 926 if (prim_owner == LandData.OwnerID)
926 { 927 {
927 landData.OwnerPrims -= prim_count; 928 LandData.OwnerPrims -= prim_count;
928 } 929 }
929 else if (obj.GroupID == landData.GroupID || 930 else if (obj.GroupID == LandData.GroupID ||
930 prim_owner == landData.GroupID) 931 prim_owner == LandData.GroupID)
931 { 932 {
932 landData.GroupPrims -= prim_count; 933 LandData.GroupPrims -= prim_count;
933 } 934 }
934 else 935 else
935 { 936 {
936 landData.OtherPrims -= prim_count; 937 LandData.OtherPrims -= prim_count;
937 } 938 }
938 939
939 primsOverMe.Remove(obj); 940 primsOverMe.Remove(obj);
@@ -953,8 +954,8 @@ namespace OpenSim.Region.CoreModules.World.Land
953 /// <param name="url"></param> 954 /// <param name="url"></param>
954 public void SetMediaUrl(string url) 955 public void SetMediaUrl(string url)
955 { 956 {
956 landData.MediaURL = url; 957 LandData.MediaURL = url;
957 sendLandUpdateToAvatarsOverMe(); 958 SendLandUpdateToAvatarsOverMe();
958 } 959 }
959 960
960 /// <summary> 961 /// <summary>
@@ -963,8 +964,8 @@ namespace OpenSim.Region.CoreModules.World.Land
963 /// <param name="url"></param> 964 /// <param name="url"></param>
964 public void SetMusicUrl(string url) 965 public void SetMusicUrl(string url)
965 { 966 {
966 landData.MusicURL = url; 967 LandData.MusicURL = url;
967 sendLandUpdateToAvatarsOverMe(); 968 SendLandUpdateToAvatarsOverMe();
968 } 969 }
969 } 970 }
970} 971}
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
index 65f22b1..2cbaf96 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
@@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.World.Land
85 private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart, 85 private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart,
86 UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem, 86 UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem,
87 UUID fromtaskid) 87 UUID fromtaskid)
88 { 88 {
89 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX; 89 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
90 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY; 90 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
91 rayend.X += differenceX * (int)Constants.RegionSize; 91 rayend.X += differenceX * (int)Constants.RegionSize;
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
index 9e46b94..7df836c 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
@@ -85,7 +85,7 @@ public class RegionCombinerLargeLandChannel : ILandChannel
85 } 85 }
86 } 86 }
87 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); 87 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
88 obj.landData.Name = "NO LAND"; 88 obj.LandData.Name = "NO LAND";
89 return obj; 89 return obj;
90 } 90 }
91 } 91 }
@@ -118,7 +118,7 @@ public class RegionCombinerLargeLandChannel : ILandChannel
118 } 118 }
119 } 119 }
120 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); 120 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
121 obj.landData.Name = "NO LAND"; 121 obj.LandData.Name = "NO LAND";
122 return obj; 122 return obj;
123 } 123 }
124 } 124 }
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
index 1436912..05d19a2 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
@@ -35,6 +35,7 @@ using OpenSim.Framework;
35using OpenSim.Framework.Client; 35using OpenSim.Framework.Client;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Framework.Console;
38 39
39namespace OpenSim.Region.CoreModules.World.Land 40namespace OpenSim.Region.CoreModules.World.Land
40{ 41{
@@ -61,7 +62,10 @@ namespace OpenSim.Region.CoreModules.World.Land
61 IConfig myConfig = source.Configs["Startup"]; 62 IConfig myConfig = source.Configs["Startup"];
62 enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false); 63 enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false);
63 //enabledYN = true; 64 //enabledYN = true;
64 } 65 if (enabledYN)
66 MainConsole.Instance.Commands.AddCommand("RegionCombinerModule", false, "fix-phantoms",
67 "Fix phantom objects", "Fixes phantom objects after an import to megaregions", FixPhantoms);
68 }
65 69
66 public void Close() 70 public void Close()
67 { 71 {
@@ -79,12 +83,12 @@ namespace OpenSim.Region.CoreModules.World.Land
79 { 83 {
80 if (!enabledYN) 84 if (!enabledYN)
81 return; 85 return;
82 86/*
83 // For testing on a single instance 87 // For testing on a single instance
84 if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000) 88 if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000)
85 return; 89 return;
86 // 90 //
87 91*/
88 lock (m_startingScenes) 92 lock (m_startingScenes)
89 m_startingScenes.Add(scene.RegionInfo.originRegionID, scene); 93 m_startingScenes.Add(scene.RegionInfo.originRegionID, scene);
90 94
@@ -504,7 +508,7 @@ namespace OpenSim.Region.CoreModules.World.Land
504 scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY; 508 scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
505 } 509 }
506 510
507 /* 511 /*
508 else 512 else
509 { 513 {
510 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; 514 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
@@ -876,7 +880,7 @@ namespace OpenSim.Region.CoreModules.World.Land
876 VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject; 880 VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject;
877 VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED 881 VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED
878 VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED 882 VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED
879 VirtualRegion.Permissions.OnEditParcel += BigRegion.PermissionModule.CanEditParcel; //MAYBE FULLY IMPLEMENTED 883 VirtualRegion.Permissions.OnEditParcel += BigRegion.PermissionModule.CanEditParcel; //MAYBE FULLY IMPLEMENTED
880 VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage; 884 VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage;
881 VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED 885 VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED
882 VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED 886 VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED
@@ -895,11 +899,11 @@ namespace OpenSim.Region.CoreModules.World.Land
895 VirtualRegion.Permissions.OnDelinkObject += BigRegion.PermissionModule.CanDelinkObject; //NOT YET IMPLEMENTED 899 VirtualRegion.Permissions.OnDelinkObject += BigRegion.PermissionModule.CanDelinkObject; //NOT YET IMPLEMENTED
896 VirtualRegion.Permissions.OnBuyLand += BigRegion.PermissionModule.CanBuyLand; //NOT YET IMPLEMENTED 900 VirtualRegion.Permissions.OnBuyLand += BigRegion.PermissionModule.CanBuyLand; //NOT YET IMPLEMENTED
897 VirtualRegion.Permissions.OnViewNotecard += BigRegion.PermissionModule.CanViewNotecard; //NOT YET IMPLEMENTED 901 VirtualRegion.Permissions.OnViewNotecard += BigRegion.PermissionModule.CanViewNotecard; //NOT YET IMPLEMENTED
898 VirtualRegion.Permissions.OnViewScript += BigRegion.PermissionModule.CanViewScript; //NOT YET IMPLEMENTED 902 VirtualRegion.Permissions.OnViewScript += BigRegion.PermissionModule.CanViewScript; //NOT YET IMPLEMENTED
899 VirtualRegion.Permissions.OnEditNotecard += BigRegion.PermissionModule.CanEditNotecard; //NOT YET IMPLEMENTED 903 VirtualRegion.Permissions.OnEditNotecard += BigRegion.PermissionModule.CanEditNotecard; //NOT YET IMPLEMENTED
900 VirtualRegion.Permissions.OnEditScript += BigRegion.PermissionModule.CanEditScript; //NOT YET IMPLEMENTED 904 VirtualRegion.Permissions.OnEditScript += BigRegion.PermissionModule.CanEditScript; //NOT YET IMPLEMENTED
901 VirtualRegion.Permissions.OnCreateObjectInventory += BigRegion.PermissionModule.CanCreateObjectInventory; //NOT IMPLEMENTED HERE 905 VirtualRegion.Permissions.OnCreateObjectInventory += BigRegion.PermissionModule.CanCreateObjectInventory; //NOT IMPLEMENTED HERE
902 VirtualRegion.Permissions.OnEditObjectInventory += BigRegion.PermissionModule.CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED 906 VirtualRegion.Permissions.OnEditObjectInventory += BigRegion.PermissionModule.CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
903 VirtualRegion.Permissions.OnCopyObjectInventory += BigRegion.PermissionModule.CanCopyObjectInventory; //NOT YET IMPLEMENTED 907 VirtualRegion.Permissions.OnCopyObjectInventory += BigRegion.PermissionModule.CanCopyObjectInventory; //NOT YET IMPLEMENTED
904 VirtualRegion.Permissions.OnDeleteObjectInventory += BigRegion.PermissionModule.CanDeleteObjectInventory; //NOT YET IMPLEMENTED 908 VirtualRegion.Permissions.OnDeleteObjectInventory += BigRegion.PermissionModule.CanDeleteObjectInventory; //NOT YET IMPLEMENTED
905 VirtualRegion.Permissions.OnResetScript += BigRegion.PermissionModule.CanResetScript; 909 VirtualRegion.Permissions.OnResetScript += BigRegion.PermissionModule.CanResetScript;
@@ -910,5 +914,20 @@ namespace OpenSim.Region.CoreModules.World.Land
910 VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED 914 VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED
911 VirtualRegion.Permissions.OnUseObjectReturn += BigRegion.PermissionModule.CanUseObjectReturn; //NOT YET IMPLEMENTED 915 VirtualRegion.Permissions.OnUseObjectReturn += BigRegion.PermissionModule.CanUseObjectReturn; //NOT YET IMPLEMENTED
912 } 916 }
917
918 #region console commands
919 public void FixPhantoms(string module, string[] cmdparams)
920 {
921 List<Scene> scenes = new List<Scene>(m_startingScenes.Values);
922 foreach (Scene s in scenes)
923 {
924 s.ForEachSOG(delegate(SceneObjectGroup e)
925 {
926 e.AbsolutePosition = e.AbsolutePosition;
927 }
928 );
929 }
930 }
931 #endregion
913 } 932 }
914} 933}
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index f360577..9622555 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -103,7 +103,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
103 //private uint PERM_MODIFY = (uint)16384; 103 //private uint PERM_MODIFY = (uint)16384;
104 private uint PERM_MOVE = (uint)524288; 104 private uint PERM_MOVE = (uint)524288;
105 private uint PERM_TRANS = (uint)8192; 105 private uint PERM_TRANS = (uint)8192;
106 private uint PERM_LOCKED = (uint)540672; 106 private uint PERM_LOCKED = (uint)540672;
107 107
108 /// <value> 108 /// <value>
109 /// Different user set names that come in from the configuration file. 109 /// Different user set names that come in from the configuration file.
@@ -114,7 +114,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
114 Administrators 114 Administrators
115 }; 115 };
116 116
117 #endregion 117 #endregion
118 118
119 #region Bypass Permissions / Debug Permissions Stuff 119 #region Bypass Permissions / Debug Permissions Stuff
120 120
@@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
136 /// <value> 136 /// <value>
137 /// The set of users that are allowed to edit (save) scripts. This is only active if 137 /// The set of users that are allowed to edit (save) scripts. This is only active if
138 /// permissions are not being bypassed. This overrides normal permissions.- 138 /// permissions are not being bypassed. This overrides normal permissions.-
139 /// </value> 139 /// </value>
140 private UserSet m_allowedScriptEditors = UserSet.All; 140 private UserSet m_allowedScriptEditors = UserSet.All;
141 141
142 private Dictionary<string, bool> GrantLSL = new Dictionary<string, bool>(); 142 private Dictionary<string, bool> GrantLSL = new Dictionary<string, bool>();
@@ -190,7 +190,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
190 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; 190 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
191 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED 191 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED
192 m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED 192 m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED
193 m_scene.Permissions.OnEditParcel += CanEditParcel; //MAYBE FULLY IMPLEMENTED 193 m_scene.Permissions.OnEditParcel += CanEditParcel; //MAYBE FULLY IMPLEMENTED
194 m_scene.Permissions.OnInstantMessage += CanInstantMessage; 194 m_scene.Permissions.OnInstantMessage += CanInstantMessage;
195 m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED 195 m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED
196 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED 196 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED
@@ -210,12 +210,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
210 m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED 210 m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED
211 211
212 m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED 212 m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED
213 m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED 213 m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED
214 m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED 214 m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED
215 m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED 215 m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED
216 216
217 m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE 217 m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE
218 m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED 218 m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
219 m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED 219 m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED
220 m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED 220 m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED
221 m_scene.Permissions.OnResetScript += CanResetScript; 221 m_scene.Permissions.OnResetScript += CanResetScript;
@@ -249,7 +249,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
249 foreach (string uuidl in grant.Split(',')) { 249 foreach (string uuidl in grant.Split(',')) {
250 string uuid = uuidl.Trim(" \t".ToCharArray()); 250 string uuid = uuidl.Trim(" \t".ToCharArray());
251 GrantLSL.Add(uuid, true); 251 GrantLSL.Add(uuid, true);
252 } 252 }
253 } 253 }
254 254
255 grant = myConfig.GetString("GrantCS",""); 255 grant = myConfig.GetString("GrantCS","");
@@ -431,7 +431,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
431 m_log.ErrorFormat( 431 m_log.ErrorFormat(
432 "[PERMISSIONS]: {0} is not a valid {1} value, setting to {2}", 432 "[PERMISSIONS]: {0} is not a valid {1} value, setting to {2}",
433 rawSetting, settingName, userSet); 433 rawSetting, settingName, userSet);
434 } 434 }
435 435
436 m_log.DebugFormat("[PERMISSIONS]: {0} {1}", settingName, userSet); 436 m_log.DebugFormat("[PERMISSIONS]: {0} {1}", settingName, userSet);
437 437
@@ -569,16 +569,19 @@ namespace OpenSim.Region.CoreModules.World.Permissions
569 569
570 // Users should be able to edit what is over their land. 570 // Users should be able to edit what is over their land.
571 ILandObject parcel = m_scene.LandChannel.GetLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y); 571 ILandObject parcel = m_scene.LandChannel.GetLandObject(task.AbsolutePosition.X, task.AbsolutePosition.Y);
572 if (parcel != null && parcel.landData.OwnerID == user && m_ParcelOwnerIsGod) 572 if (parcel != null && parcel.LandData.OwnerID == user && m_ParcelOwnerIsGod)
573 { 573 {
574 // Admin objects should not be editable by the above 574 // Admin objects should not be editable by the above
575 if (!IsAdministrator(objectOwner)) 575 if (!IsAdministrator(objectOwner))
576 return objectOwnerMask; 576 return objectOwnerMask;
577 } 577 }
578 578
579 if ((objectOwnerMask & (uint)PermissionMask.Transfer) != 0 && task.ObjectSaleType != 0)
580 objectEveryoneMask |= (uint)PrimFlags.ObjectTransfer;
581
579 // Group permissions 582 // Group permissions
580 if ((task.GroupID != UUID.Zero) && IsGroupMember(task.GroupID, user, 0)) 583 if ((task.GroupID != UUID.Zero) && IsGroupMember(task.GroupID, user, 0))
581 return objectGroupMask; 584 return objectGroupMask | objectEveryoneMask;
582 585
583 return objectEveryoneMask; 586 return objectEveryoneMask;
584 } 587 }
@@ -672,7 +675,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
672 675
673 // Users should be able to edit what is over their land. 676 // Users should be able to edit what is over their land.
674 ILandObject parcel = m_scene.LandChannel.GetLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y); 677 ILandObject parcel = m_scene.LandChannel.GetLandObject(group.AbsolutePosition.X, group.AbsolutePosition.Y);
675 if ((parcel != null) && (parcel.landData.OwnerID == currentUser)) 678 if ((parcel != null) && (parcel.LandData.OwnerID == currentUser))
676 { 679 {
677 permission = true; 680 permission = true;
678 } 681 }
@@ -740,12 +743,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
740 { 743 {
741 bool permission = false; 744 bool permission = false;
742 745
743 if (parcel.landData.OwnerID == user) 746 if (parcel.LandData.OwnerID == user)
744 { 747 {
745 permission = true; 748 permission = true;
746 } 749 }
747 750
748 if ((parcel.landData.GroupID != UUID.Zero) && IsGroupMember(parcel.landData.GroupID, user, groupPowers)) 751 if ((parcel.LandData.GroupID != UUID.Zero) && IsGroupMember(parcel.LandData.GroupID, user, groupPowers))
749 { 752 {
750 permission = true; 753 permission = true;
751 } 754 }
@@ -767,12 +770,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
767 { 770 {
768 bool permission = false; 771 bool permission = false;
769 772
770 if (parcel.landData.OwnerID == user) 773 if (parcel.LandData.OwnerID == user)
771 { 774 {
772 permission = true; 775 permission = true;
773 } 776 }
774 777
775 if (parcel.landData.IsGroupOwned && IsGroupMember(parcel.landData.GroupID, user, groupPowers)) 778 if (parcel.LandData.IsGroupOwned && IsGroupMember(parcel.LandData.GroupID, user, groupPowers))
776 { 779 {
777 permission = true; 780 permission = true;
778 } 781 }
@@ -820,13 +823,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
820 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 823 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
821 if (m_bypassPermissions) return m_bypassPermissionsValue; 824 if (m_bypassPermissions) return m_bypassPermissionsValue;
822 825
823 if (parcel.landData.OwnerID != user) // Only the owner can deed! 826 if (parcel.LandData.OwnerID != user) // Only the owner can deed!
824 return false; 827 return false;
825 828
826 ScenePresence sp = scene.GetScenePresence(user); 829 ScenePresence sp = scene.GetScenePresence(user);
827 IClientAPI client = sp.ControllingClient; 830 IClientAPI client = sp.ControllingClient;
828 831
829 if ((client.GetGroupPowers(parcel.landData.GroupID) & (ulong)GroupPowers.LandDeed) == 0) 832 if ((client.GetGroupPowers(parcel.LandData.GroupID) & (ulong)GroupPowers.LandDeed) == 0)
830 return false; 833 return false;
831 834
832 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDeed); 835 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDeed);
@@ -942,7 +945,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
942 if (m_bypassPermissions) return m_bypassPermissionsValue; 945 if (m_bypassPermissions) return m_bypassPermissionsValue;
943 946
944 if (m_allowedScriptEditors == UserSet.Administrators && !IsAdministrator(user)) 947 if (m_allowedScriptEditors == UserSet.Administrators && !IsAdministrator(user))
945 return false; 948 return false;
946 949
947 // Ordinarily, if you can view it, you can edit it 950 // Ordinarily, if you can view it, you can edit it
948 // There is no viewing a no mod script 951 // There is no viewing a no mod script
@@ -957,7 +960,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
957 /// <param name="objectID"></param> 960 /// <param name="objectID"></param>
958 /// <param name="user"></param> 961 /// <param name="user"></param>
959 /// <param name="scene"></param> 962 /// <param name="scene"></param>
960 /// <returns></returns> 963 /// <returns></returns>
961 private bool CanEditNotecard(UUID notecard, UUID objectID, UUID user, Scene scene) 964 private bool CanEditNotecard(UUID notecard, UUID objectID, UUID user, Scene scene)
962 { 965 {
963 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 966 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -1189,7 +1192,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1189 return false; 1192 return false;
1190 } 1193 }
1191 1194
1192 if ((land.landData.Flags & ((int)ParcelFlags.AllowAPrimitiveEntry)) != 0) 1195 if ((land.LandData.Flags & ((int)ParcelFlags.AllowAPrimitiveEntry)) != 0)
1193 { 1196 {
1194 return true; 1197 return true;
1195 } 1198 }
@@ -1233,7 +1236,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1233 ILandObject land = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y); 1236 ILandObject land = m_scene.LandChannel.GetLandObject(objectPosition.X, objectPosition.Y);
1234 if (land == null) return false; 1237 if (land == null) return false;
1235 1238
1236 if ((land.landData.Flags & ((int)ParcelFlags.CreateObjects)) == 1239 if ((land.LandData.Flags & ((int)ParcelFlags.CreateObjects)) ==
1237 (int)ParcelFlags.CreateObjects) 1240 (int)ParcelFlags.CreateObjects)
1238 permission = true; 1241 permission = true;
1239 1242
@@ -1360,7 +1363,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1360 return false; 1363 return false;
1361 1364
1362 // Others allowed to terraform? 1365 // Others allowed to terraform?
1363 if ((parcel.landData.Flags & ((int)ParcelFlags.AllowTerraform)) != 0) 1366 if ((parcel.LandData.Flags & ((int)ParcelFlags.AllowTerraform)) != 0)
1364 return true; 1367 return true;
1365 1368
1366 // Land owner can terraform too 1369 // Land owner can terraform too
@@ -1377,11 +1380,11 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1377 /// <param name="objectID"></param> 1380 /// <param name="objectID"></param>
1378 /// <param name="user"></param> 1381 /// <param name="user"></param>
1379 /// <param name="scene"></param> 1382 /// <param name="scene"></param>
1380 /// <returns></returns> 1383 /// <returns></returns>
1381 private bool CanViewScript(UUID script, UUID objectID, UUID user, Scene scene) 1384 private bool CanViewScript(UUID script, UUID objectID, UUID user, Scene scene)
1382 { 1385 {
1383 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1386 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1384 if (m_bypassPermissions) return m_bypassPermissionsValue; 1387 if (m_bypassPermissions) return m_bypassPermissionsValue;
1385 1388
1386 if (objectID == UUID.Zero) // User inventory 1389 if (objectID == UUID.Zero) // User inventory
1387 { 1390 {
@@ -1472,7 +1475,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1472 /// <param name="objectID"></param> 1475 /// <param name="objectID"></param>
1473 /// <param name="user"></param> 1476 /// <param name="user"></param>
1474 /// <param name="scene"></param> 1477 /// <param name="scene"></param>
1475 /// <returns></returns> 1478 /// <returns></returns>
1476 private bool CanViewNotecard(UUID notecard, UUID objectID, UUID user, Scene scene) 1479 private bool CanViewNotecard(UUID notecard, UUID objectID, UUID user, Scene scene)
1477 { 1480 {
1478 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1481 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -1609,7 +1612,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1609 /// </summary> 1612 /// </summary>
1610 /// <param name="invType"></param> 1613 /// <param name="invType"></param>
1611 /// <param name="userID"></param> 1614 /// <param name="userID"></param>
1612 /// <returns></returns> 1615 /// <returns></returns>
1613 private bool CanCreateUserInventory(int invType, UUID userID) 1616 private bool CanCreateUserInventory(int invType, UUID userID)
1614 { 1617 {
1615 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1618 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
@@ -1619,7 +1622,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1619 if (m_allowedScriptCreators == UserSet.Administrators && !IsAdministrator(userID)) 1622 if (m_allowedScriptCreators == UserSet.Administrators && !IsAdministrator(userID))
1620 return false; 1623 return false;
1621 1624
1622 return true; 1625 return true;
1623 } 1626 }
1624 1627
1625 /// <summary> 1628 /// <summary>
@@ -1627,27 +1630,27 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1627 /// </summary> 1630 /// </summary>
1628 /// <param name="itemID"></param> 1631 /// <param name="itemID"></param>
1629 /// <param name="userID"></param> 1632 /// <param name="userID"></param>
1630 /// <returns></returns> 1633 /// <returns></returns>
1631 private bool CanCopyUserInventory(UUID itemID, UUID userID) 1634 private bool CanCopyUserInventory(UUID itemID, UUID userID)
1632 { 1635 {
1633 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1636 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1634 if (m_bypassPermissions) return m_bypassPermissionsValue; 1637 if (m_bypassPermissions) return m_bypassPermissionsValue;
1635 1638
1636 return true; 1639 return true;
1637 } 1640 }
1638 1641
1639 /// <summary> 1642 /// <summary>
1640 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory. 1643 /// Check whether the specified user is allowed to edit the given inventory item within their own inventory.
1641 /// </summary> 1644 /// </summary>
1642 /// <param name="itemID"></param> 1645 /// <param name="itemID"></param>
1643 /// <param name="userID"></param> 1646 /// <param name="userID"></param>
1644 /// <returns></returns> 1647 /// <returns></returns>
1645 private bool CanEditUserInventory(UUID itemID, UUID userID) 1648 private bool CanEditUserInventory(UUID itemID, UUID userID)
1646 { 1649 {
1647 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1650 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1648 if (m_bypassPermissions) return m_bypassPermissionsValue; 1651 if (m_bypassPermissions) return m_bypassPermissionsValue;
1649 1652
1650 return true; 1653 return true;
1651 } 1654 }
1652 1655
1653 /// <summary> 1656 /// <summary>
@@ -1655,14 +1658,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1655 /// </summary> 1658 /// </summary>
1656 /// <param name="itemID"></param> 1659 /// <param name="itemID"></param>
1657 /// <param name="userID"></param> 1660 /// <param name="userID"></param>
1658 /// <returns></returns> 1661 /// <returns></returns>
1659 private bool CanDeleteUserInventory(UUID itemID, UUID userID) 1662 private bool CanDeleteUserInventory(UUID itemID, UUID userID)
1660 { 1663 {
1661 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1664 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1662 if (m_bypassPermissions) return m_bypassPermissionsValue; 1665 if (m_bypassPermissions) return m_bypassPermissionsValue;
1663 1666
1664 return true; 1667 return true;
1665 } 1668 }
1666 1669
1667 private bool CanTeleport(UUID userID, Scene scene) 1670 private bool CanTeleport(UUID userID, Scene scene)
1668 { 1671 {
@@ -1693,27 +1696,27 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1693 if (m_bypassPermissions) return m_bypassPermissionsValue; 1696 if (m_bypassPermissions) return m_bypassPermissionsValue;
1694 1697
1695 long powers = 0; 1698 long powers = 0;
1696 if (parcel.landData.GroupID != UUID.Zero) 1699 if (parcel.LandData.GroupID != UUID.Zero)
1697 client.GetGroupPowers(parcel.landData.GroupID); 1700 client.GetGroupPowers(parcel.LandData.GroupID);
1698 1701
1699 switch (type) 1702 switch (type)
1700 { 1703 {
1701 case (uint)ObjectReturnType.Owner: 1704 case (uint)ObjectReturnType.Owner:
1702 // Don't let group members return owner's objects, ever 1705 // Don't let group members return owner's objects, ever
1703 // 1706 //
1704 if (parcel.landData.IsGroupOwned) 1707 if (parcel.LandData.IsGroupOwned)
1705 { 1708 {
1706 if ((powers & (long)GroupPowers.ReturnGroupOwned) != 0) 1709 if ((powers & (long)GroupPowers.ReturnGroupOwned) != 0)
1707 return true; 1710 return true;
1708 } 1711 }
1709 else 1712 else
1710 { 1713 {
1711 if (parcel.landData.OwnerID != client.AgentId) 1714 if (parcel.LandData.OwnerID != client.AgentId)
1712 return false; 1715 return false;
1713 } 1716 }
1714 return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnGroupOwned); 1717 return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnGroupOwned);
1715 case (uint)ObjectReturnType.Group: 1718 case (uint)ObjectReturnType.Group:
1716 if (parcel.landData.OwnerID != client.AgentId) 1719 if (parcel.LandData.OwnerID != client.AgentId)
1717 { 1720 {
1718 // If permissionis granted through a group... 1721 // If permissionis granted through a group...
1719 // 1722 //
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
index e0331d3..58e4261 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
@@ -153,7 +153,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
153 public void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName) 153 public void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName)
154 { 154 {
155 SceneXmlLoader.SaveNamedPrimsToXml2(scene, primName, fileName); 155 SceneXmlLoader.SaveNamedPrimsToXml2(scene, primName, fileName);
156 } 156 }
157 157
158 public SceneObjectGroup DeserializeGroupFromXml2(string xmlString) 158 public SceneObjectGroup DeserializeGroupFromXml2(string xmlString)
159 { 159 {
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
index 373b6ab..799a448 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
@@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
238 { 238 {
239 m_serialiserModule = new SerialiserModule(); 239 m_serialiserModule = new SerialiserModule();
240 m_scene = SceneSetupHelpers.SetupScene(""); 240 m_scene = SceneSetupHelpers.SetupScene("");
241 SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule); 241 SceneSetupHelpers.SetupSceneModules(m_scene, m_serialiserModule);
242 } 242 }
243 243
244 [Test] 244 [Test]
@@ -299,7 +299,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
299 continue; 299 continue;
300 300
301 switch (xtr.Name) 301 switch (xtr.Name)
302 { 302 {
303 case "UUID": 303 case "UUID":
304 xtr.ReadStartElement("UUID"); 304 xtr.ReadStartElement("UUID");
305 uuid = UUID.Parse(xtr.ReadElementString("Guid")); 305 uuid = UUID.Parse(xtr.ReadElementString("Guid"));
@@ -311,7 +311,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
311 case "CreatorID": 311 case "CreatorID":
312 xtr.ReadStartElement("CreatorID"); 312 xtr.ReadStartElement("CreatorID");
313 creatorId = UUID.Parse(xtr.ReadElementString("Guid")); 313 creatorId = UUID.Parse(xtr.ReadElementString("Guid"));
314 xtr.ReadEndElement(); 314 xtr.ReadEndElement();
315 break; 315 break;
316 } 316 }
317 } 317 }
@@ -325,8 +325,8 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
325 // TODO: More checks 325 // TODO: More checks
326 Assert.That(uuid, Is.EqualTo(rpUuid)); 326 Assert.That(uuid, Is.EqualTo(rpUuid));
327 Assert.That(name, Is.EqualTo(rpName)); 327 Assert.That(name, Is.EqualTo(rpName));
328 Assert.That(creatorId, Is.EqualTo(rpCreatorId)); 328 Assert.That(creatorId, Is.EqualTo(rpCreatorId));
329 } 329 }
330 330
331 [Test] 331 [Test]
332 public void TestDeserializeXml2() 332 public void TestDeserializeXml2()
@@ -372,7 +372,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
372 string xml2 = m_serialiserModule.SerializeGroupToXml2(so); 372 string xml2 = m_serialiserModule.SerializeGroupToXml2(so);
373 373
374 XmlTextReader xtr = new XmlTextReader(new StringReader(xml2)); 374 XmlTextReader xtr = new XmlTextReader(new StringReader(xml2));
375 xtr.ReadStartElement("SceneObjectGroup"); 375 xtr.ReadStartElement("SceneObjectGroup");
376 xtr.ReadStartElement("SceneObjectPart"); 376 xtr.ReadStartElement("SceneObjectPart");
377 377
378 UUID uuid = UUID.Zero; 378 UUID uuid = UUID.Zero;
@@ -385,7 +385,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
385 continue; 385 continue;
386 386
387 switch (xtr.Name) 387 switch (xtr.Name)
388 { 388 {
389 case "UUID": 389 case "UUID":
390 xtr.ReadStartElement("UUID"); 390 xtr.ReadStartElement("UUID");
391 uuid = UUID.Parse(xtr.ReadElementString("Guid")); 391 uuid = UUID.Parse(xtr.ReadElementString("Guid"));
@@ -397,7 +397,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
397 case "CreatorID": 397 case "CreatorID":
398 xtr.ReadStartElement("CreatorID"); 398 xtr.ReadStartElement("CreatorID");
399 creatorId = UUID.Parse(xtr.ReadElementString("Guid")); 399 creatorId = UUID.Parse(xtr.ReadElementString("Guid"));
400 xtr.ReadEndElement(); 400 xtr.ReadEndElement();
401 break; 401 break;
402 } 402 }
403 } 403 }
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
index 6cc0ed9..37f1f2e 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
@@ -33,9 +33,9 @@ using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
34 34
35namespace OpenSim.Region.CoreModules.World.Sound 35namespace OpenSim.Region.CoreModules.World.Sound
36{ 36{
37 public class SoundModule : IRegionModule, ISoundModule 37 public class SoundModule : IRegionModule, ISoundModule
38 { 38 {
39 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 39 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 40
41 protected Scene m_scene; 41 protected Scene m_scene;
@@ -68,11 +68,11 @@ namespace OpenSim.Region.CoreModules.World.Sound
68 if (dis > 100.0) // Max audio distance 68 if (dis > 100.0) // Max audio distance
69 continue; 69 continue;
70 70
71 // Scale by distance 71 // Scale by distance
72 gain = (float)((double)gain*((100.0 - dis) / 100.0)); 72 gain = (float)((double)gain*((100.0 - dis) / 100.0));
73 73
74 p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); 74 p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags);
75 } 75 }
76 } 76 }
77 77
78 public virtual void TriggerSound( 78 public virtual void TriggerSound(
@@ -84,12 +84,12 @@ namespace OpenSim.Region.CoreModules.World.Sound
84 if (dis > 100.0) // Max audio distance 84 if (dis > 100.0) // Max audio distance
85 continue; 85 continue;
86 86
87 // Scale by distance 87 // Scale by distance
88 gain = (float)((double)gain*((100.0 - dis) / 100.0)); 88 gain = (float)((double)gain*((100.0 - dis) / 100.0));
89 89
90 p.ControllingClient.SendTriggeredSound( 90 p.ControllingClient.SendTriggeredSound(
91 soundId, ownerID, objectID, parentID, handle, position, (float)gain); 91 soundId, ownerID, objectID, parentID, handle, position, (float)gain);
92 } 92 }
93 } 93 }
94 } 94 }
95} 95}
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
index aa38c09..0712a7f 100644
--- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
@@ -322,7 +322,7 @@ namespace OpenSim.Region.CoreModules
322 m_DayLengthHours = config.Configs["Sun"].GetDouble("day_length", d_day_length); 322 m_DayLengthHours = config.Configs["Sun"].GetDouble("day_length", d_day_length);
323 323
324 // Horizon shift, this is used to shift the sun's orbit, this affects the day / night ratio 324 // Horizon shift, this is used to shift the sun's orbit, this affects the day / night ratio
325 // must hard code to ~.5 to match sun position in LL based viewers 325 // must hard code to ~.5 to match sun position in LL based viewers
326 m_HorizonShift = config.Configs["Sun"].GetDouble("day_night_offset", d_day_night); 326 m_HorizonShift = config.Configs["Sun"].GetDouble("day_night_offset", d_day_night);
327 327
328 328
@@ -494,7 +494,7 @@ namespace OpenSim.Region.CoreModules
494 receivedEstateToolsSunUpdate = true; 494 receivedEstateToolsSunUpdate = true;
495 495
496 // Generate shared values 496 // Generate shared values
497 GenSunPos(); 497 GenSunPos();
498 498
499 // When sun settings are updated, we should update all clients with new settings. 499 // When sun settings are updated, we should update all clients with new settings.
500 SunUpdateToAllClients(); 500 SunUpdateToAllClients();
diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
index a09315a..c2ad7b8 100644
--- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
+++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation
43 protected Scene m_scene; 43 protected Scene m_scene;
44 44
45 protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree }; 45 protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree };
46 public PCode[] CreationCapabilities { get { return creationCapabilities; } } 46 public PCode[] CreationCapabilities { get { return creationCapabilities; } }
47 47
48 public void Initialise(Scene scene, IConfigSource source) 48 public void Initialise(Scene scene, IConfigSource source)
49 { 49 {
@@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation
73 UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) 73 UUID ownerID, UUID groupID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape)
74 { 74 {
75 if (Array.IndexOf(creationCapabilities, (PCode)shape.PCode) < 0) 75 if (Array.IndexOf(creationCapabilities, (PCode)shape.PCode) < 0)
76 { 76 {
77 m_log.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name); 77 m_log.DebugFormat("[VEGETATION]: PCode {0} not handled by {1}", shape.PCode, Name);
78 return null; 78 return null;
79 } 79 }
@@ -111,6 +111,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation
111 tree.Scale = new Vector3(4, 4, 4); 111 tree.Scale = new Vector3(4, 4, 4);
112 break; 112 break;
113 } 113 }
114 } 114 }
115 } 115 }
116} 116}
diff --git a/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs b/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs
index 41d2071..9d47e19 100644
--- a/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Region.CoreModules.World.Wind.Plugins
46 46
47 private float m_avgStrength = 5.0f; // Average magnitude of the wind vector 47 private float m_avgStrength = 5.0f; // Average magnitude of the wind vector
48 private float m_avgDirection = 0.0f; // Average direction of the wind in degrees 48 private float m_avgDirection = 0.0f; // Average direction of the wind in degrees
49 private float m_varStrength = 5.0f; // Max Strength Variance 49 private float m_varStrength = 5.0f; // Max Strength Variance
50 private float m_varDirection = 30.0f;// Max Direction Variance 50 private float m_varDirection = 30.0f;// Max Direction Variance
51 private float m_rateChange = 1.0f; // 51 private float m_rateChange = 1.0f; //
52 52
@@ -141,7 +141,7 @@ namespace OpenSim.Region.CoreModules.World.Wind.Plugins
141 { 141 {
142 m_windSpeeds[y * 16 + x] = m_curPredominateWind; 142 m_windSpeeds[y * 16 + x] = m_curPredominateWind;
143 } 143 }
144 } 144 }
145 } 145 }
146 146
147 public Vector3 WindSpeed(float fX, float fY, float fZ) 147 public Vector3 WindSpeed(float fX, float fY, float fZ)
diff --git a/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs b/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs
index 2c371da..071e20b 100644
--- a/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs
@@ -95,7 +95,7 @@ namespace OpenSim.Region.CoreModules.World.Wind.Plugins
95 m_windSpeeds[y * 16 + x].Y *= m_strength; 95 m_windSpeeds[y * 16 + x].Y *= m_strength;
96 } 96 }
97 } 97 }
98 } 98 }
99 } 99 }
100 100
101 public Vector3 WindSpeed(float fX, float fY, float fZ) 101 public Vector3 WindSpeed(float fX, float fY, float fZ)
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
index b442f6f..3283c1f 100644
--- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
@@ -418,7 +418,7 @@ namespace OpenSim.Region.CoreModules
418 } 418 }
419 419
420 avatar.ControllingClient.SendWindData(windSpeeds); 420 avatar.ControllingClient.SendWindData(windSpeeds);
421 } 421 }
422 } 422 }
423 423
424 private void SendWindAllClients() 424 private void SendWindAllClients()
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index 4783b35..436f332 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -33,6 +33,8 @@ using OpenSim.Framework;
33using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Region.Framework.Scenes.Hypergrid; 35using OpenSim.Region.Framework.Scenes.Hypergrid;
36using OpenSim.Services.Interfaces;
37using GridRegion = OpenSim.Services.Interfaces.GridRegion;
36 38
37namespace OpenSim.Region.CoreModules.World.WorldMap 39namespace OpenSim.Region.CoreModules.World.WorldMap
38{ 40{
@@ -92,13 +94,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
92 } 94 }
93 95
94 // try to fetch from GridServer 96 // try to fetch from GridServer
95 List<RegionInfo> regionInfos = m_scene.SceneGridService.RequestNamedRegions(mapName, 20); 97 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(UUID.Zero, mapName, 20);
96 if (regionInfos == null) 98 if (regionInfos == null)
97 { 99 {
98 m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?"); 100 m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?");
99 // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region 101 // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region
100 regionInfos = new List<RegionInfo>(); 102 regionInfos = new List<GridRegion>();
101 RegionInfo info = m_scene.SceneGridService.RequestClosestRegion(mapName); 103 GridRegion info = m_scene.GridService.GetRegionByName(UUID.Zero, mapName);
102 if (info != null) regionInfos.Add(info); 104 if (info != null) regionInfos.Add(info);
103 } 105 }
104 106
@@ -109,11 +111,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
109 if (mapName.Contains(".") && mapName.Contains(":")) 111 if (mapName.Contains(".") && mapName.Contains(":"))
110 { 112 {
111 // It probably is a domain name. Try to link to it. 113 // It probably is a domain name. Try to link to it.
112 RegionInfo regInfo; 114 GridRegion regInfo;
113 Scene cScene = GetClientScene(remoteClient); 115 Scene cScene = GetClientScene(remoteClient);
114 regInfo = HGHyperlink.TryLinkRegion(cScene, remoteClient, mapName); 116 IHyperlinkService hyperService = cScene.RequestModuleInterface<IHyperlinkService>();
115 if (regInfo != null) 117 if (hyperService != null)
116 regionInfos.Add(regInfo); 118 {
119 regInfo = hyperService.TryLinkRegion(remoteClient, mapName);
120 if (regInfo != null)
121 regionInfos.Add(regInfo);
122 }
117 } 123 }
118 } 124 }
119 125
@@ -122,17 +128,17 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
122 MapBlockData data; 128 MapBlockData data;
123 if (regionInfos.Count > 0) 129 if (regionInfos.Count > 0)
124 { 130 {
125 foreach (RegionInfo info in regionInfos) 131 foreach (GridRegion info in regionInfos)
126 { 132 {
127 data = new MapBlockData(); 133 data = new MapBlockData();
128 data.Agents = 0; 134 data.Agents = 0;
129 data.Access = info.AccessLevel; 135 data.Access = info.Access;
130 data.MapImageId = info.RegionSettings.TerrainImageID; 136 data.MapImageId = info.TerrainImage;
131 data.Name = info.RegionName; 137 data.Name = info.RegionName;
132 data.RegionFlags = 0; // TODO not used? 138 data.RegionFlags = 0; // TODO not used?
133 data.WaterHeight = 0; // not used 139 data.WaterHeight = 0; // not used
134 data.X = (ushort)info.RegionLocX; 140 data.X = (ushort)(info.RegionLocX / Constants.RegionSize);
135 data.Y = (ushort)info.RegionLocY; 141 data.Y = (ushort)(info.RegionLocY / Constants.RegionSize);
136 blocks.Add(data); 142 blocks.Add(data);
137 } 143 }
138 } 144 }
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 1f25f28..05ed70a 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -48,6 +48,7 @@ using OpenSim.Region.Framework.Scenes;
48using Caps=OpenSim.Framework.Capabilities.Caps; 48using Caps=OpenSim.Framework.Capabilities.Caps;
49using OSDArray=OpenMetaverse.StructuredData.OSDArray; 49using OSDArray=OpenMetaverse.StructuredData.OSDArray;
50using OSDMap=OpenMetaverse.StructuredData.OSDMap; 50using OSDMap=OpenMetaverse.StructuredData.OSDMap;
51using GridRegion = OpenSim.Services.Interfaces.GridRegion;
51 52
52namespace OpenSim.Region.CoreModules.World.WorldMap 53namespace OpenSim.Region.CoreModules.World.WorldMap
53{ 54{
@@ -232,10 +233,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
232 } 233 }
233 if (lookup) 234 if (lookup)
234 { 235 {
235 List<MapBlockData> mapBlocks; 236 List<MapBlockData> mapBlocks = new List<MapBlockData>(); ;
236 237
237 mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks((int)m_scene.RegionInfo.RegionLocX - 8, (int)m_scene.RegionInfo.RegionLocY - 8, (int)m_scene.RegionInfo.RegionLocX + 8, (int)m_scene.RegionInfo.RegionLocY + 8); 238 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
238 avatarPresence.ControllingClient.SendMapBlock(mapBlocks,0); 239 (int)(m_scene.RegionInfo.RegionLocX - 8) * (int)Constants.RegionSize,
240 (int)(m_scene.RegionInfo.RegionLocX + 8) * (int)Constants.RegionSize,
241 (int)(m_scene.RegionInfo.RegionLocY - 8) * (int)Constants.RegionSize,
242 (int)(m_scene.RegionInfo.RegionLocY + 8) * (int)Constants.RegionSize);
243 foreach (GridRegion r in regions)
244 {
245 MapBlockData block = new MapBlockData();
246 MapBlockFromGridRegion(block, r);
247 mapBlocks.Add(block);
248 }
249 avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0);
239 250
240 lock (cachedMapBlocks) 251 lock (cachedMapBlocks)
241 cachedMapBlocks = mapBlocks; 252 cachedMapBlocks = mapBlocks;
@@ -579,7 +590,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
579 } 590 }
580 if (httpserver.Length == 0) 591 if (httpserver.Length == 0)
581 { 592 {
582 RegionInfo mreg = m_scene.SceneGridService.RequestNeighbouringRegionInfo(regionhandle); 593 uint x = 0, y = 0;
594 Utils.LongToUInts(regionhandle, out x, out y);
595 GridRegion mreg = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
583 596
584 if (mreg != null) 597 if (mreg != null)
585 { 598 {
@@ -719,15 +732,25 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
719 { 732 {
720 List<MapBlockData> response = new List<MapBlockData>(); 733 List<MapBlockData> response = new List<MapBlockData>();
721 734
722 // this should return one mapblock at most. But make sure: Look whether the one we requested is in there 735 // this should return one mapblock at most.
723 List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX, minY, maxX, maxY); 736 // (diva note: why?? in that case we should GetRegionByPosition)
724 if (mapBlocks != null) 737 // But make sure: Look whether the one we requested is in there
738 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
739 minX * (int)Constants.RegionSize,
740 maxX * (int)Constants.RegionSize,
741 minY * (int)Constants.RegionSize,
742 maxY * (int)Constants.RegionSize);
743
744 if (regions != null)
725 { 745 {
726 foreach (MapBlockData block in mapBlocks) 746 foreach (GridRegion r in regions)
727 { 747 {
728 if (block.X == minX && block.Y == minY) 748 if ((r.RegionLocX == minX * (int)Constants.RegionSize) &&
749 (r.RegionLocY == minY * (int)Constants.RegionSize))
729 { 750 {
730 // found it => add it to response 751 // found it => add it to response
752 MapBlockData block = new MapBlockData();
753 MapBlockFromGridRegion(block, r);
731 response.Add(block); 754 response.Add(block);
732 break; 755 break;
733 } 756 }
@@ -754,10 +777,30 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
754 777
755 protected virtual void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) 778 protected virtual void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
756 { 779 {
757 List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks(minX - 4, minY - 4, maxX + 4, maxY + 4); 780 List<MapBlockData> mapBlocks = new List<MapBlockData>();
781 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
782 (minX - 4) * (int)Constants.RegionSize,
783 (maxX + 4) * (int)Constants.RegionSize,
784 (minY - 4) * (int)Constants.RegionSize,
785 (maxY + 4) * (int)Constants.RegionSize);
786 foreach (GridRegion r in regions)
787 {
788 MapBlockData block = new MapBlockData();
789 MapBlockFromGridRegion(block, r);
790 mapBlocks.Add(block);
791 }
758 remoteClient.SendMapBlock(mapBlocks, flag); 792 remoteClient.SendMapBlock(mapBlocks, flag);
759 } 793 }
760 794
795 protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r)
796 {
797 block.Access = r.Access;
798 block.MapImageId = r.TerrainImage;
799 block.Name = r.RegionName;
800 block.X = (ushort)(r.RegionLocX / Constants.RegionSize);
801 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
802 }
803
761 public Hashtable OnHTTPGetMapImage(Hashtable keysvals) 804 public Hashtable OnHTTPGetMapImage(Hashtable keysvals)
762 { 805 {
763 m_log.Debug("[WORLD MAP]: Sending map image jpeg"); 806 m_log.Debug("[WORLD MAP]: Sending map image jpeg");
@@ -874,31 +917,34 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
874 m_log.InfoFormat( 917 m_log.InfoFormat(
875 "[WORLD MAP]: Exporting world map for {0} to {1}", m_scene.RegionInfo.RegionName, exportPath); 918 "[WORLD MAP]: Exporting world map for {0} to {1}", m_scene.RegionInfo.RegionName, exportPath);
876 919
877 List<MapBlockData> mapBlocks = 920 List<MapBlockData> mapBlocks = new List<MapBlockData>();
878 m_scene.CommsManager.GridService.RequestNeighbourMapBlocks( 921 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
879 (int)(m_scene.RegionInfo.RegionLocX - 9), 922 (int)(m_scene.RegionInfo.RegionLocX - 9) * (int)Constants.RegionSize,
880 (int)(m_scene.RegionInfo.RegionLocY - 9), 923 (int)(m_scene.RegionInfo.RegionLocX + 9) * (int)Constants.RegionSize,
881 (int)(m_scene.RegionInfo.RegionLocX + 9), 924 (int)(m_scene.RegionInfo.RegionLocY - 9) * (int)Constants.RegionSize,
882 (int)(m_scene.RegionInfo.RegionLocY + 9)); 925 (int)(m_scene.RegionInfo.RegionLocY + 9) * (int)Constants.RegionSize);
883 List<AssetBase> textures = new List<AssetBase>(); 926 List<AssetBase> textures = new List<AssetBase>();
884 List<Image> bitImages = new List<Image>(); 927 List<Image> bitImages = new List<Image>();
885 928
886 foreach (MapBlockData mapBlock in mapBlocks) 929 foreach (GridRegion r in regions)
887 { 930 {
931 MapBlockData mapBlock = new MapBlockData();
932 MapBlockFromGridRegion(mapBlock, r);
888 AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); 933 AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
889 934
890 if (texAsset != null) 935 if (texAsset != null)
891 { 936 {
892 textures.Add(texAsset); 937 textures.Add(texAsset);
893 } 938 }
894 else 939 //else
895 { 940 //{
896 texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); 941 // // WHAT?!? This doesn't seem right. Commenting (diva)
897 if (texAsset != null) 942 // texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
898 { 943 // if (texAsset != null)
899 textures.Add(texAsset); 944 // {
900 } 945 // textures.Add(texAsset);
901 } 946 // }
947 //}
902 } 948 }
903 949
904 foreach (AssetBase asset in textures) 950 foreach (AssetBase asset in textures)