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.cs84
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs33
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs74
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs420
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs84
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs536
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs130
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs34
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs74
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs371
14 files changed, 90 insertions, 1788 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index f0b0f4a..406f4a8 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -162,13 +162,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
162 162
163 private UUID m_defaultUser; 163 private UUID m_defaultUser;
164 164
165<<<<<<< HEAD
166 private UUID m_defaultUser;
167
168 public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string,object>options)
169=======
170 public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string, object> options) 165 public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string, object> options)
171>>>>>>> avn/ubitvar
172 { 166 {
173 m_rootScene = scene; 167 m_rootScene = scene;
174 168
@@ -177,11 +171,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
177 m_defaultUser = (UUID)options["default-user"]; 171 m_defaultUser = (UUID)options["default-user"];
178 m_log.InfoFormat("Using User {0} as default user", m_defaultUser.ToString()); 172 m_log.InfoFormat("Using User {0} as default user", m_defaultUser.ToString());
179 } 173 }
180<<<<<<< HEAD
181 else
182=======
183 else 174 else
184>>>>>>> avn/ubitvar
185 { 175 {
186 m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner; 176 m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner;
187 } 177 }
@@ -200,10 +190,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
200 } 190 }
201 191
202 m_errorMessage = String.Empty; 192 m_errorMessage = String.Empty;
203<<<<<<< HEAD
204=======
205 193
206>>>>>>> avn/ubitvar
207 m_merge = options.ContainsKey("merge"); 194 m_merge = options.ContainsKey("merge");
208 m_forceTerrain = options.ContainsKey("force-terrain"); 195 m_forceTerrain = options.ContainsKey("force-terrain");
209 m_forceParcels = options.ContainsKey("force-parcels"); 196 m_forceParcels = options.ContainsKey("force-parcels");
@@ -212,34 +199,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
212 m_requestId = requestId; 199 m_requestId = requestId;
213 m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero; 200 m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero;
214 m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f; 201 m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f;
215<<<<<<< HEAD
216 m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"]
217 : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f);
218
219 // Zero can never be a valid user or group id
220 m_validUserUuids[UUID.Zero] = false;
221 m_validGroupUuids[UUID.Zero] = false;
222=======
223 m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"] 202 m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"]
224 : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f); 203 : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f);
225 204
226 m_requestId = requestId;
227
228 // Zero can never be a valid user id (or group) 205 // Zero can never be a valid user id (or group)
229 m_validUserUuids[UUID.Zero] = false; 206 m_validUserUuids[UUID.Zero] = false;
230 m_validGroupUuids[UUID.Zero] = false; 207 m_validGroupUuids[UUID.Zero] = false;
231 208
232>>>>>>> avn/ubitvar
233
234 m_groupsModule = m_rootScene.RequestModuleInterface<IGroupsModule>(); 209 m_groupsModule = m_rootScene.RequestModuleInterface<IGroupsModule>();
235 m_assetService = m_rootScene.AssetService; 210 m_assetService = m_rootScene.AssetService;
236 } 211 }
237 212
238<<<<<<< HEAD
239 public ArchiveReadRequest(Scene scene, Stream loadStream, Guid requestId, Dictionary<string, object>options)
240=======
241 public ArchiveReadRequest(Scene scene, Stream loadStream, Guid requestId, Dictionary<string, object> options) 213 public ArchiveReadRequest(Scene scene, Stream loadStream, Guid requestId, Dictionary<string, object> options)
242>>>>>>> avn/ubitvar
243 { 214 {
244 m_rootScene = scene; 215 m_rootScene = scene;
245 m_loadPath = null; 216 m_loadPath = null;
@@ -249,11 +220,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
249 m_requestId = requestId; 220 m_requestId = requestId;
250 221
251 m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner; 222 m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner;
252<<<<<<< HEAD
253
254=======
255 223
256>>>>>>> avn/ubitvar
257 // Zero can never be a valid user id 224 // Zero can never be a valid user id
258 m_validUserUuids[UUID.Zero] = false; 225 m_validUserUuids[UUID.Zero] = false;
259 226
@@ -327,24 +294,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
327 if ((successfulAssetRestores + failedAssetRestores) % 250 == 0) 294 if ((successfulAssetRestores + failedAssetRestores) % 250 == 0)
328 m_log.Debug("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets..."); 295 m_log.Debug("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets...");
329 } 296 }
330<<<<<<< HEAD
331 else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH) && (!m_merge || m_forceTerrain)) 297 else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH) && (!m_merge || m_forceTerrain))
332=======
333 else if ((!m_merge || m_forceTerrain) && filePath.StartsWith(ArchiveConstants.TERRAINS_PATH))
334>>>>>>> avn/ubitvar
335 { 298 {
336 LoadTerrain(scene, filePath, data); 299 LoadTerrain(scene, filePath, data);
337 } 300 }
338 else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH)) 301 else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH))
339 { 302 {
340 LoadRegionSettings(scene, filePath, data, dearchivedScenes); 303 LoadRegionSettings(scene, filePath, data, dearchivedScenes);
341<<<<<<< HEAD
342 } 304 }
343 else if (filePath.StartsWith(ArchiveConstants.LANDDATA_PATH) && (!m_merge || m_forceParcels)) 305 else if (filePath.StartsWith(ArchiveConstants.LANDDATA_PATH) && (!m_merge || m_forceParcels))
344=======
345 }
346 else if ((!m_merge || m_forceParcels) && filePath.StartsWith(ArchiveConstants.LANDDATA_PATH))
347>>>>>>> avn/ubitvar
348 { 306 {
349 sceneContext.SerialisedParcels.Add(Encoding.UTF8.GetString(data)); 307 sceneContext.SerialisedParcels.Add(Encoding.UTF8.GetString(data));
350 } 308 }
@@ -565,10 +523,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
565 } 523 }
566 } 524 }
567 525
568<<<<<<< HEAD
569
570=======
571>>>>>>> avn/ubitvar
572 bool isTelehub = (sceneObject.UUID == oldTelehubUUID) && (oldTelehubUUID != UUID.Zero); 526 bool isTelehub = (sceneObject.UUID == oldTelehubUUID) && (oldTelehubUUID != UUID.Zero);
573 527
574 // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned 528 // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned
@@ -585,10 +539,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
585 } 539 }
586 540
587 ModifySceneObject(scene, sceneObject); 541 ModifySceneObject(scene, sceneObject);
588<<<<<<< HEAD
589=======
590
591>>>>>>> avn/ubitvar
592 542
593 if (scene.AddRestoredSceneObject(sceneObject, true, false)) 543 if (scene.AddRestoredSceneObject(sceneObject, true, false))
594 { 544 {
@@ -649,8 +599,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
649 // being no copy/no mod for everyone 599 // being no copy/no mod for everyone
650 lock (part.TaskInventory) 600 lock (part.TaskInventory)
651 { 601 {
652<<<<<<< HEAD
653=======
654 // And zap any troublesome sit target information 602 // And zap any troublesome sit target information
655 part.SitTargetOrientation = new Quaternion(0, 0, 0, 1); 603 part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
656 part.SitTargetPosition = new Vector3(0, 0, 0); 604 part.SitTargetPosition = new Vector3(0, 0, 0);
@@ -659,7 +607,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
659 // Not doing so results in inventory items 607 // Not doing so results in inventory items
660 // being no copy/no mod for everyone 608 // being no copy/no mod for everyone
661 part.TaskInventory.LockItemsForRead(true); 609 part.TaskInventory.LockItemsForRead(true);
662>>>>>>> avn/ubitvar 610
663 TaskInventoryDictionary inv = part.TaskInventory; 611 TaskInventoryDictionary inv = part.TaskInventory;
664 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) 612 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
665 { 613 {
@@ -680,18 +628,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
680 if (!ResolveGroupUuid(kvp.Value.GroupID)) 628 if (!ResolveGroupUuid(kvp.Value.GroupID))
681 kvp.Value.GroupID = UUID.Zero; 629 kvp.Value.GroupID = UUID.Zero;
682 } 630 }
683<<<<<<< HEAD
684=======
685 part.TaskInventory.LockItemsForRead(false); 631 part.TaskInventory.LockItemsForRead(false);
686>>>>>>> avn/ubitvar 632
687 } 633 }
688 } 634 }
689 } 635 }
690 636
691<<<<<<< HEAD
692
693=======
694>>>>>>> avn/ubitvar
695 /// <summary> 637 /// <summary>
696 /// Load serialized parcels. 638 /// Load serialized parcels.
697 /// </summary> 639 /// </summary>
@@ -712,11 +654,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
712 parcel.AABBMin += parcelDisp; 654 parcel.AABBMin += parcelDisp;
713 parcel.AABBMax += parcelDisp; 655 parcel.AABBMax += parcelDisp;
714 } 656 }
715<<<<<<< HEAD 657
716
717=======
718
719>>>>>>> avn/ubitvar
720 // Validate User and Group UUID's 658 // Validate User and Group UUID's
721 659
722 if (!ResolveGroupUuid(parcel.GroupID)) 660 if (!ResolveGroupUuid(parcel.GroupID))
@@ -731,26 +669,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
731 } 669 }
732 else 670 else
733 { 671 {
734<<<<<<< HEAD
735 parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
736=======
737 parcel.OwnerID = m_defaultUser; 672 parcel.OwnerID = m_defaultUser;
738 parcel.GroupID = UUID.Zero; 673 parcel.GroupID = UUID.Zero;
739>>>>>>> avn/ubitvar
740 parcel.IsGroupOwned = false; 674 parcel.IsGroupOwned = false;
741 } 675 }
742 } 676 }
743 else 677 else
744 { 678 {
745 if (!ResolveUserUuid(scene, parcel.OwnerID)) 679 if (!ResolveUserUuid(scene, parcel.OwnerID))
746<<<<<<< HEAD
747 parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
748=======
749 parcel.OwnerID = m_defaultUser; 680 parcel.OwnerID = m_defaultUser;
750 681
751 if (!ResolveGroupUuid(parcel.GroupID)) 682 if (!ResolveGroupUuid(parcel.GroupID))
752 parcel.GroupID = UUID.Zero; 683 parcel.GroupID = UUID.Zero;
753>>>>>>> avn/ubitvar
754 } 684 }
755 685
756 List<LandAccessEntry> accessList = new List<LandAccessEntry>(); 686 List<LandAccessEntry> accessList = new List<LandAccessEntry>();
@@ -879,10 +809,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
879 if (data == null) 809 if (data == null)
880 return false; 810 return false;
881 } 811 }
882<<<<<<< HEAD
883 812
884=======
885>>>>>>> avn/ubitvar
886 //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); 813 //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
887 814
888 AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType, UUID.Zero.ToString()); 815 AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType, UUID.Zero.ToString());
@@ -1004,11 +931,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
1004 private bool LoadTerrain(Scene scene, string terrainPath, byte[] data) 931 private bool LoadTerrain(Scene scene, string terrainPath, byte[] data)
1005 { 932 {
1006 ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>(); 933 ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
1007<<<<<<< HEAD
1008
1009=======
1010
1011>>>>>>> avn/ubitvar
1012 using (MemoryStream ms = new MemoryStream(data)) 934 using (MemoryStream ms = new MemoryStream(data))
1013 { 935 {
1014 if (m_displacement != Vector3.Zero || m_rotation != 0f) 936 if (m_displacement != Vector3.Zero || m_rotation != 0f)
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index 0fb8a32..4178a57 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -111,19 +111,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
111 String defaultUser = ""; 111 String defaultUser = "";
112 float rotation = 0f; 112 float rotation = 0f;
113 Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); 113 Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0);
114<<<<<<< HEAD 114
115
116 OptionSet options = new OptionSet();
117 options.Add("m|merge", delegate (string v) { mergeOar = (v != null); });
118 options.Add("s|skip-assets", delegate (string v) { skipAssets = (v != null); });
119 options.Add("force-terrain", delegate (string v) { forceTerrain = (v != null); });
120 options.Add("forceterrain", delegate (string v) { forceTerrain = (v != null); }); // downward compatibility
121 options.Add("force-parcels", delegate (string v) { forceParcels = (v != null); });
122 options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility
123 options.Add("no-objects", delegate (string v) { noObjects = (v != null); });
124 options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; });
125 options.Add("displacement=", delegate (string v) {
126=======
127 115
128 OptionSet options = new OptionSet(); 116 OptionSet options = new OptionSet();
129 options.Add("m|merge", delegate(string v) { mergeOar = (v != null); }); 117 options.Add("m|merge", delegate(string v) { mergeOar = (v != null); });
@@ -136,7 +124,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
136 options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; }); 124 options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; });
137 options.Add("displacement=", delegate(string v) 125 options.Add("displacement=", delegate(string v)
138 { 126 {
139>>>>>>> avn/ubitvar
140 try 127 try
141 { 128 {
142 displacement = v == null ? Vector3.Zero : Vector3.Parse(v); 129 displacement = v == null ? Vector3.Zero : Vector3.Parse(v);
@@ -163,12 +150,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
163 // Convert to radians for internals 150 // Convert to radians for internals
164 rotation = Util.Clamp<float>(rotation, -359f, 359f) / 180f * (float)Math.PI; 151 rotation = Util.Clamp<float>(rotation, -359f, 359f) / 180f * (float)Math.PI;
165 }); 152 });
166<<<<<<< HEAD
167 options.Add("rotation-center=", delegate (string v) {
168=======
169 options.Add("rotation-center=", delegate(string v) 153 options.Add("rotation-center=", delegate(string v)
170 { 154 {
171>>>>>>> avn/ubitvar
172 try 155 try
173 { 156 {
174 rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v); 157 rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v);
@@ -308,21 +291,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
308 Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); 291 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
309 DearchiveRegion(loadPath, Guid.Empty, archiveOptions); 292 DearchiveRegion(loadPath, Guid.Empty, archiveOptions);
310 } 293 }
311<<<<<<< HEAD
312
313 public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string,object> options)
314 {
315 m_log.InfoFormat(
316 "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath);
317
318=======
319 294
320 public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string, object> options) 295 public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string, object> options)
321 { 296 {
322 m_log.InfoFormat( 297 m_log.InfoFormat(
323 "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath); 298 "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath);
324 299
325>>>>>>> avn/ubitvar
326 new ArchiveReadRequest(Scene, loadPath, requestId, options).DearchiveRegion(); 300 new ArchiveReadRequest(Scene, loadPath, requestId, options).DearchiveRegion();
327 } 301 }
328 302
@@ -331,11 +305,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
331 Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); 305 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
332 DearchiveRegion(loadStream, Guid.Empty, archiveOptions); 306 DearchiveRegion(loadStream, Guid.Empty, archiveOptions);
333 } 307 }
334<<<<<<< HEAD
335
336=======
337
338>>>>>>> avn/ubitvar
339 public void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options) 308 public void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options)
340 { 309 {
341 new ArchiveReadRequest(Scene, loadStream, requestId, options).DearchiveRegion(); 310 new ArchiveReadRequest(Scene, loadStream, requestId, options).DearchiveRegion();
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index e6e6485..3ded00c 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -68,6 +68,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
68 public event ChangeDelegate OnEstateInfoChange; 68 public event ChangeDelegate OnEstateInfoChange;
69 public event MessageDelegate OnEstateMessage; 69 public event MessageDelegate OnEstateMessage;
70 70
71 private int m_delayCount = 0;
72
71 #region Region Module interface 73 #region Region Module interface
72 74
73 public string Name { get { return "EstateManagementModule"; } } 75 public string Name { get { return "EstateManagementModule"; } }
@@ -146,6 +148,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
146 flags |= RegionFlags.AllowParcelChanges; 148 flags |= RegionFlags.AllowParcelChanges;
147 if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) 149 if (Scene.RegionInfo.RegionSettings.BlockShowInSearch)
148 flags |= RegionFlags.BlockParcelSearch; 150 flags |= RegionFlags.BlockParcelSearch;
151 if (Scene.RegionInfo.RegionSettings.GodBlockSearch)
152 flags |= (RegionFlags)(1 << 11);
153 if (Scene.RegionInfo.RegionSettings.Casino)
154 flags |= (RegionFlags)(1 << 10);
149 155
150 if (Scene.RegionInfo.RegionSettings.FixedSun) 156 if (Scene.RegionInfo.RegionSettings.FixedSun)
151 flags |= RegionFlags.SunFixed; 157 flags |= RegionFlags.SunFixed;
@@ -198,6 +204,14 @@ namespace OpenSim.Region.CoreModules.World.Estate
198 change(Scene.RegionInfo.RegionID); 204 change(Scene.RegionInfo.RegionID);
199 } 205 }
200 206
207 protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e)
208 {
209 ChangeDelegate change = OnRegionInfoChange;
210
211 if (change != null)
212 change(Scene.RegionInfo.RegionID);
213 }
214
201 public void TriggerRegionInfoChange() 215 public void TriggerRegionInfoChange()
202 { 216 {
203 m_regionChangeTimer.Stop(); 217 m_regionChangeTimer.Stop();
@@ -1491,68 +1505,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
1491 sendRegionHandshake(client); 1505 sendRegionHandshake(client);
1492 } 1506 }
1493 1507
1494<<<<<<< HEAD
1495 private uint GetEstateFlags()
1496=======
1497 public uint GetRegionFlags()
1498 {
1499 RegionFlags flags = RegionFlags.None;
1500
1501 // Fully implemented
1502 //
1503 if (Scene.RegionInfo.RegionSettings.AllowDamage)
1504 flags |= RegionFlags.AllowDamage;
1505 if (Scene.RegionInfo.RegionSettings.BlockTerraform)
1506 flags |= RegionFlags.BlockTerraform;
1507 if (!Scene.RegionInfo.RegionSettings.AllowLandResell)
1508 flags |= RegionFlags.BlockLandResell;
1509 if (Scene.RegionInfo.RegionSettings.DisableCollisions)
1510 flags |= RegionFlags.SkipCollisions;
1511 if (Scene.RegionInfo.RegionSettings.DisableScripts)
1512 flags |= RegionFlags.SkipScripts;
1513 if (Scene.RegionInfo.RegionSettings.DisablePhysics)
1514 flags |= RegionFlags.SkipPhysics;
1515 if (Scene.RegionInfo.RegionSettings.BlockFly)
1516 flags |= RegionFlags.NoFly;
1517 if (Scene.RegionInfo.RegionSettings.RestrictPushing)
1518 flags |= RegionFlags.RestrictPushObject;
1519 if (Scene.RegionInfo.RegionSettings.AllowLandJoinDivide)
1520 flags |= RegionFlags.AllowParcelChanges;
1521 if (Scene.RegionInfo.RegionSettings.BlockShowInSearch)
1522 flags |= RegionFlags.BlockParcelSearch;
1523 if (Scene.RegionInfo.RegionSettings.GodBlockSearch)
1524 flags |= (RegionFlags)(1 << 11);
1525 if (Scene.RegionInfo.RegionSettings.Casino)
1526 flags |= (RegionFlags)(1 << 10);
1527
1528 if (Scene.RegionInfo.RegionSettings.FixedSun)
1529 flags |= RegionFlags.SunFixed;
1530 if (Scene.RegionInfo.RegionSettings.Sandbox)
1531 flags |= RegionFlags.Sandbox;
1532 if (Scene.RegionInfo.EstateSettings.AllowVoice)
1533 flags |= RegionFlags.AllowVoice;
1534 if (Scene.RegionInfo.EstateSettings.AllowLandmark)
1535 flags |= RegionFlags.AllowLandmark;
1536 if (Scene.RegionInfo.EstateSettings.AllowSetHome)
1537 flags |= RegionFlags.AllowSetHome;
1538 if (Scene.RegionInfo.EstateSettings.BlockDwell)
1539 flags |= RegionFlags.BlockDwell;
1540 if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport)
1541 flags |= RegionFlags.ResetHomeOnTeleport;
1542
1543
1544 // TODO: SkipUpdateInterestList
1545
1546 // Omitted
1547 //
1548 // Omitted: NullLayer (what is that?)
1549 // Omitted: SkipAgentAction (what does it do?)
1550
1551 return (uint)flags;
1552 }
1553 1508
1554 public uint GetEstateFlags() 1509 public uint GetEstateFlags()
1555>>>>>>> avn/ubitvar
1556 { 1510 {
1557 RegionFlags flags = RegionFlags.None; 1511 RegionFlags flags = RegionFlags.None;
1558 1512
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 8bd46f6..749c2cc 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -69,11 +69,8 @@ namespace OpenSim.Region.CoreModules.World.Land
69 /// <summary> 69 /// <summary>
70 /// Minimum land unit size in region co-ordinates. 70 /// Minimum land unit size in region co-ordinates.
71 /// </summary> 71 /// </summary>
72<<<<<<< HEAD 72
73 public const int LandUnit = 4; 73 public const int LandUnit = 4;
74=======
75 public const int landUnit = 4;
76>>>>>>> avn/ubitvar
77 74
78 private static readonly string remoteParcelRequestPath = "0009/"; 75 private static readonly string remoteParcelRequestPath = "0009/";
79 76
@@ -106,17 +103,12 @@ namespace OpenSim.Region.CoreModules.World.Land
106 103
107 // caches ExtendedLandData 104 // caches ExtendedLandData
108 private Cache parcelInfoCache; 105 private Cache parcelInfoCache;
109<<<<<<< HEAD
110
111 106
112 /// <summary> 107 /// <summary>
113 /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. 108 /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions.
114 /// </summary> 109 /// </summary>
115 private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>(); 110 private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>();
116======= 111
117 private Dictionary<UUID, Vector3> forcedPosition =
118 new Dictionary<UUID, Vector3>();
119>>>>>>> avn/ubitvar
120 112
121 // Enables limiting parcel layer info transmission when doing simple updates 113 // Enables limiting parcel layer info transmission when doing simple updates
122 private bool shouldLimitParcelLayerInfoToViewDistance { get; set; } 114 private bool shouldLimitParcelLayerInfoToViewDistance { get; set; }
@@ -132,7 +124,6 @@ namespace OpenSim.Region.CoreModules.World.Land
132 124
133 public void Initialise(IConfigSource source) 125 public void Initialise(IConfigSource source)
134 { 126 {
135<<<<<<< HEAD
136 shouldLimitParcelLayerInfoToViewDistance = true; 127 shouldLimitParcelLayerInfoToViewDistance = true;
137 parcelLayerViewDistance = 128; 128 parcelLayerViewDistance = 128;
138 IConfig landManagementConfig = source.Configs["LandManagement"]; 129 IConfig landManagementConfig = source.Configs["LandManagement"];
@@ -140,24 +131,16 @@ namespace OpenSim.Region.CoreModules.World.Land
140 { 131 {
141 shouldLimitParcelLayerInfoToViewDistance = landManagementConfig.GetBoolean("LimitParcelLayerUpdateDistance", shouldLimitParcelLayerInfoToViewDistance); 132 shouldLimitParcelLayerInfoToViewDistance = landManagementConfig.GetBoolean("LimitParcelLayerUpdateDistance", shouldLimitParcelLayerInfoToViewDistance);
142 parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance); 133 parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance);
143======= 134 DefaultGodParcelGroup = new UUID(landManagementConfig.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString()));
144 IConfig cnf = source.Configs["LandManagement"]; 135 DefaultGodParcelName = landManagementConfig.GetString("DefaultAdministratorParcelName", "Default Parcel");
145 if (cnf != null)
146 {
147 DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString()));
148 DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel");
149>>>>>>> avn/ubitvar
150 } 136 }
151 } 137 }
152 138
153 public void AddRegion(Scene scene) 139 public void AddRegion(Scene scene)
154 { 140 {
155 m_scene = scene; 141 m_scene = scene;
156<<<<<<< HEAD
157 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; 142 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit];
158======= 143
159 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
160>>>>>>> avn/ubitvar
161 landChannel = new LandChannel(scene, this); 144 landChannel = new LandChannel(scene, this);
162 145
163 parcelInfoCache = new Cache(); 146 parcelInfoCache = new Cache();
@@ -299,11 +282,8 @@ namespace OpenSim.Region.CoreModules.World.Land
299 { 282 {
300 m_landList.Clear(); 283 m_landList.Clear();
301 m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; 284 m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
302<<<<<<< HEAD 285
303 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; 286 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit];
304=======
305 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
306>>>>>>> avn/ubitvar
307 } 287 }
308 } 288 }
309 289
@@ -313,16 +293,10 @@ namespace OpenSim.Region.CoreModules.World.Land
313 /// <returns>The parcel created.</returns> 293 /// <returns>The parcel created.</returns>
314 protected ILandObject CreateDefaultParcel() 294 protected ILandObject CreateDefaultParcel()
315 { 295 {
316<<<<<<< HEAD
317 m_log.DebugFormat(
318 "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName);
319
320 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
321=======
322 m_log.DebugFormat("{0} Creating default parcel for region {1}", LogHeader, m_scene.RegionInfo.RegionName); 296 m_log.DebugFormat("{0} Creating default parcel for region {1}", LogHeader, m_scene.RegionInfo.RegionName);
323 297
324 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); 298 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
325>>>>>>> avn/ubitvar 299
326 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, 300 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0,
327 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY)); 301 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY));
328 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 302 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
@@ -456,15 +430,10 @@ namespace OpenSim.Region.CoreModules.World.Land
456 430
457 public void SendLandUpdate(ScenePresence avatar, bool force) 431 public void SendLandUpdate(ScenePresence avatar, bool force)
458 { 432 {
459<<<<<<< HEAD
460 ILandObject over = GetLandObject((int)Math.Min(((int)m_scene.RegionInfo.RegionSizeX - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))),
461 (int)Math.Min(((int)m_scene.RegionInfo.RegionSizeY - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y))));
462=======
463 if (avatar.IsChildAgent) 433 if (avatar.IsChildAgent)
464 return; 434 return;
465 435
466 ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 436 ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
467>>>>>>> avn/ubitvar
468 437
469 if (over != null) 438 if (over != null)
470 { 439 {
@@ -621,28 +590,17 @@ namespace OpenSim.Region.CoreModules.World.Land
621 new_land.LandData.LocalID = newLandLocalID; 590 new_land.LandData.LocalID = newLandLocalID;
622 591
623 bool[,] landBitmap = new_land.GetLandBitmap(); 592 bool[,] landBitmap = new_land.GetLandBitmap();
624<<<<<<< HEAD
625 // m_log.DebugFormat("{0} AddLandObject. new_land.bitmapSize=({1},{2}). newLocalID={3}",
626 // LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), newLandLocalID);
627
628=======
629>>>>>>> avn/ubitvar
630 if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1)) 593 if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1))
631 { 594 {
632 // Going to variable sized regions can cause mismatches 595 // Going to variable sized regions can cause mismatches
633 m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})", 596 m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})",
634<<<<<<< HEAD
635 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1) );
636=======
637 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1)); 597 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1));
638>>>>>>> avn/ubitvar
639 } 598 }
640 else 599 else
641 { 600 {
642 // If other land objects still believe that they occupy any parts of the same space, 601 // If other land objects still believe that they occupy any parts of the same space,
643 // then do not allow the add to proceed. 602 // then do not allow the add to proceed.
644 for (int x = 0; x < landBitmap.GetLength(0); x++) 603 for (int x = 0; x < landBitmap.GetLength(0); x++)
645<<<<<<< HEAD
646 { 604 {
647 for (int y = 0; y < landBitmap.GetLength(1); y++) 605 for (int y = 0; y < landBitmap.GetLength(1); y++)
648 { 606 {
@@ -658,40 +616,6 @@ namespace OpenSim.Region.CoreModules.World.Land
658 { 616 {
659 m_log.ErrorFormat( 617 m_log.ErrorFormat(
660 "{0}: Cannot add parcel \"{1}\", local ID {2} at tile {3},{4} because this is still occupied by parcel \"{5}\", local ID {6} in {7}", 618 "{0}: Cannot add parcel \"{1}\", local ID {2} at tile {3},{4} because this is still occupied by parcel \"{5}\", local ID {6} in {7}",
661 LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y,
662 lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name);
663
664 return null;
665 }
666 }
667 }
668 }
669 }
670
671 for (int x = 0; x < landBitmap.GetLength(0); x++)
672=======
673>>>>>>> avn/ubitvar
674 {
675 for (int y = 0; y < landBitmap.GetLength(1); y++)
676 {
677 if (landBitmap[x, y])
678 {
679<<<<<<< HEAD
680 // m_log.DebugFormat(
681 // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}",
682 // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName);
683
684=======
685 int lastRecordedLandId = m_landIDList[x, y];
686
687 if (lastRecordedLandId > 0)
688 {
689 ILandObject lastRecordedLo = m_landList[lastRecordedLandId];
690
691 if (lastRecordedLo.LandBitmap[x, y])
692 {
693 m_log.ErrorFormat(
694 "{0}: Cannot add parcel \"{1}\", local ID {2} at tile {3},{4} because this is still occupied by parcel \"{5}\", local ID {6} in {7}",
695 LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y, 619 LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y,
696 lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name); 620 lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name);
697 621
@@ -712,7 +636,6 @@ namespace OpenSim.Region.CoreModules.World.Land
712 // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", 636 // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}",
713 // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); 637 // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName);
714 638
715>>>>>>> avn/ubitvar
716 m_landIDList[x, y] = newLandLocalID; 639 m_landIDList[x, y] = newLandLocalID;
717 } 640 }
718 } 641 }
@@ -829,33 +752,6 @@ namespace OpenSim.Region.CoreModules.World.Land
829 /// <returns>Land object at the point supplied</returns> 752 /// <returns>Land object at the point supplied</returns>
830 public ILandObject GetLandObject(float x_float, float y_float) 753 public ILandObject GetLandObject(float x_float, float y_float)
831 { 754 {
832<<<<<<< HEAD
833 return GetLandObject((int)x_float, (int)y_float, true /* returnNullIfLandObjectNotFound */);
834 /*
835 int x;
836 int y;
837
838 if (x_float >= m_scene.RegionInfo.RegionSizeX || x_float < 0 || y_float >= m_scene.RegionInfo.RegionSizeX || y_float < 0)
839 return null;
840
841 try
842 {
843 x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / (float)landUnit));
844 y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / (float)landUnit));
845 }
846 catch (OverflowException)
847 {
848 return null;
849 }
850
851 if (x >= (m_scene.RegionInfo.RegionSizeX / landUnit)
852 || y >= (m_scene.RegionInfo.RegionSizeY / landUnit)
853 || x < 0
854 || y < 0)
855 {
856 return null;
857 }
858=======
859 return GetLandObject((int)x_float, (int)y_float, true); 755 return GetLandObject((int)x_float, (int)y_float, true);
860 } 756 }
861 757
@@ -875,45 +771,18 @@ namespace OpenSim.Region.CoreModules.World.Land
875 avy = 0; 771 avy = 0;
876 else if (avy >= m_scene.RegionInfo.RegionSizeY) 772 else if (avy >= m_scene.RegionInfo.RegionSizeY)
877 avy = (int)Constants.RegionSize - 1; 773 avy = (int)Constants.RegionSize - 1;
878>>>>>>> avn/ubitvar
879 774
880 lock (m_landIDList) 775 lock (m_landIDList)
881 { 776 {
882<<<<<<< HEAD
883 // Corner case. If an autoreturn happens during sim startup
884 // we will come here with the list uninitialized
885 //
886// int landId = m_landIDList[x, y];
887
888// if (landId == 0)
889// m_log.DebugFormat(
890// "[LAND MANAGEMENT MODULE]: No land object found at ({0}, {1}) on {2}",
891// x, y, m_scene.RegionInfo.RegionName);
892
893 try
894 {
895 if (m_landList.ContainsKey(m_landIDList[x, y]))
896 return m_landList[m_landIDList[x, y]];
897 }
898 catch (Exception e)
899 {
900 m_log.DebugFormat("{0} GetLandObject exception. x={1}, y={2}, m_landIDList.len=({3},{4})",
901 LogHeader, x, y, m_landIDList.GetLength(0), m_landIDList.GetLength(1));
902 }
903
904 return null;
905=======
906 try 777 try
907 { 778 {
908 return m_landList[m_landIDList[avx / landUnit, avy / landUnit]]; 779 return m_landList[m_landIDList[avx / LandUnit, avy / LandUnit]];
909 } 780 }
910 catch (IndexOutOfRangeException) 781 catch (IndexOutOfRangeException)
911 { 782 {
912 return null; 783 return null;
913 } 784 }
914>>>>>>> avn/ubitvar
915 } 785 }
916 */
917 } 786 }
918 787
919 // Public entry. 788 // Public entry.
@@ -923,38 +792,15 @@ namespace OpenSim.Region.CoreModules.World.Land
923 return GetLandObject(x, y, false /* returnNullIfLandObjectNotFound */); 792 return GetLandObject(x, y, false /* returnNullIfLandObjectNotFound */);
924 } 793 }
925 794
926<<<<<<< HEAD
927 /// <summary>
928 /// Given a region position, return the parcel land object for that location
929 /// </summary>
930 /// <returns>
931 /// The land object.
932 /// </returns>
933 /// <param name='x'></param>
934 /// <param name='y'></param>
935 /// <param name='returnNullIfLandObjectNotFound'>
936 /// Return null if the land object requested is not within the region's bounds.
937 /// </param>
938 private ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds)
939 {
940 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0)
941=======
942 public ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds) 795 public ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds)
943 { 796 {
944 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0) 797 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0)
945>>>>>>> avn/ubitvar
946 { 798 {
947 // These exceptions here will cause a lot of complaints from the users specifically because 799 // These exceptions here will cause a lot of complaints from the users specifically because
948 // they happen every time at border crossings 800 // they happen every time at border crossings
949 if (returnNullIfLandObjectOutsideBounds) 801 if (returnNullIfLandObjectOutsideBounds)
950 return null; 802 return null;
951 else 803 else
952<<<<<<< HEAD
953 throw new Exception(
954 String.Format("{0} GetLandObject for non-existent position. Region={1}, pos=<{2},{3}",
955 LogHeader, m_scene.RegionInfo.RegionName, x, y)
956 );
957=======
958 throw new Exception("Error: Parcel not found at point " + x + ", " + y); 804 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
959 } 805 }
960 806
@@ -968,7 +814,6 @@ namespace OpenSim.Region.CoreModules.World.Land
968 { 814 {
969 return null; 815 return null;
970 } 816 }
971>>>>>>> avn/ubitvar
972 } 817 }
973 818
974 return m_landList[m_landIDList[x / 4, y / 4]]; 819 return m_landList[m_landIDList[x / 4, y / 4]];
@@ -987,19 +832,6 @@ namespace OpenSim.Region.CoreModules.World.Land
987 return ret; 832 return ret;
988 } 833 }
989 834
990 // Create a 'parcel is here' bitmap for the parcel identified by the passed landID
991 private bool[,] CreateBitmapForID(int landID)
992 {
993 bool[,] ret = new bool[m_landIDList.GetLength(0), m_landIDList.GetLength(1)];
994
995 for (int xx = 0; xx < m_landIDList.GetLength(0); xx++)
996 for (int yy = 0; yy < m_landIDList.GetLength(0); yy++)
997 if (m_landIDList[xx, yy] == landID)
998 ret[xx, yy] = true;
999
1000 return ret;
1001 }
1002
1003 #endregion 835 #endregion
1004 836
1005 #region Parcel Modification 837 #region Parcel Modification
@@ -1169,19 +1001,12 @@ namespace OpenSim.Region.CoreModules.World.Land
1169 1001
1170 //Now add the new land object 1002 //Now add the new land object
1171 ILandObject result = AddLandObject(newLand); 1003 ILandObject result = AddLandObject(newLand);
1172<<<<<<< HEAD
1173 1004
1174 if (result != null)
1175 {
1176 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData);
1177 result.SendLandUpdateToAvatarsOverMe();
1178 }
1179=======
1180 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); 1005 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData);
1181 result.SendLandUpdateToAvatarsOverMe(); 1006 result.SendLandUpdateToAvatarsOverMe();
1182 startLandObject.SendLandUpdateToAvatarsOverMe(); 1007 startLandObject.SendLandUpdateToAvatarsOverMe();
1183 m_scene.ForEachClient(SendParcelOverlay); 1008 m_scene.ForEachClient(SendParcelOverlay);
1184>>>>>>> avn/ubitvar 1009
1185 } 1010 }
1186 1011
1187 /// <summary> 1012 /// <summary>
@@ -1263,15 +1088,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1263 1088
1264 #region Parcel Updating 1089 #region Parcel Updating
1265 1090
1266<<<<<<< HEAD
1267 // Send parcel layer info for the whole region
1268 public void SendParcelOverlay(IClientAPI remote_client)
1269 {
1270 SendParcelOverlay(remote_client, 0, 0, (int)Constants.MaximumRegionSize);
1271 }
1272=======
1273>>>>>>> avn/ubitvar
1274
1275 /// <summary> 1091 /// <summary>
1276 /// Send the parcel overlay blocks to the client. We send the overlay packets 1092 /// Send the parcel overlay blocks to the client. We send the overlay packets
1277 /// around a location and limited by the 'parcelLayerViewDistance'. This number 1093 /// around a location and limited by the 'parcelLayerViewDistance'. This number
@@ -1285,7 +1101,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1285 /// <param name="xPlace">X position in the region to send surrounding parcel layer info</param> 1101 /// <param name="xPlace">X position in the region to send surrounding parcel layer info</param>
1286 /// <param name="yPlace">y position in the region to send surrounding parcel layer info</param> 1102 /// <param name="yPlace">y position in the region to send surrounding parcel layer info</param>
1287 /// <param name="layerViewDistance">Distance from x,y position to send parcel layer info</param> 1103 /// <param name="layerViewDistance">Distance from x,y position to send parcel layer info</param>
1288 private void SendParcelOverlay(IClientAPI remote_client, int xPlace, int yPlace, int layerViewDistance) 1104 public void SendParcelOverlay(IClientAPI remote_client)
1289 { 1105 {
1290 if (remote_client.SceneAgent.PresenceType == PresenceType.Npc) 1106 if (remote_client.SceneAgent.PresenceType == PresenceType.Npc)
1291 return; 1107 return;
@@ -1295,149 +1111,18 @@ namespace OpenSim.Region.CoreModules.World.Land
1295 byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; 1111 byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET];
1296 int byteArrayCount = 0; 1112 int byteArrayCount = 0;
1297 int sequenceID = 0; 1113 int sequenceID = 0;
1298<<<<<<< HEAD
1299
1300 int xLow = 0;
1301 int xHigh = (int)m_scene.RegionInfo.RegionSizeX;
1302 int yLow = 0;
1303 int yHigh = (int)m_scene.RegionInfo.RegionSizeY;
1304
1305 if (shouldLimitParcelLayerInfoToViewDistance)
1306 {
1307 // Compute view distance around the given point
1308 int txLow = xPlace - layerViewDistance;
1309 int txHigh = xPlace + layerViewDistance;
1310 // If the distance is outside the region area, move the view distance to ba all in the region
1311 if (txLow < xLow)
1312=======
1313 1114
1314 // Layer data is in landUnit (4m) chunks 1115 // Layer data is in LandUnit (4m) chunks
1315 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += landUnit) 1116 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += LandUnit)
1316 { 1117 {
1317 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += landUnit) 1118 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += LandUnit)
1318>>>>>>> avn/ubitvar
1319 { 1119 {
1320 txLow = xLow; 1120 byte tempByte = 0; //This represents the byte for the current 4x4
1321 txHigh = Math.Min(yLow + (layerViewDistance * 2), xHigh);
1322 }
1323 if (txHigh > xHigh)
1324 {
1325 txLow = Math.Max(xLow, xHigh - (layerViewDistance * 2));
1326 txHigh = xHigh;
1327 }
1328 xLow = txLow;
1329 xHigh = txHigh;
1330 1121
1331<<<<<<< HEAD
1332 int tyLow = yPlace - layerViewDistance;
1333 int tyHigh = yPlace + layerViewDistance;
1334 if (tyLow < yLow)
1335 {
1336 tyLow = yLow;
1337 tyHigh = Math.Min(yLow + (layerViewDistance * 2), yHigh);
1338 }
1339 if (tyHigh > yHigh)
1340 {
1341 tyLow = Math.Max(yLow, yHigh - (layerViewDistance * 2));
1342 tyHigh = yHigh;
1343 }
1344 yLow = tyLow;
1345 yHigh = tyHigh;
1346 }
1347 // m_log.DebugFormat("{0} SendParcelOverlay: place=<{1},{2}>, vDist={3}, xLH=<{4},{5}, yLH=<{6},{7}>",
1348 // LogHeader, xPlace, yPlace, layerViewDistance, xLow, xHigh, yLow, yHigh);
1349=======
1350 ILandObject currentParcelBlock = GetLandObject(x, y); 1122 ILandObject currentParcelBlock = GetLandObject(x, y);
1351>>>>>>> avn/ubitvar
1352 1123
1353 // Layer data is in landUnit (4m) chunks 1124 if (currentParcelBlock != null)
1354 for (int y = yLow; y < yHigh / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++)
1355 {
1356 for (int x = xLow; x < xHigh / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++)
1357 {
1358 byteArray[byteArrayCount] = BuildLayerByte(GetLandObject(x * LandUnit, y * LandUnit), x, y, remote_client);
1359 byteArrayCount++;
1360 if (byteArrayCount >= LAND_BLOCKS_PER_PACKET)
1361 { 1125 {
1362<<<<<<< HEAD
1363 // m_log.DebugFormat("{0} SendParcelOverlay, sending packet, bytes={1}", LogHeader, byteArray.Length);
1364 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1365 byteArrayCount = 0;
1366 sequenceID++;
1367 byteArray = new byte[LAND_BLOCKS_PER_PACKET];
1368 }
1369
1370 }
1371 }
1372
1373 if (byteArrayCount != 0)
1374 {
1375 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1376 // m_log.DebugFormat("{0} SendParcelOverlay, complete sending packet, bytes={1}", LogHeader, byteArray.Length);
1377 }
1378 }
1379
1380 private byte BuildLayerByte(ILandObject currentParcelBlock, int x, int y, IClientAPI remote_client)
1381 {
1382 byte tempByte = 0; //This represents the byte for the current 4x4
1383
1384 if (currentParcelBlock != null)
1385 {
1386 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId)
1387 {
1388 //Owner Flag
1389 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER);
1390 }
1391 else if (currentParcelBlock.LandData.SalePrice > 0 &&
1392 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero ||
1393 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId))
1394 {
1395 //Sale Flag
1396 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_IS_FOR_SALE);
1397 }
1398 else if (currentParcelBlock.LandData.OwnerID == UUID.Zero)
1399 {
1400 //Public Flag
1401 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_PUBLIC);
1402 }
1403 else
1404 {
1405 //Other Flag
1406 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_OTHER);
1407 }
1408
1409 //Now for border control
1410
1411 ILandObject westParcel = null;
1412 ILandObject southParcel = null;
1413 if (x > 0)
1414 {
1415 westParcel = GetLandObject((x - 1) * LandUnit, y * LandUnit);
1416 }
1417 if (y > 0)
1418 {
1419 southParcel = GetLandObject(x * LandUnit, (y - 1) * LandUnit);
1420 }
1421
1422 if (x == 0)
1423 {
1424 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST);
1425 }
1426 else if (westParcel != null && westParcel != currentParcelBlock)
1427 {
1428 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST);
1429 }
1430
1431 if (y == 0)
1432 {
1433 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH);
1434 }
1435 else if (southParcel != null && southParcel != currentParcelBlock)
1436 {
1437 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH);
1438 }
1439
1440=======
1441 // types 1126 // types
1442 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId) 1127 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId)
1443 { 1128 {
@@ -1525,10 +1210,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1525 if (byteArrayCount > 0) 1210 if (byteArrayCount > 0)
1526 { 1211 {
1527 remote_client.SendLandParcelOverlay(byteArray, sequenceID); 1212 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1528>>>>>>> avn/ubitvar
1529 } 1213 }
1530
1531 return tempByte;
1532 } 1214 }
1533 1215
1534 public void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, 1216 public void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id,
@@ -1569,10 +1251,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1569 temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client); 1251 temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client);
1570 } 1252 }
1571 1253
1572<<<<<<< HEAD
1573 // Also send the layer data around the point of interest
1574 SendParcelOverlay(remote_client, (start_x + end_x) / 2, (start_y + end_y) / 2, parcelLayerViewDistance);
1575=======
1576// SendParcelOverlay(remote_client); 1254// SendParcelOverlay(remote_client);
1577 } 1255 }
1578 1256
@@ -1612,7 +1290,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1612 avatar.currentParcelUUID = parcelID; // force parcel flags review 1290 avatar.currentParcelUUID = parcelID; // force parcel flags review
1613 }); 1291 });
1614 } 1292 }
1615>>>>>>> avn/ubitvar
1616 } 1293 }
1617 1294
1618 public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client) 1295 public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client)
@@ -1821,35 +1498,17 @@ namespace OpenSim.Region.CoreModules.World.Land
1821 for (int i = 0; i < data.Count; i++) 1498 for (int i = 0; i < data.Count; i++)
1822 IncomingLandObjectFromStorage(data[i]); 1499 IncomingLandObjectFromStorage(data[i]);
1823 1500
1824<<<<<<< HEAD 1501 // Layer data is in LandUnit (4m) chunks
1825 // Prevent race conditions from any auto-creation of new parcels for varregions whilst we are still loading
1826 // the existing parcels.
1827 lock (m_landList)
1828 {
1829 for (int i = 0; i < data.Count; i++)
1830 IncomingLandObjectFromStorage(data[i]);
1831
1832 // Layer data is in landUnit (4m) chunks
1833 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++) 1502 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++)
1834 { 1503 {
1835 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++) 1504 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++)
1836=======
1837 // Layer data is in landUnit (4m) chunks
1838 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); y++)
1839 {
1840 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); x++)
1841>>>>>>> avn/ubitvar
1842 { 1505 {
1843 if (m_landIDList[x, y] == 0) 1506 if (m_landIDList[x, y] == 0)
1844 { 1507 {
1845 if (m_landList.Count == 1) 1508 if (m_landList.Count == 1)
1846 { 1509 {
1847 m_log.DebugFormat( 1510 m_log.DebugFormat(
1848<<<<<<< HEAD
1849 "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}",
1850=======
1851 "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}", 1511 "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}",
1852>>>>>>> avn/ubitvar
1853 LogHeader, x, y, m_scene.Name); 1512 LogHeader, x, y, m_scene.Name);
1854 1513
1855 int onlyParcelID = 0; 1514 int onlyParcelID = 0;
@@ -1872,19 +1531,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1872 else if (m_landList.Count > 1) 1531 else if (m_landList.Count > 1)
1873 { 1532 {
1874 m_log.DebugFormat( 1533 m_log.DebugFormat(
1875<<<<<<< HEAD
1876 "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}",
1877 LogHeader, x, y, m_scene.Name);
1878
1879 // There are several other parcels so we must create a new one for the unassigned space
1880 ILandObject newLand = new LandObject(UUID.Zero, false, m_scene);
1881=======
1882 "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}", 1534 "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}",
1883 LogHeader, x, y, m_scene.Name); 1535 LogHeader, x, y, m_scene.Name);
1884 1536
1885 // There are several other parcels so we must create a new one for the unassigned space 1537 // There are several other parcels so we must create a new one for the unassigned space
1886 ILandObject newLand = new LandObject(UUID.Zero, false, m_scene); 1538 ILandObject newLand = new LandObject(UUID.Zero, false, m_scene);
1887>>>>>>> avn/ubitvar
1888 // Claim all the unclaimed "0" ids 1539 // Claim all the unclaimed "0" ids
1889 newLand.SetLandBitmap(CreateBitmapForID(0)); 1540 newLand.SetLandBitmap(CreateBitmapForID(0));
1890 newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 1541 newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
@@ -1895,11 +1546,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1895 { 1546 {
1896 // We should never reach this point as the separate code path when no land data exists should have fired instead. 1547 // We should never reach this point as the separate code path when no land data exists should have fired instead.
1897 m_log.WarnFormat( 1548 m_log.WarnFormat(
1898<<<<<<< HEAD
1899 "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present",
1900=======
1901 "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present", 1549 "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present",
1902>>>>>>> avn/ubitvar
1903 LogHeader, m_scene.Name); 1550 LogHeader, m_scene.Name);
1904 } 1551 }
1905 } 1552 }
@@ -1910,13 +1557,9 @@ namespace OpenSim.Region.CoreModules.World.Land
1910 1557
1911 private void IncomingLandObjectFromStorage(LandData data) 1558 private void IncomingLandObjectFromStorage(LandData data)
1912 { 1559 {
1913<<<<<<< HEAD
1914 ILandObject new_land = new LandObject(data, m_scene);
1915=======
1916
1917 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); 1560 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
1918 new_land.LandData = data.Copy(); 1561 new_land.LandData = data.Copy();
1919>>>>>>> avn/ubitvar 1562
1920 new_land.SetLandBitmapFromByteArray(); 1563 new_land.SetLandBitmapFromByteArray();
1921 AddLandObject(new_land); 1564 AddLandObject(new_land);
1922// new_land.SendLandUpdateToAvatarsOverMe(); 1565// new_land.SendLandUpdateToAvatarsOverMe();
@@ -2568,17 +2211,6 @@ namespace OpenSim.Region.CoreModules.World.Land
2568 2211
2569 private void AppendParcelsSummaryReport(StringBuilder report) 2212 private void AppendParcelsSummaryReport(StringBuilder report)
2570 { 2213 {
2571<<<<<<< HEAD
2572 report.AppendFormat("Land information for {0}\n", m_scene.Name);
2573
2574 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
2575 cdt.AddColumn("Parcel Name", ConsoleDisplayUtil.ParcelNameSize);
2576 cdt.AddColumn("ID", 3);
2577 cdt.AddColumn("Area", 6);
2578 cdt.AddColumn("Starts", ConsoleDisplayUtil.VectorSize);
2579 cdt.AddColumn("Ends", ConsoleDisplayUtil.VectorSize);
2580 cdt.AddColumn("Owner", ConsoleDisplayUtil.UserNameSize);
2581=======
2582 report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); 2214 report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName);
2583 report.AppendFormat( 2215 report.AppendFormat(
2584 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", 2216 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n",
@@ -2588,27 +2220,12 @@ namespace OpenSim.Region.CoreModules.World.Land
2588 "AABBMin", 2220 "AABBMin",
2589 "AABBMax", 2221 "AABBMax",
2590 "Owner"); 2222 "Owner");
2591>>>>>>> avn/ubitvar
2592 2223
2593 lock (m_landList) 2224 lock (m_landList)
2594 { 2225 {
2595 foreach (ILandObject lo in m_landList.Values) 2226 foreach (ILandObject lo in m_landList.Values)
2596 { 2227 {
2597 LandData ld = lo.LandData; 2228 LandData ld = lo.LandData;
2598<<<<<<< HEAD
2599 string ownerName;
2600 if (ld.IsGroupOwned)
2601 {
2602 GroupRecord rec = m_groupManager.GetGroupRecord(ld.GroupID);
2603 ownerName = (rec != null) ? rec.GroupName : "Unknown Group";
2604 }
2605 else
2606 {
2607 ownerName = m_userManager.GetUserName(ld.OwnerID);
2608 }
2609 cdt.AddRow(
2610 ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, ownerName);
2611=======
2612 2229
2613 report.AppendFormat( 2230 report.AppendFormat(
2614 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", 2231 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n",
@@ -2636,11 +2253,8 @@ namespace OpenSim.Region.CoreModules.World.Land
2636 else 2253 else
2637 { 2254 {
2638 ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); 2255 ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition);
2639>>>>>>> avn/ubitvar
2640 } 2256 }
2641 } 2257 }
2642
2643 report.Append(cdt.ToString());
2644 } 2258 }
2645 2259
2646 private void AppendParcelReport(StringBuilder report, ILandObject lo) 2260 private void AppendParcelReport(StringBuilder report, ILandObject lo)
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 3b81d6b..040c90b 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -46,20 +46,12 @@ namespace OpenSim.Region.CoreModules.World.Land
46 46
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 private static readonly string LogHeader = "[LAND OBJECT]"; 48 private static readonly string LogHeader = "[LAND OBJECT]";
49<<<<<<< HEAD
50
51 private readonly int landUnit = 4;
52
53 private int m_lastSeqId = 0;
54
55=======
56 49
57 private readonly int landUnit = 4; 50 private readonly int landUnit = 4;
58 51
59 private int m_lastSeqId = 0; 52 private int m_lastSeqId = 0;
60 private int m_expiryCounter = 0; 53 private int m_expiryCounter = 0;
61 54
62>>>>>>> avn/ubitvar
63 protected Scene m_scene; 55 protected Scene m_scene;
64 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); 56 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
65 protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); 57 protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>();
@@ -67,16 +59,12 @@ namespace OpenSim.Region.CoreModules.World.Land
67 protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>(); 59 protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>();
68 protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds 60 protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds
69 61
70<<<<<<< HEAD
71 public bool[,] LandBitmap { get; set; }
72=======
73 private bool[,] m_landBitmap; 62 private bool[,] m_landBitmap;
74 public bool[,] LandBitmap 63 public bool[,] LandBitmap
75 { 64 {
76 get { return m_landBitmap; } 65 get { return m_landBitmap; }
77 set { m_landBitmap = value; } 66 set { m_landBitmap = value; }
78 } 67 }
79>>>>>>> avn/ubitvar
80 68
81 #endregion 69 #endregion
82 70
@@ -87,9 +75,6 @@ namespace OpenSim.Region.CoreModules.World.Land
87 return free; 75 return free;
88 } 76 }
89 77
90<<<<<<< HEAD
91 public LandData LandData { get; set; }
92=======
93 protected LandData m_landData; 78 protected LandData m_landData;
94 public LandData LandData 79 public LandData LandData
95 { 80 {
@@ -97,7 +82,6 @@ namespace OpenSim.Region.CoreModules.World.Land
97 82
98 set { m_landData = value; } 83 set { m_landData = value; }
99 } 84 }
100>>>>>>> avn/ubitvar
101 85
102 public IPrimCounts PrimCounts { get; set; } 86 public IPrimCounts PrimCounts { get; set; }
103 87
@@ -225,12 +209,6 @@ namespace OpenSim.Region.CoreModules.World.Land
225 else 209 else
226 { 210 {
227 // Normal Calculations 211 // Normal Calculations
228<<<<<<< HEAD
229 int parcelMax = (int)(((float)LandData.Area / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY))
230 * (float)m_scene.RegionInfo.ObjectCapacity
231 * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
232 // TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL!
233=======
234 int parcelMax = (int)( (long)LandData.Area 212 int parcelMax = (int)( (long)LandData.Area
235 * (long)m_scene.RegionInfo.ObjectCapacity 213 * (long)m_scene.RegionInfo.ObjectCapacity
236 * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus 214 * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus
@@ -252,7 +230,6 @@ namespace OpenSim.Region.CoreModules.World.Land
252 int parcelMax = (int)((long)LandData.Area 230 int parcelMax = (int)((long)LandData.Area
253 * (long)m_scene.RegionInfo.ObjectCapacity 231 * (long)m_scene.RegionInfo.ObjectCapacity
254 / 65536L); 232 / 65536L);
255>>>>>>> avn/ubitvar
256 return parcelMax; 233 return parcelMax;
257 } 234 }
258 } 235 }
@@ -266,15 +243,10 @@ namespace OpenSim.Region.CoreModules.World.Land
266 else 243 else
267 { 244 {
268 //Normal Calculations 245 //Normal Calculations
269<<<<<<< HEAD
270 int simMax = (int)(((float)LandData.SimwideArea / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY))
271 * (float)m_scene.RegionInfo.ObjectCapacity);
272=======
273 int simMax = (int)( (long)LandData.SimwideArea 246 int simMax = (int)( (long)LandData.SimwideArea
274 * (long)m_scene.RegionInfo.ObjectCapacity 247 * (long)m_scene.RegionInfo.ObjectCapacity
275 / (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) ); 248 / (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) );
276 // m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}", LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax); 249 // m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}", LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax);
277>>>>>>> avn/ubitvar
278 return simMax; 250 return simMax;
279 } 251 }
280 } 252 }
@@ -439,12 +411,6 @@ namespace OpenSim.Region.CoreModules.World.Land
439 { 411 {
440 uint preserve = LandData.Flags & ~allowedDelta; 412 uint preserve = LandData.Flags & ~allowedDelta;
441 newData.Flags = preserve | (args.ParcelFlags & allowedDelta); 413 newData.Flags = preserve | (args.ParcelFlags & allowedDelta);
442<<<<<<< HEAD
443
444 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
445 SendLandUpdateToAvatarsOverMe(snap_selection);
446 }
447=======
448 414
449 uint curdelta = LandData.Flags ^ newData.Flags; 415 uint curdelta = LandData.Flags ^ newData.Flags;
450 curdelta &= (uint)(ParcelFlags.SoundLocal); 416 curdelta &= (uint)(ParcelFlags.SoundLocal);
@@ -456,7 +422,6 @@ namespace OpenSim.Region.CoreModules.World.Land
456 return true; 422 return true;
457 } 423 }
458 return false; 424 return false;
459>>>>>>> avn/ubitvar
460 } 425 }
461 426
462 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) 427 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area)
@@ -806,17 +771,11 @@ namespace OpenSim.Region.CoreModules.World.Land
806 /// </summary> 771 /// </summary>
807 private void UpdateAABBAndAreaValues() 772 private void UpdateAABBAndAreaValues()
808 { 773 {
809<<<<<<< HEAD 774
810 int min_x = 10000;
811 int min_y = 10000;
812 int max_x = 0;
813 int max_y = 0;
814=======
815 int min_x = Int32.MaxValue; 775 int min_x = Int32.MaxValue;
816 int min_y = Int32.MaxValue; 776 int min_y = Int32.MaxValue;
817 int max_x = Int32.MinValue; 777 int max_x = Int32.MinValue;
818 int max_y = Int32.MinValue; 778 int max_y = Int32.MinValue;
819>>>>>>> avn/ubitvar
820 int tempArea = 0; 779 int tempArea = 0;
821 int x, y; 780 int x, y;
822 for (x = 0; x < LandBitmap.GetLength(0); x++) 781 for (x = 0; x < LandBitmap.GetLength(0); x++)
@@ -825,12 +784,6 @@ namespace OpenSim.Region.CoreModules.World.Land
825 { 784 {
826 if (LandBitmap[x, y] == true) 785 if (LandBitmap[x, y] == true)
827 { 786 {
828<<<<<<< HEAD
829 if (min_x > x) min_x = x;
830 if (min_y > y) min_y = y;
831 if (max_x < x) max_x = x;
832 if (max_y < y) max_y = y;
833=======
834 if (min_x > x) 787 if (min_x > x)
835 min_x = x; 788 min_x = x;
836 if (min_y > y) 789 if (min_y > y)
@@ -839,7 +792,6 @@ namespace OpenSim.Region.CoreModules.World.Land
839 max_x = x; 792 max_x = x;
840 if (max_y < y) 793 if (max_y < y)
841 max_y = y; 794 max_y = y;
842>>>>>>> avn/ubitvar
843 tempArea += landUnit * landUnit; //16sqm peice of land 795 tempArea += landUnit * landUnit; //16sqm peice of land
844 } 796 }
845 } 797 }
@@ -847,27 +799,6 @@ namespace OpenSim.Region.CoreModules.World.Land
847 int tx = min_x * landUnit; 799 int tx = min_x * landUnit;
848 if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1)) 800 if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1))
849 tx = ((int)m_scene.RegionInfo.RegionSizeX - 1); 801 tx = ((int)m_scene.RegionInfo.RegionSizeX - 1);
850<<<<<<< HEAD
851 int ty = min_y * landUnit;
852 if (ty > ((int)m_scene.RegionInfo.RegionSizeY - 1))
853 ty = ((int)m_scene.RegionInfo.RegionSizeY - 1);
854
855 LandData.AABBMin =
856 new Vector3(
857 (float)(min_x * landUnit), (float)(min_y * landUnit), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0);
858
859 tx = max_x * landUnit;
860 if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1))
861 tx = ((int)m_scene.RegionInfo.RegionSizeX - 1);
862 ty = max_y * landUnit;
863 if (ty > ((int)m_scene.RegionInfo.RegionSizeY - 1))
864 ty = ((int)m_scene.RegionInfo.RegionSizeY - 1);
865
866 LandData.AABBMax
867 = new Vector3(
868 (float)(max_x * landUnit), (float)(max_y * landUnit), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0);
869=======
870
871 int htx; 802 int htx;
872 if (tx >= ((int)m_scene.RegionInfo.RegionSizeX)) 803 if (tx >= ((int)m_scene.RegionInfo.RegionSizeX))
873 htx = (int)m_scene.RegionInfo.RegionSizeX - 1; 804 htx = (int)m_scene.RegionInfo.RegionSizeX - 1;
@@ -904,7 +835,6 @@ namespace OpenSim.Region.CoreModules.World.Land
904 LandData.AABBMax 835 LandData.AABBMax
905 = new Vector3( 836 = new Vector3(
906 (float)(tx), (float)(ty), m_scene != null ? (float)m_scene.Heightmap[htx, hty] : 0); 837 (float)(tx), (float)(ty), m_scene != null ? (float)m_scene.Heightmap[htx, hty] : 0);
907>>>>>>> avn/ubitvar
908 838
909 LandData.Area = tempArea; 839 LandData.Area = tempArea;
910 } 840 }
@@ -920,10 +850,6 @@ namespace OpenSim.Region.CoreModules.World.Land
920 public void SetLandBitmap(bool[,] bitmap) 850 public void SetLandBitmap(bool[,] bitmap)
921 { 851 {
922 LandBitmap = bitmap; 852 LandBitmap = bitmap;
923<<<<<<< HEAD
924 // m_log.DebugFormat("{0} SetLandBitmap. BitmapSize=<{1},{2}>", LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1));
925=======
926>>>>>>> avn/ubitvar
927 ForceUpdateLandInfo(); 853 ForceUpdateLandInfo();
928 } 854 }
929 855
@@ -1024,16 +950,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1024 private byte[] ConvertLandBitmapToBytes() 950 private byte[] ConvertLandBitmapToBytes()
1025 { 951 {
1026 byte[] tempConvertArr = new byte[LandBitmap.GetLength(0) * LandBitmap.GetLength(1) / 8]; 952 byte[] tempConvertArr = new byte[LandBitmap.GetLength(0) * LandBitmap.GetLength(1) / 8];
1027<<<<<<< HEAD 953
1028 byte tempByte = 0;
1029 int byteNum = 0;
1030 int i = 0;
1031=======
1032 int tempByte = 0; 954 int tempByte = 0;
1033 int i, byteNum = 0; 955 int i, byteNum = 0;
1034 int mask = 1; 956 int mask = 1;
1035 i = 0; 957 i = 0;
1036>>>>>>> avn/ubitvar
1037 for (int y = 0; y < LandBitmap.GetLength(1); y++) 958 for (int y = 0; y < LandBitmap.GetLength(1); y++)
1038 { 959 {
1039 for (int x = 0; x < LandBitmap.GetLength(0); x++) 960 for (int x = 0; x < LandBitmap.GetLength(0); x++)
@@ -1070,7 +991,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1070 // LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1)); 991 // LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1));
1071======= 992=======
1072 */ 993 */
1073>>>>>>> avn/ubitvar
1074 return tempConvertArr; 994 return tempConvertArr;
1075 } 995 }
1076 996
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
index a228e7a..5155804 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
@@ -104,7 +104,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
104 104
105 terrainRenderer.Initialise(m_scene, m_config); 105 terrainRenderer.Initialise(m_scene, m_config);
106 106
107<<<<<<< HEAD
108 mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, 107 mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height,
109 System.Drawing.Imaging.PixelFormat.Format24bppRgb); 108 System.Drawing.Imaging.PixelFormat.Format24bppRgb);
110 //long t = System.Environment.TickCount; 109 //long t = System.Environment.TickCount;
@@ -113,17 +112,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
113 //} 112 //}
114 //t = System.Environment.TickCount - t; 113 //t = System.Environment.TickCount - t;
115 //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); 114 //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
116=======
117 mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height,
118 System.Drawing.Imaging.PixelFormat.Format24bppRgb);
119 //long t = System.Environment.TickCount;
120 //for (int i = 0; i < 10; ++i) {
121 terrainRenderer.TerrainToBitmap(mapbmp);
122 //}
123 //t = System.Environment.TickCount - t;
124 //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
125>>>>>>> avn/ubitvar
126
127 if (drawPrimVolume) 115 if (drawPrimVolume)
128 { 116 {
129 DrawObjectVolume(m_scene, mapbmp); 117 DrawObjectVolume(m_scene, mapbmp);
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
index a9cc993..0ec2053 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
@@ -270,14 +270,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
270 270
271 // the heigthfield might have some jumps in values. Rendered land is smooth, though, 271 // the heigthfield might have some jumps in values. Rendered land is smooth, though,
272 // as a slope is rendered at that place. So average 4 neighbour values to emulate that. 272 // as a slope is rendered at that place. So average 4 neighbour values to emulate that.
273<<<<<<< HEAD
274 private float getHeight(ITerrainChannel hm, int x, int y) { 273 private float getHeight(ITerrainChannel hm, int x, int y) {
275 if (x < (hm.Width - 1) && y < (hm.Height - 1)) 274 if (x < (hm.Width - 1) && y < (hm.Height - 1))
276=======
277 private float getHeight(ITerrainChannel hm, int x, int y)
278 {
279 if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1))
280>>>>>>> avn/ubitvar
281 return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112); 275 return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112);
282 else 276 else
283 return (float)hm[x, y]; 277 return (float)hm[x, y];
@@ -294,14 +288,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
294 if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height) 288 if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height)
295 { 289 {
296 m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>", 290 m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>",
297 LogHeader, mapbmp.Width, mapbmp.Height, hm.Width, hm.Height);
298 }
299
300 ITerrainChannel hm = m_scene.Heightmap;
301
302 if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height)
303 {
304 m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>",
305 "[TEXTURED MAP TILE RENDERER]", mapbmp.Width, mapbmp.Height, hm.Width, hm.Height); 291 "[TEXTURED MAP TILE RENDERER]", mapbmp.Width, mapbmp.Height, hm.Width, hm.Height);
306 } 292 }
307 293
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs
index 236584a..d634e8b 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs
@@ -46,10 +46,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
46 if (fillArea[x, y]) 46 if (fillArea[x, y])
47 { 47 {
48 double noise = TerrainUtil.PerlinNoise2D((double) x / map.Width, (double) y / map.Height, 8, 1.0); 48 double noise = TerrainUtil.PerlinNoise2D((double) x / map.Width, (double) y / map.Height, 8, 1.0);
49<<<<<<< HEAD
50
51=======
52>>>>>>> avn/ubitvar
53 map[x, y] += noise * strength; 49 map[x, y] += noise * strength;
54 } 50 }
55 } 51 }
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 925de2a..22723fc 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -75,15 +75,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
75 #endregion 75 #endregion
76 76
77 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 77 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
78<<<<<<< HEAD
79=======
80
81#pragma warning disable 414
82 private static readonly string LogHeader = "[TERRAIN MODULE]";
83#pragma warning restore 414
84
85 private readonly Commander m_commander = new Commander("terrain");
86>>>>>>> avn/ubitvar
87 78
88#pragma warning disable 414 79#pragma warning disable 414
89 private static readonly string LogHeader = "[TERRAIN MODULE]"; 80 private static readonly string LogHeader = "[TERRAIN MODULE]";
@@ -95,16 +86,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
95 private readonly Dictionary<string, ITerrainLoader> m_loaders = new Dictionary<string, ITerrainLoader>(); 86 private readonly Dictionary<string, ITerrainLoader> m_loaders = new Dictionary<string, ITerrainLoader>();
96 private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects = 87 private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects =
97 new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>(); 88 new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>();
98<<<<<<< HEAD
99 private Dictionary<string, ITerrainEffect> m_plugineffects;
100 private Dictionary<string, ITerrainModifier> m_modifyOperations =
101 new Dictionary<string, ITerrainModifier>();
102 private ITerrainChannel m_channel;
103 private ITerrainChannel m_revert;
104 private Scene m_scene;
105 private volatile bool m_tainted;
106 private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5);
107=======
108 89
109 private Dictionary<string, ITerrainEffect> m_plugineffects; 90 private Dictionary<string, ITerrainEffect> m_plugineffects;
110 private ITerrainChannel m_channel; 91 private ITerrainChannel m_channel;
@@ -112,7 +93,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
112 private Scene m_scene; 93 private Scene m_scene;
113 private volatile bool m_tainted; 94 private volatile bool m_tainted;
114 95
115>>>>>>> avn/ubitvar
116 private String m_InitialTerrain = "pinhead-island"; 96 private String m_InitialTerrain = "pinhead-island";
117 97
118 // If true, send terrain patch updates to clients based on their view distance 98 // If true, send terrain patch updates to clients based on their view distance
@@ -126,19 +106,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
126 private bool[,] updated; // for each patch, whether it needs to be sent to this client 106 private bool[,] updated; // for each patch, whether it needs to be sent to this client
127 private int updateCount; // number of patches that need to be sent 107 private int updateCount; // number of patches that need to be sent
128 public ScenePresence Presence; // a reference to the client to send to 108 public ScenePresence Presence; // a reference to the client to send to
129<<<<<<< HEAD 109
130 public TerrainData Terrain; // reference to the underlying terrain
131=======
132>>>>>>> avn/ubitvar
133 public PatchUpdates(TerrainData terrData, ScenePresence pPresence) 110 public PatchUpdates(TerrainData terrData, ScenePresence pPresence)
134 { 111 {
135 updated = new bool[terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize]; 112 updated = new bool[terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize];
136 updateCount = 0; 113 updateCount = 0;
137 Presence = pPresence; 114 Presence = pPresence;
138<<<<<<< HEAD
139 Terrain = terrData;
140=======
141>>>>>>> avn/ubitvar
142 // Initially, send all patches to the client 115 // Initially, send all patches to the client
143 SetAll(true); 116 SetAll(true);
144 } 117 }
@@ -147,26 +120,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain
147 { 120 {
148 return (updateCount > 0); 121 return (updateCount > 0);
149 } 122 }
150<<<<<<< HEAD
151 123
152=======
153>>>>>>> avn/ubitvar
154 public void SetByXY(int x, int y, bool state) 124 public void SetByXY(int x, int y, bool state)
155 { 125 {
156 this.SetByPatch(x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, state); 126 this.SetByPatch(x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, state);
157 } 127 }
158<<<<<<< HEAD
159 128
160=======
161>>>>>>> avn/ubitvar
162 public bool GetByPatch(int patchX, int patchY) 129 public bool GetByPatch(int patchX, int patchY)
163 { 130 {
164 return updated[patchX, patchY]; 131 return updated[patchX, patchY];
165 } 132 }
166<<<<<<< HEAD
167 133
168=======
169>>>>>>> avn/ubitvar
170 public void SetByPatch(int patchX, int patchY, bool state) 134 public void SetByPatch(int patchX, int patchY, bool state)
171 { 135 {
172 bool prevState = updated[patchX, patchY]; 136 bool prevState = updated[patchX, patchY];
@@ -176,24 +140,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain
176 updateCount--; 140 updateCount--;
177 updated[patchX, patchY] = state; 141 updated[patchX, patchY] = state;
178 } 142 }
179<<<<<<< HEAD
180 143
181 public void SetAll(bool state) 144 public void SetAll(bool state)
182 { 145 {
183 updateCount = 0; 146 updateCount = 0;
184 for(int xx = 0; xx < updated.GetLength(0); xx++)
185 for(int yy = 0; yy < updated.GetLength(1); yy++)
186=======
187 public void SetAll(bool state)
188 {
189 updateCount = 0;
190 for (int xx = 0; xx < updated.GetLength(0); xx++) 147 for (int xx = 0; xx < updated.GetLength(0); xx++)
191 for (int yy = 0; yy < updated.GetLength(1); yy++) 148 for (int yy = 0; yy < updated.GetLength(1); yy++)
192>>>>>>> avn/ubitvar
193 updated[xx, yy] = state; 149 updated[xx, yy] = state;
194 if (state) 150 if (state)
195 updateCount = updated.GetLength(0) * updated.GetLength(1); 151 updateCount = updated.GetLength(0) * updated.GetLength(1);
196 } 152 }
153
197 // Logically OR's the terrain data's patch taint map into this client's update map. 154 // Logically OR's the terrain data's patch taint map into this client's update map.
198 public void SetAll(TerrainData terrData) 155 public void SetAll(TerrainData terrData)
199 { 156 {
@@ -206,15 +163,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain
206 terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize) 163 terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize)
207 ); 164 );
208 } 165 }
209<<<<<<< HEAD 166
210 for(int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize)
211 {
212 for(int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize)
213=======
214 for (int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize) 167 for (int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize)
215 { 168 {
216 for (int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize) 169 for (int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize)
217>>>>>>> avn/ubitvar
218 { 170 {
219 // Only set tainted. The patch bit may be set if the patch was to be sent later. 171 // Only set tainted. The patch bit may be set if the patch was to be sent later.
220 if (terrData.IsTaintedAt(xx, yy, false)) 172 if (terrData.IsTaintedAt(xx, yy, false))
@@ -275,20 +227,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain
275 (int)m_scene.RegionInfo.RegionSizeY, 227 (int)m_scene.RegionInfo.RegionSizeY,
276 (int)m_scene.RegionInfo.RegionSizeZ); 228 (int)m_scene.RegionInfo.RegionSizeZ);
277 m_scene.Heightmap = m_channel; 229 m_scene.Heightmap = m_channel;
278<<<<<<< HEAD 230
279 UpdateRevertMap();
280=======
281 UpdateBakedMap(); 231 UpdateBakedMap();
282>>>>>>> avn/ubitvar
283 } 232 }
284 else 233 else
285 { 234 {
286 m_channel = m_scene.Heightmap; 235 m_channel = m_scene.Heightmap;
287<<<<<<< HEAD
288 UpdateRevertMap();
289=======
290 UpdateBakedMap(); 236 UpdateBakedMap();
291>>>>>>> avn/ubitvar
292 } 237 }
293 238
294 m_scene.RegisterModuleInterface<ITerrainModule>(this); 239 m_scene.RegisterModuleInterface<ITerrainModule>(this);
@@ -296,11 +241,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
296 m_scene.EventManager.OnClientClosed += EventManager_OnClientClosed; 241 m_scene.EventManager.OnClientClosed += EventManager_OnClientClosed;
297 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; 242 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
298 m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick; 243 m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick;
299<<<<<<< HEAD
300 m_scene.EventManager.OnFrame += EventManager_OnFrame;
301=======
302 m_scene.EventManager.OnTerrainCheckUpdates += EventManager_TerrainCheckUpdates; 244 m_scene.EventManager.OnTerrainCheckUpdates += EventManager_TerrainCheckUpdates;
303>>>>>>> avn/ubitvar
304 } 245 }
305 246
306 InstallDefaultEffects(); 247 InstallDefaultEffects();
@@ -339,11 +280,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
339 // remove the commands 280 // remove the commands
340 m_scene.UnregisterModuleCommander(m_commander.Name); 281 m_scene.UnregisterModuleCommander(m_commander.Name);
341 // remove the event-handlers 282 // remove the event-handlers
342<<<<<<< HEAD 283
343 m_scene.EventManager.OnFrame -= EventManager_OnFrame;
344=======
345 m_scene.EventManager.OnTerrainCheckUpdates -= EventManager_TerrainCheckUpdates; 284 m_scene.EventManager.OnTerrainCheckUpdates -= EventManager_TerrainCheckUpdates;
346>>>>>>> avn/ubitvar
347 m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick; 285 m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick;
348 m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; 286 m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole;
349 m_scene.EventManager.OnClientClosed -= EventManager_OnClientClosed; 287 m_scene.EventManager.OnClientClosed -= EventManager_OnClientClosed;
@@ -490,11 +428,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
490 { 428 {
491 ITerrainChannel channel = loader.Value.LoadStream(stream); 429 ITerrainChannel channel = loader.Value.LoadStream(stream);
492 m_channel.Merge(channel, displacement, radianRotation, rotationDisplacement); 430 m_channel.Merge(channel, displacement, radianRotation, rotationDisplacement);
493<<<<<<< HEAD
494 UpdateRevertMap();
495=======
496 UpdateBakedMap(); 431 UpdateBakedMap();
497>>>>>>> avn/ubitvar
498 } 432 }
499 catch(NotImplementedException) 433 catch(NotImplementedException)
500 { 434 {
@@ -574,27 +508,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain
574 508
575 // Someone diddled terrain outside the normal code paths. Set the taintedness for all clients. 509 // Someone diddled terrain outside the normal code paths. Set the taintedness for all clients.
576 // ITerrainModule.TaintTerrain() 510 // ITerrainModule.TaintTerrain()
577<<<<<<< HEAD
578 public void TaintTerrain()
579 {
580 lock(m_perClientPatchUpdates)
581 {
582 // Set the flags for all clients so the tainted patches will be sent out
583 foreach(PatchUpdates pups in m_perClientPatchUpdates.Values)
584=======
585 public void TaintTerrain () 511 public void TaintTerrain ()
586 { 512 {
587 lock (m_perClientPatchUpdates) 513 lock (m_perClientPatchUpdates)
588 { 514 {
589 // Set the flags for all clients so the tainted patches will be sent out 515 // Set the flags for all clients so the tainted patches will be sent out
590 foreach (PatchUpdates pups in m_perClientPatchUpdates.Values) 516 foreach (PatchUpdates pups in m_perClientPatchUpdates.Values)
591>>>>>>> avn/ubitvar
592 { 517 {
593 pups.SetAll(m_scene.Heightmap.GetTerrainData()); 518 pups.SetAll(m_scene.Heightmap.GetTerrainData());
594 } 519 }
595 } 520 }
596<<<<<<< HEAD
597=======
598 } 521 }
599 522
600 // ITerrainModule.PushTerrain() 523 // ITerrainModule.PushTerrain()
@@ -615,38 +538,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
615 pups.SetAll(true); 538 pups.SetAll(true);
616 } 539 }
617 } 540 }
618>>>>>>> avn/ubitvar
619 } 541 }
620 542
621 // ITerrainModule.PushTerrain()
622 public void PushTerrain(IClientAPI pClient)
623 {
624 // If view distance based, set the modified patch bits and the frame event will send the updates
625 if (m_sendTerrainUpdatesByViewDistance)
626 {
627 ScenePresence presence = m_scene.GetScenePresence(pClient.AgentId);
628 if (presence != null)
629 {
630 lock(m_perClientPatchUpdates)
631 {
632 PatchUpdates pups;
633 if (!m_perClientPatchUpdates.TryGetValue(pClient.AgentId, out pups))
634 {
635 // There is a ScenePresence without a send patch map. Create one.
636 pups = new PatchUpdates(m_scene.Heightmap.GetTerrainData(), presence);
637 m_perClientPatchUpdates.Add(presence.UUID, pups);
638 }
639 // By setting all to modified, the next update tick will send the patches
640 pups.SetAll(true);
641 }
642 }
643 }
644 else
645 {
646 // The traditional way is to call into the protocol stack to send them all.
647 pClient.SendLayerData(new float[10]);
648 }
649 }
650 #region Plugin Loading Methods 543 #region Plugin Loading Methods
651 544
652 private void LoadPlugins() 545 private void LoadPlugins()
@@ -750,6 +643,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
750 m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked); 643 m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked);
751 644
752 // Terrain Modifier operations 645 // Terrain Modifier operations
646/*
753 m_modifyOperations["min"] = new MinModifier(this); 647 m_modifyOperations["min"] = new MinModifier(this);
754 m_modifyOperations["max"] = new MaxModifier(this); 648 m_modifyOperations["max"] = new MaxModifier(this);
755 m_modifyOperations["raise"] = new RaiseModifier(this); 649 m_modifyOperations["raise"] = new RaiseModifier(this);
@@ -757,7 +651,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
757 m_modifyOperations["fill"] = new FillModifier(this); 651 m_modifyOperations["fill"] = new FillModifier(this);
758 m_modifyOperations["smooth"] = new SmoothModifier(this); 652 m_modifyOperations["smooth"] = new SmoothModifier(this);
759 m_modifyOperations["noise"] = new NoiseModifier(this); 653 m_modifyOperations["noise"] = new NoiseModifier(this);
760 654*/
761 // Filesystem load/save loaders 655 // Filesystem load/save loaders
762 m_loaders[".r32"] = new RAW32(); 656 m_loaders[".r32"] = new RAW32();
763 m_loaders[".f32"] = m_loaders[".r32"]; 657 m_loaders[".f32"] = m_loaders[".r32"];
@@ -778,24 +672,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
778 /// </summary> 672 /// </summary>
779 public void UpdateBakedMap() 673 public void UpdateBakedMap()
780 { 674 {
781<<<<<<< HEAD
782 /*
783 int x;
784 for (x = 0; x < m_channel.Width; x++)
785 {
786 int y;
787 for (y = 0; y < m_channel.Height; y++)
788 {
789 m_revert[x, y] = m_channel[x, y];
790 }
791 }
792 */
793 m_revert = m_channel.MakeCopy();
794=======
795 m_baked = m_channel.MakeCopy(); 675 m_baked = m_channel.MakeCopy();
796 m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked); 676 m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked);
797 m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked); 677 m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked);
798>>>>>>> avn/ubitvar
799 } 678 }
800 679
801 /// <summary> 680 /// <summary>
@@ -822,13 +701,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
822 { 701 {
823 ITerrainChannel channel = loader.Value.LoadFile(filename, offsetX, offsetY, 702 ITerrainChannel channel = loader.Value.LoadFile(filename, offsetX, offsetY,
824 fileWidth, fileHeight, 703 fileWidth, fileHeight,
825<<<<<<< HEAD
826 (int)m_scene.RegionInfo.RegionSizeX,
827 (int)m_scene.RegionInfo.RegionSizeY);
828=======
829 (int) m_scene.RegionInfo.RegionSizeX, 704 (int) m_scene.RegionInfo.RegionSizeX,
830 (int) m_scene.RegionInfo.RegionSizeY); 705 (int) m_scene.RegionInfo.RegionSizeY);
831>>>>>>> avn/ubitvar
832 m_scene.Heightmap = channel; 706 m_scene.Heightmap = channel;
833 m_channel = channel; 707 m_channel = channel;
834 UpdateBakedMap(); 708 UpdateBakedMap();
@@ -894,27 +768,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
894 } 768 }
895 769
896 /// <summary> 770 /// <summary>
897<<<<<<< HEAD
898 /// Called before processing of every simulation frame.
899=======
900>>>>>>> avn/ubitvar
901 /// This is used to check to see of any of the terrain is tainted and, if so, schedule 771 /// This is used to check to see of any of the terrain is tainted and, if so, schedule
902 /// updates for all the presences. 772 /// updates for all the presences.
903 /// This also checks to see if there are updates that need to be sent for each presence. 773 /// This also checks to see if there are updates that need to be sent for each presence.
904 /// This is where the logic is to send terrain updates to clients. 774 /// This is where the logic is to send terrain updates to clients.
905 /// </summary> 775 /// </summary>
906<<<<<<< HEAD
907 private void EventManager_OnFrame()
908 {
909 TerrainData terrData = m_channel.GetTerrainData();
910
911 bool shouldTaint = false;
912 for(int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize)
913 {
914 for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
915 {
916 if (terrData.IsTaintedAt(x, y))
917=======
918 private void EventManager_TerrainCheckUpdates() 776 private void EventManager_TerrainCheckUpdates()
919 { 777 {
920 // this needs fixing 778 // this needs fixing
@@ -926,7 +784,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
926 for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) 784 for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
927 { 785 {
928 if (terrData.IsTaintedAt(x, y,true)) 786 if (terrData.IsTaintedAt(x, y,true))
929>>>>>>> avn/ubitvar
930 { 787 {
931 // Found a patch that was modified. Push this flag into the clients. 788 // Found a patch that was modified. Push this flag into the clients.
932 SendToClients(terrData, x, y); 789 SendToClients(terrData, x, y);
@@ -944,10 +801,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
944 m_scene.EventManager.TriggerTerrainTainted(); 801 m_scene.EventManager.TriggerTerrainTainted();
945 m_tainted = true; 802 m_tainted = true;
946 } 803 }
947<<<<<<< HEAD
948=======
949
950>>>>>>> avn/ubitvar
951 } 804 }
952 805
953 /// <summary> 806 /// <summary>
@@ -1016,14 +869,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1016 presence.ControllingClient.OnLandUndo -= client_OnLandUndo; 869 presence.ControllingClient.OnLandUndo -= client_OnLandUndo;
1017 presence.ControllingClient.OnUnackedTerrain -= client_OnUnackedTerrain; 870 presence.ControllingClient.OnUnackedTerrain -= client_OnUnackedTerrain;
1018 } 871 }
1019<<<<<<< HEAD
1020
1021 lock(m_perClientPatchUpdates)
1022 m_perClientPatchUpdates.Remove(client);
1023 }
1024=======
1025>>>>>>> avn/ubitvar
1026
1027 lock (m_perClientPatchUpdates) 872 lock (m_perClientPatchUpdates)
1028 m_perClientPatchUpdates.Remove(client); 873 m_perClientPatchUpdates.Remove(client);
1029 } 874 }
@@ -1038,21 +883,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1038 TerrainData terrData = m_channel.GetTerrainData(); 883 TerrainData terrData = m_channel.GetTerrainData();
1039 884
1040 bool wasLimited = false; 885 bool wasLimited = false;
1041<<<<<<< HEAD
1042 for(int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize)
1043 {
1044 for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
1045 {
1046 if (terrData.IsTaintedAt(x, y, false /* clearOnTest */))
1047 {
1048=======
1049 for (int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize) 886 for (int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize)
1050 { 887 {
1051 for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) 888 for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
1052 { 889 {
1053 if (terrData.IsTaintedAt(x, y, false /* clearOnTest */)) 890 if (terrData.IsTaintedAt(x, y, false /* clearOnTest */))
1054 { 891 {
1055>>>>>>> avn/ubitvar
1056 // If we should respect the estate settings then 892 // If we should respect the estate settings then
1057 // fixup and height deltas that don't respect them. 893 // fixup and height deltas that don't respect them.
1058 // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values. 894 // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values.
@@ -1075,22 +911,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1075 float maxDelta = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; 911 float maxDelta = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit;
1076 912
1077 // loop through the height map for this patch and compare it against 913 // loop through the height map for this patch and compare it against
1078<<<<<<< HEAD
1079 // the revert map
1080 for(int x = xStart; x < xStart + Constants.TerrainPatchSize; x++)
1081=======
1082 // the baked map 914 // the baked map
1083 for (int x = xStart; x < xStart + Constants.TerrainPatchSize; x++) 915 for (int x = xStart; x < xStart + Constants.TerrainPatchSize; x++)
1084>>>>>>> avn/ubitvar
1085 { 916 {
1086 for(int y = yStart; y < yStart + Constants.TerrainPatchSize; y++) 917 for(int y = yStart; y < yStart + Constants.TerrainPatchSize; y++)
1087 { 918 {
1088 float requestedHeight = terrData[x, y]; 919 float requestedHeight = terrData[x, y];
1089<<<<<<< HEAD
1090 float bakedHeight = (float)m_revert[x, y];
1091=======
1092 float bakedHeight = (float)m_baked[x, y]; 920 float bakedHeight = (float)m_baked[x, y];
1093>>>>>>> avn/ubitvar
1094 float requestedDelta = requestedHeight - bakedHeight; 921 float requestedDelta = requestedHeight - bakedHeight;
1095 922
1096 if (requestedDelta > maxDelta) 923 if (requestedDelta > maxDelta)
@@ -1111,19 +938,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1111 938
1112 private void client_OnLandUndo(IClientAPI client) 939 private void client_OnLandUndo(IClientAPI client)
1113 { 940 {
1114<<<<<<< HEAD
1115 lock(m_undo)
1116 {
1117 if (m_undo.Count > 0)
1118 {
1119 LandUndoState goback = m_undo.Pop();
1120 if (goback != null)
1121 goback.PlaybackState();
1122 }
1123 }
1124=======
1125
1126>>>>>>> avn/ubitvar
1127 } 941 }
1128 942
1129 /// <summary> 943 /// <summary>
@@ -1133,175 +947,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1133 /// <param name="x">The patch corner to send</param> 947 /// <param name="x">The patch corner to send</param>
1134 /// <param name="y">The patch corner to send</param> 948 /// <param name="y">The patch corner to send</param>
1135 private void SendToClients(TerrainData terrData, int x, int y) 949 private void SendToClients(TerrainData terrData, int x, int y)
1136<<<<<<< HEAD
1137 {
1138 if (m_sendTerrainUpdatesByViewDistance)
1139 {
1140 // Add that this patch needs to be sent to the accounting for each client.
1141 lock(m_perClientPatchUpdates)
1142 {
1143 m_scene.ForEachScenePresence(presence =>
1144 {
1145 PatchUpdates thisClientUpdates;
1146 if (!m_perClientPatchUpdates.TryGetValue(presence.UUID, out thisClientUpdates))
1147 {
1148 // There is a ScenePresence without a send patch map. Create one.
1149 thisClientUpdates = new PatchUpdates(terrData, presence);
1150 m_perClientPatchUpdates.Add(presence.UUID, thisClientUpdates);
1151 }
1152 thisClientUpdates.SetByXY(x, y, true);
1153 }
1154 );
1155 }
1156 }
1157 else
1158 {
1159 // Legacy update sending where the update is sent out as soon as noticed
1160 // We know the actual terrain data that is passed is ignored so this passes a dummy heightmap.
1161 //float[] heightMap = terrData.GetFloatsSerialized();
1162 float[] heightMap = new float[10];
1163 m_scene.ForEachClient(
1164 delegate(IClientAPI controller)
1165 {
1166 controller.SendLayerData(x / Constants.TerrainPatchSize,
1167 y / Constants.TerrainPatchSize,
1168 heightMap);
1169 }
1170 );
1171 }
1172 }
1173
1174 private class PatchesToSend : IComparable<PatchesToSend>
1175 {
1176 public int PatchX;
1177 public int PatchY;
1178 public float Dist;
1179
1180 public PatchesToSend(int pX, int pY, float pDist)
1181 {
1182 PatchX = pX;
1183 PatchY = pY;
1184 Dist = pDist;
1185 }
1186
1187 public int CompareTo(PatchesToSend other)
1188 {
1189 return Dist.CompareTo(other.Dist);
1190 }
1191 }
1192
1193 // Called each frame time to see if there are any patches to send to any of the
1194 // ScenePresences.
1195 // We know this is only called if we are doing view distance patch sending so some
1196 // tests are not made.
1197 // Loop through all the per-client info and send any patches necessary.
1198 private void CheckSendingPatchesToClients()
1199 {
1200 lock(m_perClientPatchUpdates)
1201 {
1202 foreach(PatchUpdates pups in m_perClientPatchUpdates.Values)
1203 {
1204 if (pups.HasUpdates())
1205 {
1206 // There is something that could be sent to this client.
1207 List<PatchesToSend> toSend = GetModifiedPatchesInViewDistance(pups);
1208 if (toSend.Count > 0)
1209 {
1210 // m_log.DebugFormat("{0} CheckSendingPatchesToClient: sending {1} patches to {2} in region {3}",
1211 // LogHeader, toSend.Count, pups.Presence.Name, m_scene.RegionInfo.RegionName);
1212 // Sort the patches to send by the distance from the presence
1213 toSend.Sort();
1214 /* old way that sent individual patches
1215 foreach (PatchesToSend pts in toSend)
1216 {
1217 pups.Presence.ControllingClient.SendLayerData(pts.PatchX, pts.PatchY, null);
1218 // presence.ControllingClient.SendLayerData(xs.ToArray(), ys.ToArray(), null, TerrainPatch.LayerType.Land);
1219 }
1220 */
1221
1222 // new way that sends all patches to the protocol so they can be sent in one block
1223 int[] xPieces = new int[toSend.Count];
1224 int[] yPieces = new int[toSend.Count];
1225 float[] patchPieces = new float[toSend.Count * 2];
1226 int pieceIndex = 0;
1227 foreach(PatchesToSend pts in toSend)
1228 {
1229 patchPieces[pieceIndex++] = pts.PatchX;
1230 patchPieces[pieceIndex++] = pts.PatchY;
1231 }
1232 pups.Presence.ControllingClient.SendLayerData(-toSend.Count, 0, patchPieces);
1233 }
1234 }
1235 }
1236 }
1237 }
1238
1239 // Compute a list of modified patches that are within our view distance.
1240 private List<PatchesToSend> GetModifiedPatchesInViewDistance(PatchUpdates pups)
1241 {
1242 List<PatchesToSend> ret = new List<PatchesToSend>();
1243
1244 ScenePresence presence = pups.Presence;
1245 if (presence == null)
1246 return ret;
1247
1248 Vector3 presencePos = presence.AbsolutePosition;
1249
1250 // Before this distance check, the whole region just showed up. Adding the distance
1251 // check causes different things to happen for the current and adjacent regions.
1252 // So, to keep legacy views, if the region is legacy sized, don't do distance check.
1253 bool isLegacySizedRegion = pups.Terrain.SizeX == Constants.RegionSize && pups.Terrain.SizeY == Constants.RegionSize;
1254 bool shouldCheckViewDistance = m_sendTerrainUpdatesByViewDistance && !isLegacySizedRegion;
1255
1256 int startX = 0;
1257 int endX = (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize;
1258 int startY = 0;
1259 int endY = (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize;
1260
1261 // The following only reduces the size of area scanned for updates. Only significant for very large varregions.
1262 if (shouldCheckViewDistance)
1263 {
1264 // Compute the area of patches within our draw distance
1265 startX = (((int)(presencePos.X - presence.DrawDistance)) / Constants.TerrainPatchSize) - 2;
1266 startX = Math.Max(startX, 0);
1267 startX = Math.Min(startX, (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize);
1268 startY = (((int)(presencePos.Y - presence.DrawDistance)) / Constants.TerrainPatchSize) - 2;
1269 startY = Math.Max(startY, 0);
1270 startY = Math.Min(startY, (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize);
1271 endX = (((int)(presencePos.X + presence.DrawDistance)) / Constants.TerrainPatchSize) + 2;
1272 endX = Math.Max(endX, 0);
1273 endX = Math.Min(endX, (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize);
1274 endY = (((int)(presencePos.Y + presence.DrawDistance)) / Constants.TerrainPatchSize) + 2;
1275 endY = Math.Max(endY, 0);
1276 endY = Math.Min(endY, (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize);
1277 }
1278
1279 // m_log.DebugFormat("{0} GetModifiedPatchesInViewDistance. rName={1}, ddist={2}, apos={3}, cpos={4}, isChild={5}, start=<{6},{7}>, end=<{8},{9}>",
1280 // LogHeader, m_scene.RegionInfo.RegionName,
1281 // presence.DrawDistance, presencePos, presence.CameraPosition,
1282 // isLegacySizeChildRegion,
1283 // startX, startY, endX, endY);
1284 for(int x = startX; x < endX; x++)
1285 {
1286 for(int y = startY; y < endY; y++)
1287 {
1288 //Need to make sure we don't send the same ones over and over
1289 Vector3 patchPos = new Vector3(x * Constants.TerrainPatchSize, y * Constants.TerrainPatchSize, presencePos.Z);
1290 if (pups.GetByPatch(x, y))
1291 {
1292 //Check which has less distance, camera or avatar position, both have to be done.
1293 //Its not a radius, its a diameter and we add 50 so that it doesn't look like it cuts off
1294 if (!shouldCheckViewDistance
1295 || Util.DistanceLessThan(presencePos, patchPos, presence.DrawDistance + 50)
1296 || Util.DistanceLessThan(presence.CameraPosition, patchPos, presence.DrawDistance + 50))
1297 {
1298 //They can see it, send it to them
1299 pups.SetByPatch(x, y, false);
1300 float dist = Vector3.DistanceSquared(presencePos, patchPos);
1301 ret.Add(new PatchesToSend(x, y, dist));
1302 }
1303 }
1304=======
1305 { 950 {
1306 // Add that this patch needs to be sent to the accounting for each client. 951 // Add that this patch needs to be sent to the accounting for each client.
1307 lock (m_perClientPatchUpdates) 952 lock (m_perClientPatchUpdates)
@@ -1475,7 +1120,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1475 } 1120 }
1476 } 1121 }
1477 } 1122 }
1478>>>>>>> avn/ubitvar
1479 } 1123 }
1480 } 1124 }
1481 return ret; 1125 return ret;
@@ -1499,24 +1143,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1499 int zx = (int)(west + 0.5); 1143 int zx = (int)(west + 0.5);
1500 int zy = (int)(north + 0.5); 1144 int zy = (int)(north + 0.5);
1501 1145
1502<<<<<<< HEAD
1503 int dx;
1504 for(dx=-n; dx<=n; dx++)
1505 {
1506 int dy;
1507 for(dy=-n; dy<=n; dy++)
1508 {
1509 int x = zx + dx;
1510 int y = zy + dy;
1511 if (x >= 0 && y >= 0 && x < m_channel.Width && y < m_channel.Height)
1512 {
1513 if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x, y, 0)))
1514 {
1515 allowMask[x, y] = true;
1516 allowed = true;
1517 }
1518=======
1519
1520 int startX = zx - n; 1146 int startX = zx - n;
1521 if (startX < 0) 1147 if (startX < 0)
1522 startX = 0; 1148 startX = 0;
@@ -1542,25 +1168,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1542 { 1168 {
1543 allowMask[x, y] = true; 1169 allowMask[x, y] = true;
1544 allowed = true; 1170 allowed = true;
1545>>>>>>> avn/ubitvar
1546 } 1171 }
1547 } 1172 }
1548 } 1173 }
1549 if (allowed) 1174 if (allowed)
1550 { 1175 {
1551 StoreUndoState(); 1176 StoreUndoState();
1552<<<<<<< HEAD
1553 m_painteffects[(StandardTerrainEffects)action].PaintEffect(
1554 m_channel, allowMask, west, south, height, size, seconds);
1555
1556 //revert changes outside estate limits
1557=======
1558 m_painteffects[(StandardTerrainEffects) action].PaintEffect( 1177 m_painteffects[(StandardTerrainEffects) action].PaintEffect(
1559 m_channel, allowMask, west, south, height, size, seconds, 1178 m_channel, allowMask, west, south, height, size, seconds,
1560 startX, endX, startY, endY); 1179 startX, endX, startY, endY);
1561 1180
1562 //block changes outside estate limits 1181 //block changes outside estate limits
1563>>>>>>> avn/ubitvar
1564 if (!god) 1182 if (!god)
1565 EnforceEstateLimits(); 1183 EnforceEstateLimits();
1566 } 1184 }
@@ -1577,22 +1195,42 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1577 bool[,] fillArea = new bool[m_channel.Width, m_channel.Height]; 1195 bool[,] fillArea = new bool[m_channel.Width, m_channel.Height];
1578 fillArea.Initialize(); 1196 fillArea.Initialize();
1579 1197
1580 int x; 1198 int startX = (int)west;
1581 for(x = 0; x < m_channel.Width; x++) 1199 int startY = (int)south;
1200 int endX = (int)east;
1201 int endY = (int)north;
1202
1203 if (startX < 0)
1204 startX = 0;
1205 else if (startX >= m_channel.Width)
1206 startX = m_channel.Width - 1;
1207
1208 if (endX < 0)
1209 endX = 0;
1210 else if (endX >= m_channel.Width)
1211 endX = m_channel.Width - 1;
1212
1213 if (startY < 0)
1214 startY = 0;
1215 else if (startY >= m_channel.Height)
1216 startY = m_channel.Height - 1;
1217
1218 if (endY < 0)
1219 endY = 0;
1220 else if (endY >= m_channel.Height)
1221 endY = m_channel.Height - 1;
1222
1223
1224 int x, y;
1225
1226 for (x = startX; x <= endX; x++)
1582 { 1227 {
1583 int y; 1228 for (y = startY; y <= endY; y++)
1584 for(y = 0; y < m_channel.Height; y++)
1585 { 1229 {
1586 if (x < east && x > west) 1230 if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x, y, 0)))
1587 { 1231 {
1588 if (y < north && y > south) 1232 fillArea[x, y] = true;
1589 { 1233 allowed = true;
1590 if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x, y, 0)))
1591 {
1592 fillArea[x, y] = true;
1593 allowed = true;
1594 }
1595 }
1596 } 1234 }
1597 } 1235 }
1598 } 1236 }
@@ -1600,15 +1238,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1600 if (allowed) 1238 if (allowed)
1601 { 1239 {
1602 StoreUndoState(); 1240 StoreUndoState();
1603<<<<<<< HEAD 1241 m_floodeffects[(StandardTerrainEffects)action].FloodEffect(m_channel, fillArea, size,
1604 m_floodeffects[(StandardTerrainEffects)action].FloodEffect(m_channel, fillArea, size); 1242 startX, endX, startY, endY);
1605
1606 //revert changes outside estate limits
1607=======
1608 m_floodeffects[(StandardTerrainEffects) action].FloodEffect(m_channel, fillArea, size);
1609 1243
1610 //block changes outside estate limits 1244 //block changes outside estate limits
1611>>>>>>> avn/ubitvar
1612 if (!god) 1245 if (!god)
1613 EnforceEstateLimits(); 1246 EnforceEstateLimits();
1614 } 1247 }
@@ -1641,52 +1274,22 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1641 1274
1642 private void StoreUndoState() 1275 private void StoreUndoState()
1643 { 1276 {
1644<<<<<<< HEAD
1645 lock(m_undo)
1646 {
1647 if (m_undo.Count > 0)
1648 {
1649 LandUndoState last = m_undo.Peek();
1650 if (last != null)
1651 {
1652 if (last.Compare(m_channel))
1653 return;
1654 }
1655 }
1656
1657 LandUndoState nUndo = new LandUndoState(this, m_channel);
1658 m_undo.Push(nUndo);
1659 }
1660=======
1661>>>>>>> avn/ubitvar
1662 } 1277 }
1663 1278
1664 #region Console Commands 1279 #region Console Commands
1665 1280
1666 private void InterfaceLoadFile(Object[] args) 1281 private void InterfaceLoadFile(Object[] args)
1667 { 1282 {
1668<<<<<<< HEAD
1669 LoadFromFile((string)args[0]);
1670=======
1671 LoadFromFile((string) args[0]); 1283 LoadFromFile((string) args[0]);
1672>>>>>>> avn/ubitvar
1673 } 1284 }
1674 1285
1675 private void InterfaceLoadTileFile(Object[] args) 1286 private void InterfaceLoadTileFile(Object[] args)
1676 { 1287 {
1677<<<<<<< HEAD
1678 LoadFromFile((string)args[0],
1679 (int)args[1],
1680 (int)args[2],
1681 (int)args[3],
1682 (int)args[4]);
1683=======
1684 LoadFromFile((string) args[0], 1288 LoadFromFile((string) args[0],
1685 (int) args[1], 1289 (int) args[1],
1686 (int) args[2], 1290 (int) args[2],
1687 (int) args[3], 1291 (int) args[3],
1688 (int) args[4]); 1292 (int) args[4]);
1689>>>>>>> avn/ubitvar
1690 } 1293 }
1691 1294
1692 private void InterfaceSaveFile(Object[] args) 1295 private void InterfaceSaveFile(Object[] args)
@@ -1711,15 +1314,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1711 private void InterfaceRevertTerrain(Object[] args) 1314 private void InterfaceRevertTerrain(Object[] args)
1712 { 1315 {
1713 int x, y; 1316 int x, y;
1714<<<<<<< HEAD
1715 for(x = 0; x < m_channel.Width; x++)
1716 for(y = 0; y < m_channel.Height; y++)
1717 m_channel[x, y] = m_revert[x, y];
1718=======
1719 for (x = 0; x < m_channel.Width; x++) 1317 for (x = 0; x < m_channel.Width; x++)
1720 for (y = 0; y < m_channel.Height; y++) 1318 for (y = 0; y < m_channel.Height; y++)
1721 m_channel[x, y] = m_baked[x, y]; 1319 m_channel[x, y] = m_baked[x, y];
1722>>>>>>> avn/ubitvar
1723 1320
1724 } 1321 }
1725 1322
@@ -1729,15 +1326,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1729 1326
1730 if (direction.ToLower().StartsWith("y")) 1327 if (direction.ToLower().StartsWith("y"))
1731 { 1328 {
1732<<<<<<< HEAD
1733 for(int x = 0; x < m_channel.Width; x++)
1734 {
1735 for(int y = 0; y < m_channel.Height / 2; y++)
1736=======
1737 for (int x = 0; x < m_channel.Width; x++) 1329 for (int x = 0; x < m_channel.Width; x++)
1738 { 1330 {
1739 for (int y = 0; y < m_channel.Height / 2; y++) 1331 for (int y = 0; y < m_channel.Height / 2; y++)
1740>>>>>>> avn/ubitvar
1741 { 1332 {
1742 double height = m_channel[x, y]; 1333 double height = m_channel[x, y];
1743 double flippedHeight = m_channel[x, (int)m_channel.Height - 1 - y]; 1334 double flippedHeight = m_channel[x, (int)m_channel.Height - 1 - y];
@@ -1749,15 +1340,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1749 } 1340 }
1750 else if (direction.ToLower().StartsWith("x")) 1341 else if (direction.ToLower().StartsWith("x"))
1751 { 1342 {
1752<<<<<<< HEAD
1753 for(int y = 0; y < m_channel.Height; y++)
1754 {
1755 for(int x = 0; x < m_channel.Width / 2; x++)
1756=======
1757 for (int y = 0; y < m_channel.Height; y++) 1343 for (int y = 0; y < m_channel.Height; y++)
1758 { 1344 {
1759 for (int x = 0; x < m_channel.Width / 2; x++) 1345 for (int x = 0; x < m_channel.Width / 2; x++)
1760>>>>>>> avn/ubitvar
1761 { 1346 {
1762 double height = m_channel[x, y]; 1347 double height = m_channel[x, y];
1763 double flippedHeight = m_channel[(int)m_channel.Width - 1 - x, y]; 1348 double flippedHeight = m_channel[(int)m_channel.Width - 1 - x, y];
@@ -1837,47 +1422,29 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1837 double val = (double)args[0]; 1422 double val = (double)args[0];
1838 1423
1839 int x, y; 1424 int x, y;
1840<<<<<<< HEAD
1841 for(x = 0; x < m_channel.Width; x++)
1842 for(y = 0; y < m_channel.Height; y++)
1843 m_channel[x, y] += (double)args[0];
1844=======
1845 for (x = 0; x < m_channel.Width; x++) 1425 for (x = 0; x < m_channel.Width; x++)
1846 for (y = 0; y < m_channel.Height; y++) 1426 for (y = 0; y < m_channel.Height; y++)
1847 m_channel[x, y] += val; 1427 m_channel[x, y] += val;
1848>>>>>>> avn/ubitvar
1849 } 1428 }
1850 1429
1851 private void InterfaceMultiplyTerrain(Object[] args) 1430 private void InterfaceMultiplyTerrain(Object[] args)
1852 { 1431 {
1853 int x, y; 1432 int x, y;
1854<<<<<<< HEAD
1855 for(x = 0; x < m_channel.Width; x++)
1856 for(y = 0; y < m_channel.Height; y++)
1857 m_channel[x, y] *= (double)args[0];
1858=======
1859 double val = (double)args[0]; 1433 double val = (double)args[0];
1860 1434
1861 for (x = 0; x < m_channel.Width; x++) 1435 for (x = 0; x < m_channel.Width; x++)
1862 for (y = 0; y < m_channel.Height; y++) 1436 for (y = 0; y < m_channel.Height; y++)
1863 m_channel[x, y] *= val; 1437 m_channel[x, y] *= val;
1864>>>>>>> avn/ubitvar
1865 } 1438 }
1866 1439
1867 private void InterfaceLowerTerrain(Object[] args) 1440 private void InterfaceLowerTerrain(Object[] args)
1868 { 1441 {
1869 int x, y; 1442 int x, y;
1870<<<<<<< HEAD
1871 for(x = 0; x < m_channel.Width; x++)
1872 for(y = 0; y < m_channel.Height; y++)
1873 m_channel[x, y] -= (double)args[0];
1874=======
1875 double val = (double)args[0]; 1443 double val = (double)args[0];
1876 1444
1877 for (x = 0; x < m_channel.Width; x++) 1445 for (x = 0; x < m_channel.Width; x++)
1878 for (y = 0; y < m_channel.Height; y++) 1446 for (y = 0; y < m_channel.Height; y++)
1879 m_channel[x, y] -= val; 1447 m_channel[x, y] -= val;
1880>>>>>>> avn/ubitvar
1881 } 1448 }
1882 1449
1883 public void InterfaceFillTerrain(Object[] args) 1450 public void InterfaceFillTerrain(Object[] args)
@@ -1885,26 +1452,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1885 int x, y; 1452 int x, y;
1886 double val = (double)args[0]; 1453 double val = (double)args[0];
1887 1454
1888<<<<<<< HEAD
1889 for(x = 0; x < m_channel.Width; x++)
1890 for(y = 0; y < m_channel.Height; y++)
1891 m_channel[x, y] = (double)args[0];
1892=======
1893 for (x = 0; x < m_channel.Width; x++) 1455 for (x = 0; x < m_channel.Width; x++)
1894 for (y = 0; y < m_channel.Height; y++) 1456 for (y = 0; y < m_channel.Height; y++)
1895 m_channel[x, y] = val; 1457 m_channel[x, y] = val;
1896>>>>>>> avn/ubitvar
1897 } 1458 }
1898 1459
1899 private void InterfaceMinTerrain(Object[] args) 1460 private void InterfaceMinTerrain(Object[] args)
1900 { 1461 {
1901 int x, y; 1462 int x, y;
1902<<<<<<< HEAD
1903 for(x = 0; x < m_channel.Width; x++)
1904=======
1905 double val = (double)args[0]; 1463 double val = (double)args[0];
1906 for (x = 0; x < m_channel.Width; x++) 1464 for (x = 0; x < m_channel.Width; x++)
1907>>>>>>> avn/ubitvar
1908 { 1465 {
1909 for(y = 0; y < m_channel.Height; y++) 1466 for(y = 0; y < m_channel.Height; y++)
1910 { 1467 {
@@ -1916,19 +1473,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1916 private void InterfaceMaxTerrain(Object[] args) 1473 private void InterfaceMaxTerrain(Object[] args)
1917 { 1474 {
1918 int x, y; 1475 int x, y;
1919<<<<<<< HEAD
1920 for(x = 0; x < m_channel.Width; x++)
1921=======
1922 double val = (double)args[0]; 1476 double val = (double)args[0];
1923 for (x = 0; x < m_channel.Width; x++) 1477 for (x = 0; x < m_channel.Width; x++)
1924>>>>>>> avn/ubitvar
1925 { 1478 {
1926 for(y = 0; y < m_channel.Height; y++) 1479 for(y = 0; y < m_channel.Height; y++)
1927 { 1480 {
1928 m_channel[x, y] = Math.Min(val, m_channel[x, y]); 1481 m_channel[x, y] = Math.Min(val, m_channel[x, y]);
1929 } 1482 }
1930 } 1483 }
1931<<<<<<< HEAD
1932 } 1484 }
1933 1485
1934 private void InterfaceShow(Object[] args) 1486 private void InterfaceShow(Object[] args)
@@ -1944,8 +1496,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1944 double height = m_channel[(int)point.X, (int)point.Y]; 1496 double height = m_channel[(int)point.X, (int)point.Y];
1945 1497
1946 Console.WriteLine("Terrain height at {0} is {1}", point, height); 1498 Console.WriteLine("Terrain height at {0} is {1}", point, height);
1947=======
1948>>>>>>> avn/ubitvar
1949 } 1499 }
1950 1500
1951 private void InterfaceShowDebugStats(Object[] args) 1501 private void InterfaceShowDebugStats(Object[] args)
@@ -2157,6 +1707,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
2157 1707
2158 public void ModifyCommand(string module, string[] cmd) 1708 public void ModifyCommand(string module, string[] cmd)
2159 { 1709 {
1710 /*
2160 string result; 1711 string result;
2161 Scene scene = SceneManager.Instance.CurrentScene; 1712 Scene scene = SceneManager.Instance.CurrentScene;
2162 if ((scene != null) && (scene != m_scene)) 1713 if ((scene != null) && (scene != m_scene))
@@ -2196,6 +1747,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
2196 { 1747 {
2197 MainConsole.Instance.Output(result); 1748 MainConsole.Instance.Output(result);
2198 } 1749 }
1750 */
2199 } 1751 }
2200 1752
2201#endregion 1753#endregion
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
index 40db370..b209b33 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
@@ -60,12 +60,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
60 TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize); 60 TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize);
61 ITerrainPaintableEffect effect = new RaiseSphere(); 61 ITerrainPaintableEffect effect = new RaiseSphere();
62 62
63<<<<<<< HEAD
64 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0);
65=======
66 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0, 63 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0,
67 0, midRegion - 1,0, (int)Constants.RegionSize -1); 64 0, midRegion - 1,0, (int)Constants.RegionSize -1);
68>>>>>>> avn/ubitvar
69 Assert.That(map[127, midRegion] > 0.0, "Raise brush should raising value at this point (127,128)."); 65 Assert.That(map[127, midRegion] > 0.0, "Raise brush should raising value at this point (127,128).");
70 Assert.That(map[125, midRegion] > 0.0, "Raise brush should raising value at this point (124,128)."); 66 Assert.That(map[125, midRegion] > 0.0, "Raise brush should raising value at this point (124,128).");
71 Assert.That(map[120, midRegion] == 0.0, "Raise brush should not change value at this point (120,128)."); 67 Assert.That(map[120, midRegion] == 0.0, "Raise brush should not change value at this point (120,128).");
@@ -84,12 +80,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
84 } 80 }
85 effect = new LowerSphere(); 81 effect = new LowerSphere();
86 82
87<<<<<<< HEAD
88 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0);
89=======
90 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0, 83 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0,
91 0, (int)Constants.RegionSize -1,0, (int)Constants.RegionSize -1); 84 0, (int)Constants.RegionSize -1,0, (int)Constants.RegionSize -1);
92>>>>>>> avn/ubitvar
93 Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); 85 Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128).");
94 Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); 86 Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128).");
95 Assert.That(map[125, midRegion] < 1.0, "Lower brush should lowering value at this point (124,128)."); 87 Assert.That(map[125, midRegion] < 1.0, "Lower brush should lowering value at this point (124,128).");
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs
index 77c10b8..4719ba3 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs
@@ -79,13 +79,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
79 /// <remarks>Based on the algorithm described at http://opensimulator.org/wiki/Terrain_Splatting 79 /// <remarks>Based on the algorithm described at http://opensimulator.org/wiki/Terrain_Splatting
80 /// Note we create a 256x256 dimension texture even if the actual terrain is larger. 80 /// Note we create a 256x256 dimension texture even if the actual terrain is larger.
81 /// </remarks> 81 /// </remarks>
82<<<<<<< HEAD 82
83 public static Bitmap Splat(ITerrainChannel terrain, 83 public static Bitmap Splat(ITerrainChannel terrain,
84 UUID[] textureIDs, float[] startHeights, float[] heightRanges, 84 UUID[] textureIDs, float[] startHeights, float[] heightRanges,
85 Vector3d regionPosition, IAssetService assetService, bool textureTerrain) 85 Vector3d regionPosition, IAssetService assetService, bool textureTerrain)
86=======
87 public static Bitmap Splat(ITerrainChannel terrain, UUID[] textureIDs, float[] startHeights, float[] heightRanges, Vector3d regionPosition, IAssetService assetService, bool textureTerrain)
88>>>>>>> avn/ubitvar
89 { 86 {
90 Debug.Assert(textureIDs.Length == 4); 87 Debug.Assert(textureIDs.Length == 4);
91 Debug.Assert(startHeights.Length == 4); 88 Debug.Assert(startHeights.Length == 4);
@@ -133,8 +130,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
133 asset = assetService.Get(textureIDs[i].ToString()); 130 asset = assetService.Get(textureIDs[i].ToString());
134 if (asset != null) 131 if (asset != null)
135 { 132 {
136// m_log.DebugFormat( 133 // m_log.DebugFormat(
137// "[TERRAIN SPLAT]: Got cached original JPEG2000 terrain texture {0} {1}", i, asset.ID); 134 // "[TERRAIN SPLAT]: Got cached original JPEG2000 terrain texture {0} {1}", i, asset.ID);
138 135
139 try { detailTexture[i] = (Bitmap)CSJ2K.J2kImage.FromBytes(asset.Data); } 136 try { detailTexture[i] = (Bitmap)CSJ2K.J2kImage.FromBytes(asset.Data); }
140 catch (Exception ex) 137 catch (Exception ex)
@@ -144,7 +141,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
144 } 141 }
145 142
146 if (detailTexture[i] != null) 143 if (detailTexture[i] != null)
147 { 144 {
148 // Make sure this texture is the correct size, otherwise resize 145 // Make sure this texture is the correct size, otherwise resize
149 if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256) 146 if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256)
150 { 147 {
@@ -199,74 +196,12 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
199 using (SolidBrush brush = new SolidBrush(DEFAULT_TERRAIN_COLOR[i])) 196 using (SolidBrush brush = new SolidBrush(DEFAULT_TERRAIN_COLOR[i]))
200 gfx.FillRectangle(brush, 0, 0, 256, 256); 197 gfx.FillRectangle(brush, 0, 0, 256, 256);
201 } 198 }
202 else
203 {
204 if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256)
205 {
206 detailTexture[i] = ResizeBitmap(detailTexture[i], 256, 256);
207 }
208 }
209 } 199 }
210<<<<<<< HEAD
211 else 200 else
212=======
213
214 #region Layer Map
215
216 float[,] layermap = new float[256 , 256];
217
218 int xFactor = terrain.Width / 256;
219 int yFactor = terrain.Height / 256;
220
221 for (int y = 0; y < 256; y++)
222>>>>>>> avn/ubitvar
223 { 201 {
224 if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256) 202 if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256)
225 { 203 {
226<<<<<<< HEAD
227 detailTexture[i] = ResizeBitmap(detailTexture[i], 256, 256); 204 detailTexture[i] = ResizeBitmap(detailTexture[i], 256, 256);
228=======
229 float height = (float)terrain[x * xFactor, y * yFactor];
230
231 float pctX = (float)x / 255f;
232 float pctY = (float)y / 255f;
233
234 // Use bilinear interpolation between the four corners of start height and
235 // height range to select the current values at this position
236 float startHeight = ImageUtils.Bilinear(
237 startHeights[0],
238 startHeights[2],
239 startHeights[1],
240 startHeights[3],
241 pctX, pctY);
242 startHeight = Utils.Clamp(startHeight, 0f, 255f);
243
244 float heightRange = ImageUtils.Bilinear(
245 heightRanges[0],
246 heightRanges[2],
247 heightRanges[1],
248 heightRanges[3],
249 pctX, pctY);
250 heightRange = Utils.Clamp(heightRange, 0f, 255f);
251
252 // Generate two frequencies of perlin noise based on our global position
253 // The magic values were taken from http://opensimulator.org/wiki/Terrain_Splatting
254 Vector3 vec = new Vector3
255 (
256 ((float)regionPosition.X + (x * xFactor)) * 0.20319f,
257 ((float)regionPosition.Y + (y * yFactor)) * 0.20319f,
258 height * 0.25f
259 );
260
261 float lowFreq = Perlin.noise2(vec.X * 0.222222f, vec.Y * 0.222222f) * 6.5f;
262 float highFreq = Perlin.turbulence2(vec.X, vec.Y, 2f) * 2.25f;
263 float noise = (lowFreq + highFreq) * 2f;
264
265 // Combine the current height, generated noise, start height, and height range parameters, then scale all of it
266 float layer = ((height + noise - startHeight) / heightRange) * 4f;
267 if (Single.IsNaN(layer)) layer = 0f;
268 layermap[x,y] = Utils.Clamp(layer, 0f, 3f);
269>>>>>>> avn/ubitvar
270 } 205 }
271 } 206 }
272 } 207 }
@@ -286,7 +221,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
286 { 221 {
287 for (int x = 0; x < 256; x++) 222 for (int x = 0; x < 256; x++)
288 { 223 {
289<<<<<<< HEAD
290 float height = (float)terrain[x * xFactor, y * yFactor]; 224 float height = (float)terrain[x * xFactor, y * yFactor];
291 225
292 float pctX = (float)x / 255f; 226 float pctX = (float)x / 255f;
@@ -328,58 +262,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
328 if (Single.IsNaN(layer)) 262 if (Single.IsNaN(layer))
329 layer = 0f; 263 layer = 0f;
330 layermap[x, y] = Utils.Clamp(layer, 0f, 3f); 264 layermap[x, y] = Utils.Clamp(layer, 0f, 3f);
331=======
332 // Get handles to all of the texture data arrays
333 BitmapData[] datas = new BitmapData[]
334 {
335 detailTexture[0].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[0].PixelFormat),
336 detailTexture[1].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[1].PixelFormat),
337 detailTexture[2].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[2].PixelFormat),
338 detailTexture[3].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[3].PixelFormat)
339 };
340
341 int[] comps = new int[]
342 {
343 (datas[0].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3,
344 (datas[1].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3,
345 (datas[2].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3,
346 (datas[3].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3
347 };
348
349 for (int y = 0; y < 256; y++)
350 {
351 for (int x = 0; x < 256; x++)
352 {
353 float layer = layermap[x, y];
354
355 // Select two textures
356 int l0 = (int)Math.Floor(layer);
357 int l1 = Math.Min(l0 + 1, 3);
358
359 byte* ptrA = (byte*)datas[l0].Scan0 + y * datas[l0].Stride + x * comps[l0];
360 byte* ptrB = (byte*)datas[l1].Scan0 + y * datas[l1].Stride + x * comps[l1];
361 byte* ptrO = (byte*)outputData.Scan0 + y * outputData.Stride + x * 3;
362
363 float aB = *(ptrA + 0);
364 float aG = *(ptrA + 1);
365 float aR = *(ptrA + 2);
366
367 float bB = *(ptrB + 0);
368 float bG = *(ptrB + 1);
369 float bR = *(ptrB + 2);
370
371 float layerDiff = layer - l0;
372
373 // Interpolate between the two selected textures
374 *(ptrO + 0) = (byte)Math.Floor(aB + layerDiff * (bB - aB));
375 *(ptrO + 1) = (byte)Math.Floor(aG + layerDiff * (bG - aG));
376 *(ptrO + 2) = (byte)Math.Floor(aR + layerDiff * (bR - aR));
377 }
378 }
379
380 for (int i = 0; i < 4; i++)
381 detailTexture[i].UnlockBits(datas[i]);
382>>>>>>> avn/ubitvar
383 } 265 }
384 } 266 }
385 267
@@ -471,10 +353,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
471 b.Dispose(); 353 b.Dispose();
472 return result; 354 return result;
473 } 355 }
474<<<<<<< HEAD
475
476=======
477>>>>>>> avn/ubitvar
478 public static Bitmap SplatSimple(float[] heightmap) 356 public static Bitmap SplatSimple(float[] heightmap)
479 { 357 {
480 const float BASE_HSV_H = 93f / 360f; 358 const float BASE_HSV_H = 93f / 360f;
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
index d8420d9..8e843ee 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
@@ -156,13 +156,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
156 156
157 public Bitmap CreateMapTile() 157 public Bitmap CreateMapTile()
158 { 158 {
159<<<<<<< HEAD
160 // Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f);
161 // Camera above the middle of the region
162 Vector3 camPos = new Vector3(
163 m_scene.RegionInfo.RegionSizeX/2 - 0.5f,
164 m_scene.RegionInfo.RegionSizeY/2 - 0.5f,
165=======
166 /* this must be on all map, not just its image 159 /* this must be on all map, not just its image
167 if ((DateTime.Now - lastImageTime).TotalSeconds < 3600) 160 if ((DateTime.Now - lastImageTime).TotalSeconds < 3600)
168 { 161 {
@@ -179,16 +172,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
179 Vector3 camPos = new Vector3( 172 Vector3 camPos = new Vector3(
180 m_scene.RegionInfo.RegionSizeX / 2 - 0.5f, 173 m_scene.RegionInfo.RegionSizeX / 2 - 0.5f,
181 m_scene.RegionInfo.RegionSizeY / 2 - 0.5f, 174 m_scene.RegionInfo.RegionSizeY / 2 - 0.5f,
182>>>>>>> avn/ubitvar
183 221.7025033688163f); 175 221.7025033688163f);
184 // Viewport viewing down onto the region 176 // Viewport viewing down onto the region
185 Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, 177 Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f,
186 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY, 178 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY,
187<<<<<<< HEAD
188 (float)m_scene.RegionInfo.RegionSizeX, (float)m_scene.RegionInfo.RegionSizeY );
189 // Fill the viewport and return the image
190 return CreateMapTile(viewport, false);
191=======
192 (float)m_scene.RegionInfo.RegionSizeX, (float)m_scene.RegionInfo.RegionSizeY); 179 (float)m_scene.RegionInfo.RegionSizeX, (float)m_scene.RegionInfo.RegionSizeY);
193 180
194 Bitmap tile = CreateMapTile(viewport, false); 181 Bitmap tile = CreateMapTile(viewport, false);
@@ -199,7 +186,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
199 lastImageTime = DateTime.Now; 186 lastImageTime = DateTime.Now;
200 return (Bitmap)lastImage.Clone(); 187 return (Bitmap)lastImage.Clone();
201 */ 188 */
202>>>>>>> avn/ubitvar
203 } 189 }
204 190
205 public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures) 191 public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures)
@@ -315,15 +301,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
315 float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; 301 float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight;
316 302
317 renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f); 303 renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f);
318<<<<<<< HEAD
319 renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX/2 - 0.5f,
320 waterHeight,
321 m_scene.RegionInfo.RegionSizeY/2 - 0.5f );
322=======
323 renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX / 2 - 0.5f, 304 renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX / 2 - 0.5f,
324 waterHeight, 305 waterHeight,
325 m_scene.RegionInfo.RegionSizeY / 2 - 0.5f); 306 m_scene.RegionInfo.RegionSizeY / 2 - 0.5f);
326>>>>>>> avn/ubitvar
327 307
328 warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR)); 308 warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR));
329 waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif 309 waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif
@@ -352,11 +332,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
352 warp_Vector pos = ConvertVector(x, y, (float)terrain[(int)x, (int)y]); 332 warp_Vector pos = ConvertVector(x, y, (float)terrain[(int)x, (int)y]);
353 obj.addVertex(new warp_Vertex(pos, 333 obj.addVertex(new warp_Vertex(pos,
354 x / (float)m_scene.RegionInfo.RegionSizeX, 334 x / (float)m_scene.RegionInfo.RegionSizeX,
355<<<<<<< HEAD
356 (((float)m_scene.RegionInfo.RegionSizeY) - y) / m_scene.RegionInfo.RegionSizeY) );
357=======
358 (((float)m_scene.RegionInfo.RegionSizeY) - y) / m_scene.RegionInfo.RegionSizeY)); 335 (((float)m_scene.RegionInfo.RegionSizeY) - y) / m_scene.RegionInfo.RegionSizeY));
359>>>>>>> avn/ubitvar
360 } 336 }
361 } 337 }
362 338
@@ -424,12 +400,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
424 warp_Texture texture; 400 warp_Texture texture;
425 using ( 401 using (
426 Bitmap image 402 Bitmap image
427<<<<<<< HEAD
428 = TerrainSplat.Splat(terrain, textureIDs, startHeights, heightRanges,
429=======
430 = TerrainSplat.Splat( 403 = TerrainSplat.Splat(
431 terrain, textureIDs, startHeights, heightRanges, 404 terrain, textureIDs, startHeights, heightRanges,
432>>>>>>> avn/ubitvar
433 new Vector3d(globalX, globalY, 0.0), m_scene.AssetService, textureTerrain)) 405 new Vector3d(globalX, globalY, 0.0), m_scene.AssetService, textureTerrain))
434 { 406 {
435 texture = new warp_Texture(image); 407 texture = new warp_Texture(image);
@@ -711,12 +683,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
711 return new warp_Vector(x, z, y); 683 return new warp_Vector(x, z, y);
712 } 684 }
713 685
714 // Note: axis change.
715 private static warp_Vector ConvertVector(float x, float y, float z)
716 {
717 return new warp_Vector(x, z, y);
718 }
719
720 private static warp_Vector ConvertVector(Vector3 vector) 686 private static warp_Vector ConvertVector(Vector3 vector)
721 { 687 {
722 return new warp_Vector(vector.X, vector.Z, vector.Y); 688 return new warp_Vector(vector.X, vector.Z, vector.Y);
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index 553d057..e08bdc0 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -141,12 +141,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
141 141
142 private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) 142 private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags)
143 { 143 {
144<<<<<<< HEAD
145 List<MapBlockData> blocks = new List<MapBlockData>();
146 if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4))
147=======
148 Util.FireAndForget(x => 144 Util.FireAndForget(x =>
149>>>>>>> avn/ubitvar
150 { 145 {
151 List<MapBlockData> blocks = new List<MapBlockData>(); 146 List<MapBlockData> blocks = new List<MapBlockData>();
152 if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) 147 if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4))
@@ -232,74 +227,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
232 // they have different values depending on different viewers, apparently 227 // they have different values depending on different viewers, apparently
233 remoteClient.SendMapBlock(blocks, flags); 228 remoteClient.SendMapBlock(blocks, flags);
234 229
235<<<<<<< HEAD
236 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
237
238 string mapNameOrig = mapName;
239 if (regionInfos.Count == 0)
240 {
241 // Hack to get around the fact that ll V3 now drops the port from the
242 // map name. See https://jira.secondlife.com/browse/VWR-28570
243 //
244 // Caller, use this magic form instead:
245 // secondlife://http|!!mygrid.com|8002|Region+Name/128/128
246 // or url encode if possible.
247 // the hacks we do with this viewer...
248 //
249 if (mapName.Contains("|"))
250 mapName = mapName.Replace('|', ':');
251 if (mapName.Contains("+"))
252 mapName = mapName.Replace('+', ' ');
253 if (mapName.Contains("!"))
254 mapName = mapName.Replace('!', '/');
255
256 if (mapName != mapNameOrig)
257 regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
258 }
259
260 m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags);
261
262 if (regionInfos.Count > 0)
263 {
264 foreach (GridRegion info in regionInfos)
265 {
266 if ((flags & 2) == 2) // V2 sends this
267 {
268 List<MapBlockData> datas = WorldMap.Map2BlockFromGridRegion(info, flags);
269 // ugh! V2-3 is very sensitive about the result being
270 // exactly the same as the requested name
271 if (regionInfos.Count == 1 && (mapName != mapNameOrig))
272 datas.ForEach(d => d.Name = mapNameOrig);
273
274 blocks.AddRange(datas);
275 }
276 else
277 {
278 MapBlockData data = WorldMap.MapBlockFromGridRegion(info, flags);
279 blocks.Add(data);
280 }
281 }
282 }
283
284 // final block, closing the search result
285 AddFinalBlock(blocks);
286
287 // flags are agent flags sent from the viewer.
288 // they have different values depending on different viewers, apparently
289 remoteClient.SendMapBlock(blocks, flags);
290
291 // send extra user messages for V3
292 // because the UI is very confusing
293 // while we don't fix the hard-coded urls
294 if (flags == 2)
295 {
296 if (regionInfos.Count == 0)
297 remoteClient.SendAlertMessage("No regions found with that name.");
298 // this seems unnecessary because found regions will show up in the search results
299 //else if (regionInfos.Count == 1)
300 // remoteClient.SendAlertMessage("Region found!");
301 }
302=======
303 // send extra user messages for V3 230 // send extra user messages for V3
304 // because the UI is very confusing 231 // because the UI is very confusing
305 // while we don't fix the hard-coded urls 232 // while we don't fix the hard-coded urls
@@ -311,7 +238,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
311// remoteClient.SendAgentAlertMessage("Region found!", false); 238// remoteClient.SendAgentAlertMessage("Region found!", false);
312 } 239 }
313 }); 240 });
314>>>>>>> avn/ubitvar
315 } 241 }
316 242
317 private void AddFinalBlock(List<MapBlockData> blocks) 243 private void AddFinalBlock(List<MapBlockData> blocks)
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 2fbd017..b6d96ac 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -68,12 +68,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
68 private static readonly UUID STOP_UUID = UUID.Random(); 68 private static readonly UUID STOP_UUID = UUID.Random();
69 private static readonly string m_mapLayerPath = "0001/"; 69 private static readonly string m_mapLayerPath = "0001/";
70 70
71<<<<<<< HEAD
72 private IMapImageGenerator m_mapImageGenerator;
73 private IMapImageUploadModule m_mapImageServiceModule;
74
75 private OpenSim.Framework.BlockingQueue<MapRequestState> requests = new OpenSim.Framework.BlockingQueue<MapRequestState>();
76=======
77 private ManualResetEvent queueEvent = new ManualResetEvent(false); 71 private ManualResetEvent queueEvent = new ManualResetEvent(false);
78 private Queue<MapRequestState> requests = new Queue<MapRequestState>(); 72 private Queue<MapRequestState> requests = new Queue<MapRequestState>();
79 73
@@ -82,7 +76,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
82 76
83 private IMapImageGenerator m_mapImageGenerator; 77 private IMapImageGenerator m_mapImageGenerator;
84 private IMapImageUploadModule m_mapImageServiceModule; 78 private IMapImageUploadModule m_mapImageServiceModule;
85>>>>>>> avn/ubitvar
86 79
87 protected Scene m_scene; 80 protected Scene m_scene;
88 private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>(); 81 private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>();
@@ -154,14 +147,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
154 if (!m_Enabled) 147 if (!m_Enabled)
155 return; 148 return;
156 149
157<<<<<<< HEAD
158 m_ServiceThrottle = scene.RequestModuleInterface<IServiceThrottleModule>();
159=======
160 m_mapImageGenerator = m_scene.RequestModuleInterface<IMapImageGenerator>();
161 m_mapImageServiceModule = m_scene.RequestModuleInterface<IMapImageUploadModule>();
162 }
163>>>>>>> avn/ubitvar
164
165 m_mapImageGenerator = m_scene.RequestModuleInterface<IMapImageGenerator>(); 150 m_mapImageGenerator = m_scene.RequestModuleInterface<IMapImageGenerator>();
166 m_mapImageServiceModule = m_scene.RequestModuleInterface<IMapImageUploadModule>(); 151 m_mapImageServiceModule = m_scene.RequestModuleInterface<IMapImageUploadModule>();
167 } 152 }
@@ -275,56 +260,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
275 // 6/8/2011 -- I'm adding an explicit 2048 check, so that we never forget that there is 260 // 6/8/2011 -- I'm adding an explicit 2048 check, so that we never forget that there is
276 // a hack here, and so that regions below 4096 don't get spammed with unnecessary map blocks. 261 // a hack here, and so that regions below 4096 don't get spammed with unnecessary map blocks.
277 262
278<<<<<<< HEAD
279 if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048)
280 {
281 ScenePresence avatarPresence = null;
282
283 m_scene.TryGetScenePresence(agentID, out avatarPresence);
284
285 if (avatarPresence != null)
286 {
287 bool lookup = false;
288
289 lock (cachedMapBlocks)
290 {
291 if (cachedMapBlocks.Count > 0 && ((cachedTime + 1800) > Util.UnixTimeSinceEpoch()))
292 {
293 List<MapBlockData> mapBlocks;
294
295 mapBlocks = cachedMapBlocks;
296 avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0);
297 }
298 else
299 {
300 lookup = true;
301 }
302 }
303 if (lookup)
304 {
305 List<MapBlockData> mapBlocks = new List<MapBlockData>(); ;
306
307 // Get regions that are within 8 regions of here
308 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
309 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX - 8),
310 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX + 8),
311 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY - 8),
312 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY + 8) );
313 foreach (GridRegion r in regions)
314 {
315 MapBlockData block = MapBlockFromGridRegion(r, 0);
316 mapBlocks.Add(block);
317 }
318 avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0);
319
320 lock (cachedMapBlocks)
321 cachedMapBlocks = mapBlocks;
322
323 cachedTime = Util.UnixTimeSinceEpoch();
324 }
325 }
326 }
327=======
328 //if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048) 263 //if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048)
329 //{ 264 //{
330 // ScenePresence avatarPresence = null; 265 // ScenePresence avatarPresence = null;
@@ -373,7 +308,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
373 // } 308 // }
374 // } 309 // }
375 //} 310 //}
376>>>>>>> avn/ubitvar
377 311
378 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); 312 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
379 mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse()); 313 mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse());
@@ -459,7 +393,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
459 ThreadPriority.BelowNormal, 393 ThreadPriority.BelowNormal,
460 true, 394 true,
461 true); 395 true);
462 Watchdog.StartThread( 396 WorkManager.StartThread(
463 MapBlockSendThread, 397 MapBlockSendThread,
464 string.Format("MapBlockSendThread ({0})", m_scene.RegionInfo.RegionName), 398 string.Format("MapBlockSendThread ({0})", m_scene.RegionInfo.RegionName),
465 ThreadPriority.BelowNormal, 399 ThreadPriority.BelowNormal,
@@ -516,12 +450,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
516 uint xstart = 0; 450 uint xstart = 0;
517 uint ystart = 0; 451 uint ystart = 0;
518 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); 452 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart);
519<<<<<<< HEAD
520 if (itemtype == (int)GridItemType.AgentLocations)
521=======
522 453
523 if (itemtype == 6) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots) 454 if (itemtype == (int)GridItemType.AgentLocations) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots)
524>>>>>>> avn/ubitvar
525 { 455 {
526 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) 456 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
527 { 457 {
@@ -531,22 +461,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
531 mapItemReply mapitem = new mapItemReply(); 461 mapItemReply mapitem = new mapItemReply();
532 if (m_scene.GetRootAgentCount() <= 1) 462 if (m_scene.GetRootAgentCount() <= 1)
533 { 463 {
534<<<<<<< HEAD
535 mapitem = new mapItemReply( 464 mapitem = new mapItemReply(
536 xstart + 1, 465 xstart + 1,
537 ystart + 1, 466 ystart + 1,
538 UUID.Zero, 467 UUID.Zero,
539 Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()), 468 Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()),
540 0, 0); 469 0, 0);
541=======
542 mapitem = new mapItemReply();
543 mapitem.x = xstart + 1;
544 mapitem.y = ystart + 1;
545 mapitem.id = UUID.Zero;
546 mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString());
547 mapitem.Extra = 0;
548 mapitem.Extra2 = 0;
549>>>>>>> avn/ubitvar
550 mapitems.Add(mapitem); 470 mapitems.Add(mapitem);
551 } 471 }
552 else 472 else
@@ -556,22 +476,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
556 // Don't send a green dot for yourself 476 // Don't send a green dot for yourself
557 if (sp.UUID != remoteClient.AgentId) 477 if (sp.UUID != remoteClient.AgentId)
558 { 478 {
559<<<<<<< HEAD
560 mapitem = new mapItemReply( 479 mapitem = new mapItemReply(
561 xstart + (uint)sp.AbsolutePosition.X, 480 xstart + (uint)sp.AbsolutePosition.X,
562 ystart + (uint)sp.AbsolutePosition.Y, 481 ystart + (uint)sp.AbsolutePosition.Y,
563 UUID.Zero, 482 UUID.Zero,
564 Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()), 483 Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()),
565 1, 0); 484 1, 0);
566=======
567 mapitem = new mapItemReply();
568 mapitem.x = xstart + (uint)sp.AbsolutePosition.X;
569 mapitem.y = ystart + (uint)sp.AbsolutePosition.Y;
570 mapitem.id = UUID.Zero;
571 mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString());
572 mapitem.Extra = 1;
573 mapitem.Extra2 = 0;
574>>>>>>> avn/ubitvar
575 mapitems.Add(mapitem); 485 mapitems.Add(mapitem);
576 } 486 }
577 }); 487 });
@@ -615,8 +525,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
615 Vector3 max = parcel.AABBMax; 525 Vector3 max = parcel.AABBMax;
616 float x = (min.X+max.X)/2; 526 float x = (min.X+max.X)/2;
617 float y = (min.Y+max.Y)/2; 527 float y = (min.Y+max.Y)/2;
618
619<<<<<<< HEAD
620 mapitem = new mapItemReply( 528 mapitem = new mapItemReply(
621 xstart + (uint)x, 529 xstart + (uint)x,
622 ystart + (uint)y, 530 ystart + (uint)y,
@@ -625,16 +533,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
625 parcel.Area, 533 parcel.Area,
626 parcel.SalePrice 534 parcel.SalePrice
627 ); 535 );
628=======
629 mapitem = new mapItemReply();
630 mapitem.x = xstart + (uint)x;
631 mapitem.y = ystart +(uint)y;
632 // mapitem.z = (uint)m_scene.GetGroundHeight(x,y);
633 mapitem.id = parcel.GlobalID;
634 mapitem.name = parcel.Name;
635 mapitem.Extra = parcel.Area;
636 mapitem.Extra2 = parcel.SalePrice;
637>>>>>>> avn/ubitvar
638 mapitems.Add(mapitem); 536 mapitems.Add(mapitem);
639 } 537 }
640 } 538 }
@@ -659,7 +557,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
659 SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); 557 SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
660 if (sog != null) 558 if (sog != null)
661 { 559 {
662<<<<<<< HEAD
663 mapitem = new mapItemReply( 560 mapitem = new mapItemReply(
664 xstart + (uint)sog.AbsolutePosition.X, 561 xstart + (uint)sog.AbsolutePosition.X,
665 ystart + (uint)sog.AbsolutePosition.Y, 562 ystart + (uint)sog.AbsolutePosition.Y,
@@ -668,15 +565,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
668 0, // color (not used) 565 0, // color (not used)
669 0 // 0 = telehub / 1 = infohub 566 0 // 0 = telehub / 1 = infohub
670 ); 567 );
671=======
672 mapitem = new mapItemReply();
673 mapitem.x = xstart + (uint)sog.AbsolutePosition.X;
674 mapitem.y = ystart + (uint)sog.AbsolutePosition.Y;
675 mapitem.id = UUID.Zero;
676 mapitem.name = sog.Name;
677 mapitem.Extra = 0; // color (not used)
678 mapitem.Extra2 = 0; // 0 = telehub / 1 = infohub
679>>>>>>> avn/ubitvar
680 mapitems.Add(mapitem); 568 mapitems.Add(mapitem);
681 569
682 remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); 570 remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
@@ -763,126 +651,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
763 { 651 {
764 lock (requests) 652 lock (requests)
765 { 653 {
766<<<<<<< HEAD
767 if (st.agentID != UUID.Zero)
768 {
769 bool dorequest = true;
770 lock (m_rootAgents)
771 {
772 if (!m_rootAgents.Contains(st.agentID))
773 dorequest = false;
774 }
775
776 if (dorequest && !m_blacklistedregions.ContainsKey(st.regionhandle))
777 {
778 if (nAsyncRequests >= MAX_ASYNC_REQUESTS) // hit the break
779 {
780 // AH!!! Recursive !
781 // Put this request back in the queue and return
782 EnqueueMapItemRequest(st);
783 return;
784 }
785
786 RequestMapItemsDelegate d = RequestMapItemsAsync;
787 d.BeginInvoke(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle, RequestMapItemsCompleted, null);
788 //OSDMap response = RequestMapItemsAsync(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle);
789 //RequestMapItemsCompleted(response);
790 Interlocked.Increment(ref nAsyncRequests);
791 }
792 }
793 });
794 }
795
796 /// <summary>
797 /// Sends the mapitem response to the IClientAPI
798 /// </summary>
799 /// <param name="response">The OSDMap Response for the mapitem</param>
800 private void RequestMapItemsCompleted(IAsyncResult iar)
801 {
802 AsyncResult result = (AsyncResult)iar;
803 RequestMapItemsDelegate icon = (RequestMapItemsDelegate)result.AsyncDelegate;
804
805 OSDMap response = (OSDMap)icon.EndInvoke(iar);
806
807 Interlocked.Decrement(ref nAsyncRequests);
808
809 if (!response.ContainsKey("requestID"))
810 return;
811
812 UUID requestID = response["requestID"].AsUUID();
813
814 if (requestID != UUID.Zero)
815 {
816 MapRequestState mrs = new MapRequestState();
817 mrs.agentID = UUID.Zero;
818 lock (m_openRequests)
819 {
820 if (m_openRequests.ContainsKey(requestID))
821 {
822 mrs = m_openRequests[requestID];
823 m_openRequests.Remove(requestID);
824 }
825 }
826
827 if (mrs.agentID != UUID.Zero)
828 {
829 ScenePresence av = null;
830 m_scene.TryGetScenePresence(mrs.agentID, out av);
831 if (av != null)
832 {
833 if (response.ContainsKey(mrs.itemtype.ToString()))
834 {
835 List<mapItemReply> returnitems = new List<mapItemReply>();
836 OSDArray itemarray = (OSDArray)response[mrs.itemtype.ToString()];
837 for (int i = 0; i < itemarray.Count; i++)
838 {
839 OSDMap mapitem = (OSDMap)itemarray[i];
840 mapItemReply mi = new mapItemReply();
841 mi.FromOSD(mapitem);
842 returnitems.Add(mi);
843 }
844 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), mrs.itemtype, mrs.flags);
845 }
846
847 // Service 7 (MAP_ITEM_LAND_FOR_SALE)
848 uint itemtype = (uint)GridItemType.LandForSale;
849
850 if (response.ContainsKey(itemtype.ToString()))
851 {
852 List<mapItemReply> returnitems = new List<mapItemReply>();
853 OSDArray itemarray = (OSDArray)response[itemtype.ToString()];
854 for (int i = 0; i < itemarray.Count; i++)
855 {
856 OSDMap mapitem = (OSDMap)itemarray[i];
857 mapItemReply mi = new mapItemReply();
858 mi.FromOSD(mapitem);
859 returnitems.Add(mi);
860 }
861 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags);
862 }
863
864 // Service 1 (MAP_ITEM_TELEHUB)
865 itemtype = (uint)GridItemType.Telehub;
866
867 if (response.ContainsKey(itemtype.ToString()))
868 {
869 List<mapItemReply> returnitems = new List<mapItemReply>();
870 OSDArray itemarray = (OSDArray)response[itemtype.ToString()];
871 for (int i = 0; i < itemarray.Count; i++)
872 {
873 OSDMap mapitem = (OSDMap)itemarray[i];
874 mapItemReply mi = new mapItemReply();
875 mi.FromOSD(mapitem);
876 returnitems.Add(mi);
877 }
878 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags);
879 }
880 }
881 }
882=======
883 queueEvent.Set(); 654 queueEvent.Set();
884 requests.Enqueue(state); 655 requests.Enqueue(state);
885>>>>>>> avn/ubitvar 656
886 } 657 }
887 } 658 }
888 659
@@ -1228,11 +999,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1228 /// <param name="maxY"></param> 999 /// <param name="maxY"></param>
1229 public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) 1000 public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
1230 { 1001 {
1231<<<<<<< HEAD
1232=======
1233 m_log.DebugFormat("[WoldMapModule] RequestMapBlocks {0}={1}={2}={3} {4}", minX, minY, maxX, maxY, flag); 1002 m_log.DebugFormat("[WoldMapModule] RequestMapBlocks {0}={1}={2}={3} {4}", minX, minY, maxX, maxY, flag);
1234/* this flag does not seem to mean what his says 1003/* this flag does not seem to mean what his says
1235>>>>>>> avn/ubitvar
1236 if ((flag & 0x10000) != 0) // user clicked on qthe map a tile that isn't visible 1004 if ((flag & 0x10000) != 0) // user clicked on qthe map a tile that isn't visible
1237 { 1005 {
1238 List<MapBlockData> response = new List<MapBlockData>(); 1006 List<MapBlockData> response = new List<MapBlockData>();
@@ -1241,34 +1009,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1241 // on an unloaded square. 1009 // on an unloaded square.
1242 // But make sure: Look whether the one we requested is in there 1010 // But make sure: Look whether the one we requested is in there
1243 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 1011 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
1244<<<<<<< HEAD
1245 (int)Util.RegionToWorldLoc((uint)minX), (int)Util.RegionToWorldLoc((uint)maxX),
1246 (int)Util.RegionToWorldLoc((uint)minY), (int)Util.RegionToWorldLoc((uint)maxY) );
1247
1248 m_log.DebugFormat("[WORLD MAP MODULE] RequestMapBlocks min=<{0},{1}>, max=<{2},{3}>, flag={4}, cntFound={5}",
1249 minX, minY, maxX, maxY, flag.ToString("X"), regions.Count);
1250=======
1251 (int)Util.RegionToWorldLoc((uint)minX), 1012 (int)Util.RegionToWorldLoc((uint)minX),
1252 (int)Util.RegionToWorldLoc((uint)maxX), 1013 (int)Util.RegionToWorldLoc((uint)maxX),
1253 (int)Util.RegionToWorldLoc((uint)minY), 1014 (int)Util.RegionToWorldLoc((uint)minY),
1254 (int)Util.RegionToWorldLoc((uint)maxY) ); 1015 (int)Util.RegionToWorldLoc((uint)maxY) );
1255 1016
1256>>>>>>> avn/ubitvar
1257 if (regions != null) 1017 if (regions != null)
1258 { 1018 {
1259 foreach (GridRegion r in regions) 1019 foreach (GridRegion r in regions)
1260 { 1020 {
1261<<<<<<< HEAD
1262 if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX)
1263 && r.RegionLocY == Util.RegionToWorldLoc((uint)minY) )
1264 {
1265 // found it => add it to response
1266 // Version 2 viewers can handle the larger regions
1267 if ((flag & 2) == 2)
1268 response.AddRange(Map2BlockFromGridRegion(r, flag));
1269 else
1270 response.Add(MapBlockFromGridRegion(r, flag));
1271=======
1272 if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX) && 1021 if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX) &&
1273 r.RegionLocY == Util.RegionToWorldLoc((uint)minY)) 1022 r.RegionLocY == Util.RegionToWorldLoc((uint)minY))
1274 { 1023 {
@@ -1281,7 +1030,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1281 MapBlockFromGridRegion(block, r, flag); 1030 MapBlockFromGridRegion(block, r, flag);
1282 response.Add(block); 1031 response.Add(block);
1283 } 1032 }
1284>>>>>>> avn/ubitvar
1285 break; 1033 break;
1286 } 1034 }
1287 } 1035 }
@@ -1373,19 +1121,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1373 List<MapBlockData> allBlocks = new List<MapBlockData>(); 1121 List<MapBlockData> allBlocks = new List<MapBlockData>();
1374 List<MapBlockData> mapBlocks = new List<MapBlockData>(); 1122 List<MapBlockData> mapBlocks = new List<MapBlockData>();
1375 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 1123 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
1376<<<<<<< HEAD
1377 (int)Util.RegionToWorldLoc((uint)(minX - 4)), (int)Util.RegionToWorldLoc((uint)(maxX + 4)),
1378 (int)Util.RegionToWorldLoc((uint)(minY - 4)), (int)Util.RegionToWorldLoc((uint)(maxY + 4)) );
1379 //m_log.DebugFormat("{0} GetAndSendBlocks. min=<{1},{2}>, max=<{3},{4}>, cntFound={5}",
1380 // LogHeader, minX, minY, maxX, maxY, regions.Count);
1381 foreach (GridRegion r in regions)
1382 {
1383 // Version 2 viewers can handle the larger regions
1384 if ((flag & 2) == 2)
1385 mapBlocks.AddRange(Map2BlockFromGridRegion(r, flag));
1386 else
1387 mapBlocks.Add(MapBlockFromGridRegion(r, flag));
1388=======
1389 minX * (int)Constants.RegionSize, 1124 minX * (int)Constants.RegionSize,
1390 maxX * (int)Constants.RegionSize, 1125 maxX * (int)Constants.RegionSize,
1391 minY * (int)Constants.RegionSize, 1126 minY * (int)Constants.RegionSize,
@@ -1407,7 +1142,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1407 mapBlocks.Add(block); 1142 mapBlocks.Add(block);
1408 remoteClient.SendMapBlock(mapBlocks, flag & 0xffff); 1143 remoteClient.SendMapBlock(mapBlocks, flag & 0xffff);
1409 return allBlocks; 1144 return allBlocks;
1410>>>>>>> avn/ubitvar
1411 } 1145 }
1412 1146
1413 foreach (GridRegion r in regions) 1147 foreach (GridRegion r in regions)
@@ -1438,15 +1172,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1438 return allBlocks; 1172 return allBlocks;
1439 } 1173 }
1440 1174
1441<<<<<<< HEAD
1442 // Fill a passed MapBlockData from a GridRegion
1443 public MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag)
1444=======
1445 public void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag) 1175 public void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag)
1446>>>>>>> avn/ubitvar
1447 { 1176 {
1448 MapBlockData block = new MapBlockData();
1449
1450 block.Access = r.Access; 1177 block.Access = r.Access;
1451 switch (flag & 0xffff) 1178 switch (flag & 0xffff)
1452 { 1179 {
@@ -1461,14 +1188,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1461 break; 1188 break;
1462 } 1189 }
1463 block.Name = r.RegionName; 1190 block.Name = r.RegionName;
1464<<<<<<< HEAD
1465 block.X = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocX);
1466 block.Y = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocY);
1467 block.SizeX = (ushort) r.RegionSizeX;
1468 block.SizeY = (ushort) r.RegionSizeY;
1469
1470 return block;
1471=======
1472 block.X = (ushort)(r.RegionLocX / Constants.RegionSize); 1191 block.X = (ushort)(r.RegionLocX / Constants.RegionSize);
1473 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); 1192 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
1474 block.SizeX = (ushort)r.RegionSizeX; 1193 block.SizeX = (ushort)r.RegionSizeX;
@@ -1508,45 +1227,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1508 blocks.Add(block); 1227 blocks.Add(block);
1509 } 1228 }
1510 return blocks; 1229 return blocks;
1511>>>>>>> avn/ubitvar
1512 } 1230 }
1513 1231
1514 public List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag)
1515 {
1516 List<MapBlockData> blocks = new List<MapBlockData>();
1517 MapBlockData block = new MapBlockData();
1518 if (r == null)
1519 {
1520 block.Access = (byte)SimAccess.Down;
1521 block.MapImageId = UUID.Zero;
1522 blocks.Add(block);
1523 }
1524 else
1525 {
1526 block.Access = r.Access;
1527 switch (flag & 0xffff)
1528 {
1529 case 0:
1530 block.MapImageId = r.TerrainImage;
1531 break;
1532 case 2:
1533 block.MapImageId = r.ParcelImage;
1534 break;
1535 default:
1536 block.MapImageId = UUID.Zero;
1537 break;
1538 }
1539 block.Name = r.RegionName;
1540 block.X = (ushort)(r.RegionLocX / Constants.RegionSize);
1541 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
1542 block.SizeX = (ushort)r.RegionSizeX;
1543 block.SizeY = (ushort)r.RegionSizeY;
1544 blocks.Add(block);
1545 }
1546 return blocks;
1547 }
1548
1549
1550 public Hashtable OnHTTPThrottled(Hashtable keysvals) 1232 public Hashtable OnHTTPThrottled(Hashtable keysvals)
1551 { 1233 {
1552 Hashtable reply = new Hashtable(); 1234 Hashtable reply = new Hashtable();
@@ -1681,7 +1363,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1681 1363
1682 foreach (GridRegion r in regions) 1364 foreach (GridRegion r in regions)
1683 { 1365 {
1684 MapBlockData mapBlock = MapBlockFromGridRegion(r, 0); 1366 MapBlockData mapBlock = new MapBlockData();
1367 MapBlockFromGridRegion(mapBlock, r , 0);
1685 AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); 1368 AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
1686 1369
1687 if (texAsset != null) 1370 if (texAsset != null)
@@ -1752,13 +1435,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1752 uint xstart = 0; 1435 uint xstart = 0;
1753 uint ystart = 0; 1436 uint ystart = 0;
1754 1437
1755<<<<<<< HEAD
1756 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle,out xstart,out ystart);
1757 // m_log.DebugFormat("{0} HandleRemoteMapItemRequest. loc=<{1},{2}>",
1758 // LogHeader, Util.WorldToRegionLoc(xstart), Util.WorldToRegionLoc(ystart));
1759=======
1760 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); 1438 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart);
1761>>>>>>> avn/ubitvar
1762 1439
1763 // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots) 1440 // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots)
1764 1441
@@ -1878,7 +1555,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1878 return; 1555 return;
1879 1556
1880 m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.Name); 1557 m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.Name);
1881<<<<<<< HEAD
1882 1558
1883 using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile()) 1559 using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile())
1884 { 1560 {
@@ -1894,23 +1570,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1894 { 1570 {
1895 byte[] data; 1571 byte[] data;
1896 1572
1897=======
1898
1899 using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile())
1900 {
1901 // V1 (This Module)
1902 GenerateMaptile(mapbmp);
1903
1904 // v2/3 (MapImageServiceModule)
1905 m_mapImageServiceModule.UploadMapTile(m_scene, mapbmp);
1906 }
1907 }
1908
1909 private void GenerateMaptile(Bitmap mapbmp)
1910 {
1911 byte[] data;
1912
1913>>>>>>> avn/ubitvar
1914 try 1573 try
1915 { 1574 {
1916 data = OpenJPEG.EncodeFromImage(mapbmp, true); 1575 data = OpenJPEG.EncodeFromImage(mapbmp, true);
@@ -2027,11 +1686,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
2027 int regionSizeX = (int)m_scene.RegionInfo.RegionSizeX; 1686 int regionSizeX = (int)m_scene.RegionInfo.RegionSizeX;
2028 int regionSizeY = (int)m_scene.RegionInfo.RegionSizeY; 1687 int regionSizeY = (int)m_scene.RegionInfo.RegionSizeY;
2029 1688
2030<<<<<<< HEAD
2031 int landTileSize = LandManagementModule.LandUnit; 1689 int landTileSize = LandManagementModule.LandUnit;
2032=======
2033 int landTileSize = LandManagementModule.landUnit;
2034>>>>>>> avn/ubitvar
2035 int regionLandTilesX = regionSizeX / landTileSize; 1690 int regionLandTilesX = regionSizeX / landTileSize;
2036 int regionLandTilesY = regionSizeY / landTileSize; 1691 int regionLandTilesY = regionSizeY / landTileSize;
2037 1692
@@ -2054,10 +1709,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
2054 { 1709 {
2055 using (SolidBrush transparent = new SolidBrush(background)) 1710 using (SolidBrush transparent = new SolidBrush(background))
2056 g.FillRectangle(transparent, 0, 0, regionSizeX, regionSizeY); 1711 g.FillRectangle(transparent, 0, 0, regionSizeX, regionSizeY);
2057<<<<<<< HEAD
2058=======
2059
2060>>>>>>> avn/ubitvar
2061 1712
2062 foreach (ILandObject land in parcels) 1713 foreach (ILandObject land in parcels)
2063 { 1714 {
@@ -2080,17 +1731,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
2080 1731
2081 using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9))) 1732 using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9)))
2082 { 1733 {
2083<<<<<<< HEAD
2084 for (int x = 0 ; x < regionLandTilesX ; x++)
2085 {
2086 for (int y = 0 ; y < regionLandTilesY ; y++)
2087 {
2088 if (saleBitmap[x, y])
2089 g.FillRectangle(
2090 yellow, x * landTileSize,
2091 regionSizeX - landTileSize - (y * landTileSize),
2092 landTileSize,
2093=======
2094 for (int x = 0; x < regionLandTilesX ; x++) 1734 for (int x = 0; x < regionLandTilesX ; x++)
2095 { 1735 {
2096 for (int y = 0; y < regionLandTilesY ; y++) 1736 for (int y = 0; y < regionLandTilesY ; y++)
@@ -2101,7 +1741,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
2101 x * landTileSize, 1741 x * landTileSize,
2102 regionSizeX - landTileSize - (y * landTileSize), 1742 regionSizeX - landTileSize - (y * landTileSize),
2103 landTileSize, 1743 landTileSize,
2104>>>>>>> avn/ubitvar
2105 landTileSize); 1744 landTileSize);
2106 } 1745 }
2107 } 1746 }