aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Land
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandChannel.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs266
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs233
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs39
6 files changed, 291 insertions, 257 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
index 8767332..4ed23bb 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
@@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.World.Land
82 } 82 }
83 83
84 ILandObject obj = new LandObject(UUID.Zero, false, m_scene); 84 ILandObject obj = new LandObject(UUID.Zero, false, m_scene);
85 obj.landData.Name = "NO LAND"; 85 obj.LandData.Name = "NO LAND";
86 return obj; 86 return obj;
87 } 87 }
88 88
@@ -103,7 +103,7 @@ namespace OpenSim.Region.CoreModules.World.Land
103 } 103 }
104 104
105 ILandObject obj = new LandObject(UUID.Zero, false, m_scene); 105 ILandObject obj = new LandObject(UUID.Zero, false, m_scene);
106 obj.landData.Name = "NO LAND"; 106 obj.LandData.Name = "NO LAND";
107 return obj; 107 return obj;
108 } 108 }
109 109
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 76ff6da..d2b5cb1 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -36,18 +36,20 @@ using OpenSim.Framework;
36using OpenSim.Framework.Capabilities; 36using OpenSim.Framework.Capabilities;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using OpenSim.Framework.Servers.HttpServer; 38using OpenSim.Framework.Servers.HttpServer;
39using OpenSim.Services.Interfaces;
39using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Physics.Manager; 42using OpenSim.Region.Physics.Manager;
42using Caps=OpenSim.Framework.Capabilities.Caps; 43using Caps=OpenSim.Framework.Capabilities.Caps;
44using GridRegion = OpenSim.Services.Interfaces.GridRegion;
43 45
44namespace OpenSim.Region.CoreModules.World.Land 46namespace OpenSim.Region.CoreModules.World.Land
45{ 47{
46 // used for caching 48 // used for caching
47 internal class ExtendedLandData { 49 internal class ExtendedLandData {
48 public LandData landData; 50 public LandData LandData;
49 public ulong regionHandle; 51 public ulong RegionHandle;
50 public uint x, y; 52 public uint X, Y;
51 } 53 }
52 54
53 public class LandManagementModule : INonSharedRegionModule 55 public class LandManagementModule : INonSharedRegionModule
@@ -189,7 +191,7 @@ namespace OpenSim.Region.CoreModules.World.Land
189 { 191 {
190 if (m_landList.ContainsKey(local_id)) 192 if (m_landList.ContainsKey(local_id))
191 { 193 {
192 m_landList[local_id].landData = newData; 194 m_landList[local_id].LandData = newData;
193 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]); 195 m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]);
194 } 196 }
195 } 197 }
@@ -216,12 +218,12 @@ namespace OpenSim.Region.CoreModules.World.Land
216 218
217 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); 219 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
218 220
219 fullSimParcel.setLandBitmap(fullSimParcel.getSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); 221 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
220 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) 222 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)
221 fullSimParcel.landData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 223 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
222 else 224 else
223 fullSimParcel.landData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; 225 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID;
224 fullSimParcel.landData.ClaimDate = Util.UnixTimeSinceEpoch(); 226 fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
225 AddLandObject(fullSimParcel); 227 AddLandObject(fullSimParcel);
226 } 228 }
227 229
@@ -287,11 +289,11 @@ namespace OpenSim.Region.CoreModules.World.Land
287 { 289 {
288 if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) 290 if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT)
289 { 291 {
290 if (parcelAvatarIsEntering.isBannedFromLand(avatar.UUID)) 292 if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID))
291 { 293 {
292 SendYouAreBannedNotice(avatar); 294 SendYouAreBannedNotice(avatar);
293 } 295 }
294 else if (parcelAvatarIsEntering.isRestrictedFromLand(avatar.UUID)) 296 else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID))
295 { 297 {
296 avatar.ControllingClient.SendAlertMessage( 298 avatar.ControllingClient.SendAlertMessage(
297 "You are not allowed on this parcel because the land owner has restricted access. For now, you can enter, but please respect the land owner's decisions (or he can ban you!)."); 299 "You are not allowed on this parcel because the land owner has restricted access. For now, you can enter, but please respect the land owner's decisions (or he can ban you!).");
@@ -319,14 +321,14 @@ namespace OpenSim.Region.CoreModules.World.Land
319 List<ILandObject> checkLandParcels = ParcelsNearPoint(presence.AbsolutePosition); 321 List<ILandObject> checkLandParcels = ParcelsNearPoint(presence.AbsolutePosition);
320 foreach (ILandObject checkBan in checkLandParcels) 322 foreach (ILandObject checkBan in checkLandParcels)
321 { 323 {
322 if (checkBan.isBannedFromLand(avatar.AgentId)) 324 if (checkBan.IsBannedFromLand(avatar.AgentId))
323 { 325 {
324 checkBan.sendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar); 326 checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionBanned, false, (int)ParcelResult.Single, avatar);
325 return; //Only send one 327 return; //Only send one
326 } 328 }
327 if (checkBan.isRestrictedFromLand(avatar.AgentId)) 329 if (checkBan.IsRestrictedFromLand(avatar.AgentId))
328 { 330 {
329 checkBan.sendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar); 331 checkBan.SendLandProperties((int)ParcelPropertiesStatus.CollisionNotOnAccessList, false, (int)ParcelResult.Single, avatar);
330 return; //Only send one 332 return; //Only send one
331 } 333 }
332 } 334 }
@@ -346,19 +348,19 @@ namespace OpenSim.Region.CoreModules.World.Land
346 { 348 {
347 if (!avatar.IsChildAgent) 349 if (!avatar.IsChildAgent)
348 { 350 {
349 over.sendLandUpdateToClient(avatar.ControllingClient); 351 over.SendLandUpdateToClient(avatar.ControllingClient);
350 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.LocalID, 352 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID,
351 m_scene.RegionInfo.RegionID); 353 m_scene.RegionInfo.RegionID);
352 } 354 }
353 } 355 }
354 356
355 if (avatar.currentParcelUUID != over.landData.GlobalID) 357 if (avatar.currentParcelUUID != over.LandData.GlobalID)
356 { 358 {
357 if (!avatar.IsChildAgent) 359 if (!avatar.IsChildAgent)
358 { 360 {
359 over.sendLandUpdateToClient(avatar.ControllingClient); 361 over.SendLandUpdateToClient(avatar.ControllingClient);
360 avatar.currentParcelUUID = over.landData.GlobalID; 362 avatar.currentParcelUUID = over.LandData.GlobalID;
361 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.landData.LocalID, 363 m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID,
362 m_scene.RegionInfo.RegionID); 364 m_scene.RegionInfo.RegionID);
363 } 365 }
364 } 366 }
@@ -384,16 +386,16 @@ namespace OpenSim.Region.CoreModules.World.Land
384 if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && 386 if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT &&
385 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) 387 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown)
386 { 388 {
387 EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.landData.LocalID, 389 EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID,
388 m_scene.RegionInfo.RegionID); 390 m_scene.RegionInfo.RegionID);
389 //They are going under the safety line! 391 //They are going under the safety line!
390 if (!parcel.isBannedFromLand(clientAvatar.UUID)) 392 if (!parcel.IsBannedFromLand(clientAvatar.UUID))
391 { 393 {
392 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false; 394 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown = false;
393 } 395 }
394 } 396 }
395 else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && 397 else if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT &&
396 parcel.isBannedFromLand(clientAvatar.UUID)) 398 parcel.IsBannedFromLand(clientAvatar.UUID))
397 { 399 {
398 SendYouAreBannedNotice(clientAvatar); 400 SendYouAreBannedNotice(clientAvatar);
399 } 401 }
@@ -407,7 +409,7 @@ namespace OpenSim.Region.CoreModules.World.Land
407 ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 409 ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
408 if (over != null) 410 if (over != null)
409 { 411 {
410 if (!over.isBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= LandChannel.BAN_LINE_SAFETY_HIEGHT) 412 if (!over.IsBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= LandChannel.BAN_LINE_SAFETY_HIEGHT)
411 { 413 {
412 avatar.lastKnownAllowedPosition = 414 avatar.lastKnownAllowedPosition =
413 new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); 415 new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z);
@@ -427,7 +429,7 @@ namespace OpenSim.Region.CoreModules.World.Land
427 429
428 if (land != null) 430 if (land != null)
429 { 431 {
430 m_landList[landLocalID].sendAccessList(agentID, sessionID, flags, sequenceID, remote_client); 432 m_landList[landLocalID].SendAccessList(agentID, sessionID, flags, sequenceID, remote_client);
431 } 433 }
432 } 434 }
433 435
@@ -443,9 +445,9 @@ namespace OpenSim.Region.CoreModules.World.Land
443 445
444 if (land != null) 446 if (land != null)
445 { 447 {
446 if (agentID == land.landData.OwnerID) 448 if (agentID == land.LandData.OwnerID)
447 { 449 {
448 land.updateAccessList(flags, entries, remote_client); 450 land.UpdateAccessList(flags, entries, remote_client);
449 } 451 }
450 } 452 }
451 else 453 else
@@ -474,9 +476,9 @@ namespace OpenSim.Region.CoreModules.World.Land
474 lock (m_landList) 476 lock (m_landList)
475 { 477 {
476 int newLandLocalID = ++m_lastLandLocalID; 478 int newLandLocalID = ++m_lastLandLocalID;
477 new_land.landData.LocalID = newLandLocalID; 479 new_land.LandData.LocalID = newLandLocalID;
478 480
479 bool[,] landBitmap = new_land.getLandBitmap(); 481 bool[,] landBitmap = new_land.GetLandBitmap();
480 for (int x = 0; x < landArrayMax; x++) 482 for (int x = 0; x < landArrayMax; x++)
481 { 483 {
482 for (int y = 0; y < landArrayMax; y++) 484 for (int y = 0; y < landArrayMax; y++)
@@ -491,7 +493,7 @@ namespace OpenSim.Region.CoreModules.World.Land
491 m_landList.Add(newLandLocalID, new_land); 493 m_landList.Add(newLandLocalID, new_land);
492 } 494 }
493 495
494 new_land.forceUpdateLandInfo(); 496 new_land.ForceUpdateLandInfo();
495 m_scene.EventManager.TriggerLandObjectAdded(new_land); 497 m_scene.EventManager.TriggerLandObjectAdded(new_land);
496 return new_land; 498 return new_land;
497 } 499 }
@@ -518,14 +520,14 @@ namespace OpenSim.Region.CoreModules.World.Land
518 } 520 }
519 } 521 }
520 522
521 m_scene.EventManager.TriggerLandObjectRemoved(m_landList[local_id].landData.GlobalID); 523 m_scene.EventManager.TriggerLandObjectRemoved(m_landList[local_id].LandData.GlobalID);
522 m_landList.Remove(local_id); 524 m_landList.Remove(local_id);
523 } 525 }
524 } 526 }
525 527
526 private void performFinalLandJoin(ILandObject master, ILandObject slave) 528 private void performFinalLandJoin(ILandObject master, ILandObject slave)
527 { 529 {
528 bool[,] landBitmapSlave = slave.getLandBitmap(); 530 bool[,] landBitmapSlave = slave.GetLandBitmap();
529 lock (m_landList) 531 lock (m_landList)
530 { 532 {
531 for (int x = 0; x < 64; x++) 533 for (int x = 0; x < 64; x++)
@@ -534,14 +536,14 @@ namespace OpenSim.Region.CoreModules.World.Land
534 { 536 {
535 if (landBitmapSlave[x, y]) 537 if (landBitmapSlave[x, y])
536 { 538 {
537 m_landIDList[x, y] = master.landData.LocalID; 539 m_landIDList[x, y] = master.LandData.LocalID;
538 } 540 }
539 } 541 }
540 } 542 }
541 } 543 }
542 544
543 removeLandObject(slave.landData.LocalID); 545 removeLandObject(slave.LandData.LocalID);
544 UpdateLandObject(master.landData.LocalID, master.landData); 546 UpdateLandObject(master.LandData.LocalID, master.LandData);
545 } 547 }
546 548
547 public ILandObject GetLandObject(int parcelLocalID) 549 public ILandObject GetLandObject(int parcelLocalID)
@@ -628,7 +630,7 @@ namespace OpenSim.Region.CoreModules.World.Land
628 { 630 {
629 foreach (LandObject p in m_landList.Values) 631 foreach (LandObject p in m_landList.Values)
630 { 632 {
631 p.resetLandPrimCounts(); 633 p.ResetLandPrimCounts();
632 } 634 }
633 } 635 }
634 } 636 }
@@ -649,7 +651,7 @@ namespace OpenSim.Region.CoreModules.World.Land
649 ILandObject landUnderPrim = GetLandObject(position.X, position.Y); 651 ILandObject landUnderPrim = GetLandObject(position.X, position.Y);
650 if (landUnderPrim != null) 652 if (landUnderPrim != null)
651 { 653 {
652 landUnderPrim.addPrimToCount(obj); 654 landUnderPrim.AddPrimToCount(obj);
653 } 655 }
654 } 656 }
655 657
@@ -660,7 +662,7 @@ namespace OpenSim.Region.CoreModules.World.Land
660 { 662 {
661 foreach (LandObject p in m_landList.Values) 663 foreach (LandObject p in m_landList.Values)
662 { 664 {
663 p.removePrimFromCount(obj); 665 p.RemovePrimFromCount(obj);
664 } 666 }
665 } 667 }
666 } 668 }
@@ -673,15 +675,15 @@ namespace OpenSim.Region.CoreModules.World.Land
673 { 675 {
674 foreach (LandObject p in m_landList.Values) 676 foreach (LandObject p in m_landList.Values)
675 { 677 {
676 if (!landOwnersAndParcels.ContainsKey(p.landData.OwnerID)) 678 if (!landOwnersAndParcels.ContainsKey(p.LandData.OwnerID))
677 { 679 {
678 List<LandObject> tempList = new List<LandObject>(); 680 List<LandObject> tempList = new List<LandObject>();
679 tempList.Add(p); 681 tempList.Add(p);
680 landOwnersAndParcels.Add(p.landData.OwnerID, tempList); 682 landOwnersAndParcels.Add(p.LandData.OwnerID, tempList);
681 } 683 }
682 else 684 else
683 { 685 {
684 landOwnersAndParcels[p.landData.OwnerID].Add(p); 686 landOwnersAndParcels[p.LandData.OwnerID].Add(p);
685 } 687 }
686 } 688 }
687 } 689 }
@@ -692,15 +694,15 @@ namespace OpenSim.Region.CoreModules.World.Land
692 int simPrims = 0; 694 int simPrims = 0;
693 foreach (LandObject p in landOwnersAndParcels[owner]) 695 foreach (LandObject p in landOwnersAndParcels[owner])
694 { 696 {
695 simArea += p.landData.Area; 697 simArea += p.LandData.Area;
696 simPrims += p.landData.OwnerPrims + p.landData.OtherPrims + p.landData.GroupPrims + 698 simPrims += p.LandData.OwnerPrims + p.LandData.OtherPrims + p.LandData.GroupPrims +
697 p.landData.SelectedPrims; 699 p.LandData.SelectedPrims;
698 } 700 }
699 701
700 foreach (LandObject p in landOwnersAndParcels[owner]) 702 foreach (LandObject p in landOwnersAndParcels[owner])
701 { 703 {
702 p.landData.SimwideArea = simArea; 704 p.LandData.SimwideArea = simArea;
703 p.landData.SimwidePrims = simPrims; 705 p.LandData.SimwidePrims = simPrims;
704 } 706 }
705 } 707 }
706 } 708 }
@@ -777,26 +779,26 @@ namespace OpenSim.Region.CoreModules.World.Land
777 779
778 //Lets create a new land object with bitmap activated at that point (keeping the old land objects info) 780 //Lets create a new land object with bitmap activated at that point (keeping the old land objects info)
779 ILandObject newLand = startLandObject.Copy(); 781 ILandObject newLand = startLandObject.Copy();
780 newLand.landData.Name = newLand.landData.Name; 782 newLand.LandData.Name = newLand.LandData.Name;
781 newLand.landData.GlobalID = UUID.Random(); 783 newLand.LandData.GlobalID = UUID.Random();
782 784
783 newLand.setLandBitmap(newLand.getSquareLandBitmap(start_x, start_y, end_x, end_y)); 785 newLand.SetLandBitmap(newLand.GetSquareLandBitmap(start_x, start_y, end_x, end_y));
784 786
785 //Now, lets set the subdivision area of the original to false 787 //Now, lets set the subdivision area of the original to false
786 int startLandObjectIndex = startLandObject.landData.LocalID; 788 int startLandObjectIndex = startLandObject.LandData.LocalID;
787 lock (m_landList) 789 lock (m_landList)
788 { 790 {
789 m_landList[startLandObjectIndex].setLandBitmap( 791 m_landList[startLandObjectIndex].SetLandBitmap(
790 newLand.modifyLandBitmapSquare(startLandObject.getLandBitmap(), start_x, start_y, end_x, end_y, false)); 792 newLand.ModifyLandBitmapSquare(startLandObject.GetLandBitmap(), start_x, start_y, end_x, end_y, false));
791 m_landList[startLandObjectIndex].forceUpdateLandInfo(); 793 m_landList[startLandObjectIndex].ForceUpdateLandInfo();
792 } 794 }
793 795
794 EventManagerOnParcelPrimCountTainted(); 796 EventManagerOnParcelPrimCountTainted();
795 797
796 //Now add the new land object 798 //Now add the new land object
797 ILandObject result = AddLandObject(newLand); 799 ILandObject result = AddLandObject(newLand);
798 UpdateLandObject(startLandObject.landData.LocalID, startLandObject.landData); 800 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData);
799 result.sendLandUpdateToAvatarsOverMe(); 801 result.SendLandUpdateToAvatarsOverMe();
800 } 802 }
801 803
802 /// <summary> 804 /// <summary>
@@ -844,7 +846,7 @@ namespace OpenSim.Region.CoreModules.World.Land
844 } 846 }
845 foreach (ILandObject p in selectedLandObjects) 847 foreach (ILandObject p in selectedLandObjects)
846 { 848 {
847 if (p.landData.OwnerID != masterLandObject.landData.OwnerID) 849 if (p.LandData.OwnerID != masterLandObject.LandData.OwnerID)
848 { 850 {
849 return; 851 return;
850 } 852 }
@@ -854,14 +856,14 @@ namespace OpenSim.Region.CoreModules.World.Land
854 { 856 {
855 foreach (ILandObject slaveLandObject in selectedLandObjects) 857 foreach (ILandObject slaveLandObject in selectedLandObjects)
856 { 858 {
857 m_landList[masterLandObject.landData.LocalID].setLandBitmap( 859 m_landList[masterLandObject.LandData.LocalID].SetLandBitmap(
858 slaveLandObject.mergeLandBitmaps(masterLandObject.getLandBitmap(), slaveLandObject.getLandBitmap())); 860 slaveLandObject.MergeLandBitmaps(masterLandObject.GetLandBitmap(), slaveLandObject.GetLandBitmap()));
859 performFinalLandJoin(masterLandObject, slaveLandObject); 861 performFinalLandJoin(masterLandObject, slaveLandObject);
860 } 862 }
861 } 863 }
862 EventManagerOnParcelPrimCountTainted(); 864 EventManagerOnParcelPrimCountTainted();
863 865
864 masterLandObject.sendLandUpdateToAvatarsOverMe(); 866 masterLandObject.SendLandUpdateToAvatarsOverMe();
865 } 867 }
866 868
867 #endregion 869 #endregion
@@ -892,19 +894,19 @@ namespace OpenSim.Region.CoreModules.World.Land
892 894
893 if (currentParcelBlock != null) 895 if (currentParcelBlock != null)
894 { 896 {
895 if (currentParcelBlock.landData.OwnerID == remote_client.AgentId) 897 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId)
896 { 898 {
897 //Owner Flag 899 //Owner Flag
898 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); 900 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER);
899 } 901 }
900 else if (currentParcelBlock.landData.SalePrice > 0 && 902 else if (currentParcelBlock.LandData.SalePrice > 0 &&
901 (currentParcelBlock.landData.AuthBuyerID == UUID.Zero || 903 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero ||
902 currentParcelBlock.landData.AuthBuyerID == remote_client.AgentId)) 904 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId))
903 { 905 {
904 //Sale Flag 906 //Sale Flag
905 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_IS_FOR_SALE); 907 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_IS_FOR_SALE);
906 } 908 }
907 else if (currentParcelBlock.landData.OwnerID == UUID.Zero) 909 else if (currentParcelBlock.LandData.OwnerID == UUID.Zero)
908 { 910 {
909 //Public Flag 911 //Public Flag
910 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_PUBLIC); 912 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_PUBLIC);
@@ -978,7 +980,7 @@ namespace OpenSim.Region.CoreModules.World.Land
978 { 980 {
979 if (!temp.Contains(currentParcel)) 981 if (!temp.Contains(currentParcel))
980 { 982 {
981 currentParcel.forceUpdateLandInfo(); 983 currentParcel.ForceUpdateLandInfo();
982 temp.Add(currentParcel); 984 temp.Add(currentParcel);
983 } 985 }
984 } 986 }
@@ -994,7 +996,7 @@ namespace OpenSim.Region.CoreModules.World.Land
994 996
995 for (int i = 0; i < temp.Count; i++) 997 for (int i = 0; i < temp.Count; i++)
996 { 998 {
997 temp[i].sendLandProperties(sequence_id, snap_selection, requestResult, remote_client); 999 temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client);
998 } 1000 }
999 1001
1000 SendParcelOverlay(remote_client); 1002 SendParcelOverlay(remote_client);
@@ -1008,7 +1010,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1008 m_landList.TryGetValue(localID, out land); 1010 m_landList.TryGetValue(localID, out land);
1009 } 1011 }
1010 1012
1011 if (land != null) land.updateLandProperties(args, remote_client); 1013 if (land != null) land.UpdateLandProperties(args, remote_client);
1012 } 1014 }
1013 1015
1014 public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client) 1016 public void ClientOnParcelDivideRequest(int west, int south, int east, int north, IClientAPI remote_client)
@@ -1024,7 +1026,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1024 public void ClientOnParcelSelectObjects(int local_id, int request_type, 1026 public void ClientOnParcelSelectObjects(int local_id, int request_type,
1025 List<UUID> returnIDs, IClientAPI remote_client) 1027 List<UUID> returnIDs, IClientAPI remote_client)
1026 { 1028 {
1027 m_landList[local_id].sendForceObjectSelect(local_id, request_type, returnIDs, remote_client); 1029 m_landList[local_id].SendForceObjectSelect(local_id, request_type, returnIDs, remote_client);
1028 } 1030 }
1029 1031
1030 public void ClientOnParcelObjectOwnerRequest(int local_id, IClientAPI remote_client) 1032 public void ClientOnParcelObjectOwnerRequest(int local_id, IClientAPI remote_client)
@@ -1037,7 +1039,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1037 1039
1038 if (land != null) 1040 if (land != null)
1039 { 1041 {
1040 m_landList[local_id].sendLandObjectOwners(remote_client); 1042 m_landList[local_id].SendLandObjectOwners(remote_client);
1041 } 1043 }
1042 else 1044 else
1043 { 1045 {
@@ -1057,10 +1059,10 @@ namespace OpenSim.Region.CoreModules.World.Land
1057 { 1059 {
1058 if (m_scene.Permissions.IsGod(remote_client.AgentId)) 1060 if (m_scene.Permissions.IsGod(remote_client.AgentId))
1059 { 1061 {
1060 land.landData.OwnerID = ownerID; 1062 land.LandData.OwnerID = ownerID;
1061 1063
1062 m_scene.Broadcast(SendParcelOverlay); 1064 m_scene.Broadcast(SendParcelOverlay);
1063 land.sendLandUpdateToClient(remote_client); 1065 land.SendLandUpdateToClient(remote_client);
1064 } 1066 }
1065 } 1067 }
1066 } 1068 }
@@ -1078,11 +1080,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1078 if (m_scene.Permissions.CanAbandonParcel(remote_client.AgentId, land)) 1080 if (m_scene.Permissions.CanAbandonParcel(remote_client.AgentId, land))
1079 { 1081 {
1080 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) 1082 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)
1081 land.landData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 1083 land.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
1082 else 1084 else
1083 land.landData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; 1085 land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID;
1084 m_scene.Broadcast(SendParcelOverlay); 1086 m_scene.Broadcast(SendParcelOverlay);
1085 land.sendLandUpdateToClient(remote_client); 1087 land.SendLandUpdateToClient(remote_client);
1086 } 1088 }
1087 } 1089 }
1088 } 1090 }
@@ -1100,13 +1102,13 @@ namespace OpenSim.Region.CoreModules.World.Land
1100 if (m_scene.Permissions.CanReclaimParcel(remote_client.AgentId, land)) 1102 if (m_scene.Permissions.CanReclaimParcel(remote_client.AgentId, land))
1101 { 1103 {
1102 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) 1104 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)
1103 land.landData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 1105 land.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
1104 else 1106 else
1105 land.landData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; 1107 land.LandData.OwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID;
1106 land.landData.ClaimDate = Util.UnixTimeSinceEpoch(); 1108 land.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
1107 land.landData.IsGroupOwned = false; 1109 land.LandData.IsGroupOwned = false;
1108 m_scene.Broadcast(SendParcelOverlay); 1110 m_scene.Broadcast(SendParcelOverlay);
1109 land.sendLandUpdateToClient(remote_client); 1111 land.SendLandUpdateToClient(remote_client);
1110 } 1112 }
1111 } 1113 }
1112 } 1114 }
@@ -1128,7 +1130,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1128 1130
1129 if (land != null) 1131 if (land != null)
1130 { 1132 {
1131 land.updateLandSold(e.agentId, e.groupId, e.groupOwned, (uint)e.transactionID, e.parcelPrice, e.parcelArea); 1133 land.UpdateLandSold(e.agentId, e.groupId, e.groupOwned, (uint)e.transactionID, e.parcelPrice, e.parcelArea);
1132 } 1134 }
1133 } 1135 }
1134 } 1136 }
@@ -1149,11 +1151,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1149 1151
1150 if (lob != null) 1152 if (lob != null)
1151 { 1153 {
1152 UUID AuthorizedID = lob.landData.AuthBuyerID; 1154 UUID AuthorizedID = lob.LandData.AuthBuyerID;
1153 int saleprice = lob.landData.SalePrice; 1155 int saleprice = lob.LandData.SalePrice;
1154 UUID pOwnerID = lob.landData.OwnerID; 1156 UUID pOwnerID = lob.LandData.OwnerID;
1155 1157
1156 bool landforsale = ((lob.landData.Flags & 1158 bool landforsale = ((lob.LandData.Flags &
1157 (uint)(ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects)) != 0); 1159 (uint)(ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects)) != 0);
1158 if ((AuthorizedID == UUID.Zero || AuthorizedID == e.agentId) && e.parcelPrice >= saleprice && landforsale) 1160 if ((AuthorizedID == UUID.Zero || AuthorizedID == e.agentId) && e.parcelPrice >= saleprice && landforsale)
1159 { 1161 {
@@ -1182,7 +1184,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1182 1184
1183 if (land != null) 1185 if (land != null)
1184 { 1186 {
1185 land.deedToGroup(groupID); 1187 land.DeedToGroup(groupID);
1186 } 1188 }
1187 1189
1188 } 1190 }
@@ -1201,8 +1203,8 @@ namespace OpenSim.Region.CoreModules.World.Land
1201 public void IncomingLandObjectFromStorage(LandData data) 1203 public void IncomingLandObjectFromStorage(LandData data)
1202 { 1204 {
1203 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); 1205 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
1204 new_land.landData = data.Copy(); 1206 new_land.LandData = data.Copy();
1205 new_land.setLandBitmapFromByteArray(); 1207 new_land.SetLandBitmapFromByteArray();
1206 AddLandObject(new_land); 1208 AddLandObject(new_land);
1207 } 1209 }
1208 1210
@@ -1216,7 +1218,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1216 1218
1217 if (selectedParcel == null) return; 1219 if (selectedParcel == null) return;
1218 1220
1219 selectedParcel.returnLandObjects(returnType, agentIDs, taskIDs, remoteClient); 1221 selectedParcel.ReturnLandObjects(returnType, agentIDs, taskIDs, remoteClient);
1220 } 1222 }
1221 1223
1222 public void EventManagerOnNoLandDataFromStorage() 1224 public void EventManagerOnNoLandDataFromStorage()
@@ -1232,7 +1234,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1232 { 1234 {
1233 foreach (LandObject obj in m_landList.Values) 1235 foreach (LandObject obj in m_landList.Values)
1234 { 1236 {
1235 obj.setParcelObjectMaxOverride(overrideDel); 1237 obj.SetParcelObjectMaxOverride(overrideDel);
1236 } 1238 }
1237 } 1239 }
1238 } 1240 }
@@ -1301,7 +1303,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1301 else 1303 else
1302 { 1304 {
1303 // a parcel request for a parcel in another region. Ask the grid about the region 1305 // a parcel request for a parcel in another region. Ask the grid about the region
1304 RegionInfo info = m_scene.CommsManager.GridService.RequestNeighbourInfo(regionID); 1306 GridRegion info = m_scene.GridService.GetRegionByUUID(UUID.Zero, regionID);
1305 if (info != null) 1307 if (info != null)
1306 parcelID = Util.BuildFakeParcelID(info.RegionHandle, x, y); 1308 parcelID = Util.BuildFakeParcelID(info.RegionHandle, x, y);
1307 } 1309 }
@@ -1335,7 +1337,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1335 return; 1337 return;
1336 } 1338 }
1337 1339
1338 remoteClient.SendParcelDwellReply(localID, selectedParcel.landData.GlobalID, selectedParcel.landData.Dwell); 1340 remoteClient.SendParcelDwellReply(localID, selectedParcel.LandData.GlobalID, selectedParcel.LandData.Dwell);
1339 } 1341 }
1340 1342
1341 private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID) 1343 private void ClientOnParcelInfoRequest(IClientAPI remoteClient, UUID parcelID)
@@ -1343,50 +1345,62 @@ namespace OpenSim.Region.CoreModules.World.Land
1343 if (parcelID == UUID.Zero) 1345 if (parcelID == UUID.Zero)
1344 return; 1346 return;
1345 1347
1346 ExtendedLandData data = (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(), delegate(string id) { 1348 ExtendedLandData data =
1347 UUID parcel = UUID.Zero; 1349 (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(),
1348 UUID.TryParse(id, out parcel); 1350 delegate(string id)
1349 // assume we've got the parcelID we just computed in RemoteParcelRequest 1351 {
1350 ExtendedLandData extLandData = new ExtendedLandData(); 1352 UUID parcel = UUID.Zero;
1351 Util.ParseFakeParcelID(parcel, out extLandData.regionHandle, out extLandData.x, out extLandData.y); 1353 UUID.TryParse(id, out parcel);
1352 m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", 1354 // assume we've got the parcelID we just computed in RemoteParcelRequest
1353 extLandData.regionHandle, extLandData.x, extLandData.y); 1355 ExtendedLandData extLandData = new ExtendedLandData();
1354 1356 Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
1355 // for this region or for somewhere else? 1357 out extLandData.X, out extLandData.Y);
1356 if (extLandData.regionHandle == m_scene.RegionInfo.RegionHandle) 1358 m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
1357 { 1359 extLandData.RegionHandle, extLandData.X, extLandData.Y);
1358 extLandData.landData = this.GetLandObject(extLandData.x, extLandData.y).landData; 1360
1359 } 1361 // for this region or for somewhere else?
1360 else 1362 if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle)
1361 { 1363 {
1362 extLandData.landData = m_scene.CommsManager.GridService.RequestLandData(extLandData.regionHandle, 1364 extLandData.LandData = this.GetLandObject(extLandData.X, extLandData.Y).LandData;
1363 extLandData.x, 1365 }
1364 extLandData.y); 1366 else
1365 if (extLandData.landData == null) 1367 {
1366 { 1368 ILandService landService = m_scene.RequestModuleInterface<ILandService>();
1367 // we didn't find the region/land => don't cache 1369 extLandData.LandData = landService.GetLandData(extLandData.RegionHandle,
1368 return null; 1370 extLandData.X,
1369 } 1371 extLandData.Y);
1370 } 1372 if (extLandData.LandData == null)
1371 return extLandData; 1373 {
1372 }); 1374 // we didn't find the region/land => don't cache
1375 return null;
1376 }
1377 }
1378 return extLandData;
1379 });
1373 1380
1374 if (data != null) // if we found some data, send it 1381 if (data != null) // if we found some data, send it
1375 { 1382 {
1376 RegionInfo info; 1383 GridRegion info;
1377 if (data.regionHandle == m_scene.RegionInfo.RegionHandle) 1384 if (data.RegionHandle == m_scene.RegionInfo.RegionHandle)
1378 { 1385 {
1379 info = m_scene.RegionInfo; 1386 info = new GridRegion(m_scene.RegionInfo);
1380 } 1387 }
1381 else 1388 else
1382 { 1389 {
1383 // most likely still cached from building the extLandData entry 1390 // most likely still cached from building the extLandData entry
1384 info = m_scene.CommsManager.GridService.RequestNeighbourInfo(data.regionHandle); 1391 uint x = 0, y = 0;
1392 Utils.LongToUInts(data.RegionHandle, out x, out y);
1393 info = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
1385 } 1394 }
1386 // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark. 1395 // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark.
1387 m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...", 1396 m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...",
1388 data.landData.Name, data.regionHandle); 1397 data.LandData.Name, data.RegionHandle);
1389 remoteClient.SendParcelInfo(info, data.landData, parcelID, data.x, data.y); 1398 // HACK for now
1399 RegionInfo r = new RegionInfo();
1400 r.RegionName = info.RegionName;
1401 r.RegionLocX = (uint)info.RegionLocX;
1402 r.RegionLocY = (uint)info.RegionLocY;
1403 remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y);
1390 } 1404 }
1391 else 1405 else
1392 m_log.Debug("[LAND] got no parcelinfo; not sending"); 1406 m_log.Debug("[LAND] got no parcelinfo; not sending");
@@ -1405,9 +1419,9 @@ namespace OpenSim.Region.CoreModules.World.Land
1405 if (!m_scene.Permissions.CanEditParcel(remoteClient.AgentId, land)) 1419 if (!m_scene.Permissions.CanEditParcel(remoteClient.AgentId, land))
1406 return; 1420 return;
1407 1421
1408 land.landData.OtherCleanTime = otherCleanTime; 1422 land.LandData.OtherCleanTime = otherCleanTime;
1409 1423
1410 UpdateLandObject(localID, land.landData); 1424 UpdateLandObject(localID, land.LandData);
1411 } 1425 }
1412 } 1426 }
1413} 1427}
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 2701f60..b9b7da5 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Land
53 protected Scene m_scene; 53 protected Scene m_scene;
54 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); 54 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
55 55
56 public bool[,] landBitmap 56 public bool[,] LandBitmap
57 { 57 {
58 get { return m_landBitmap; } 58 get { return m_landBitmap; }
59 set { m_landBitmap = value; } 59 set { m_landBitmap = value; }
@@ -63,14 +63,14 @@ namespace OpenSim.Region.CoreModules.World.Land
63 63
64 #region ILandObject Members 64 #region ILandObject Members
65 65
66 public LandData landData 66 public LandData LandData
67 { 67 {
68 get { return m_landData; } 68 get { return m_landData; }
69 69
70 set { m_landData = value; } 70 set { m_landData = value; }
71 } 71 }
72 72
73 public UUID regionUUID 73 public UUID RegionUUID
74 { 74 {
75 get { return m_scene.RegionInfo.RegionID; } 75 get { return m_scene.RegionInfo.RegionID; }
76 } 76 }
@@ -80,8 +80,8 @@ namespace OpenSim.Region.CoreModules.World.Land
80 public LandObject(UUID owner_id, bool is_group_owned, Scene scene) 80 public LandObject(UUID owner_id, bool is_group_owned, Scene scene)
81 { 81 {
82 m_scene = scene; 82 m_scene = scene;
83 landData.OwnerID = owner_id; 83 LandData.OwnerID = owner_id;
84 landData.IsGroupOwned = is_group_owned; 84 LandData.IsGroupOwned = is_group_owned;
85 } 85 }
86 86
87 #endregion 87 #endregion
@@ -96,11 +96,11 @@ namespace OpenSim.Region.CoreModules.World.Land
96 /// <param name="x"></param> 96 /// <param name="x"></param>
97 /// <param name="y"></param> 97 /// <param name="y"></param>
98 /// <returns>Returns true if the piece of land contains the specified point</returns> 98 /// <returns>Returns true if the piece of land contains the specified point</returns>
99 public bool containsPoint(int x, int y) 99 public bool ContainsPoint(int x, int y)
100 { 100 {
101 if (x >= 0 && y >= 0 && x <= Constants.RegionSize && x <= Constants.RegionSize) 101 if (x >= 0 && y >= 0 && x <= Constants.RegionSize && x <= Constants.RegionSize)
102 { 102 {
103 return (landBitmap[x / 4, y / 4] == true); 103 return (LandBitmap[x / 4, y / 4] == true);
104 } 104 }
105 else 105 else
106 { 106 {
@@ -110,11 +110,11 @@ namespace OpenSim.Region.CoreModules.World.Land
110 110
111 public ILandObject Copy() 111 public ILandObject Copy()
112 { 112 {
113 ILandObject newLand = new LandObject(landData.OwnerID, landData.IsGroupOwned, m_scene); 113 ILandObject newLand = new LandObject(LandData.OwnerID, LandData.IsGroupOwned, m_scene);
114 114
115 //Place all new variables here! 115 //Place all new variables here!
116 newLand.landBitmap = (bool[,]) (landBitmap.Clone()); 116 newLand.LandBitmap = (bool[,]) (LandBitmap.Clone());
117 newLand.landData = landData.Copy(); 117 newLand.LandData = LandData.Copy();
118 118
119 return newLand; 119 return newLand;
120 } 120 }
@@ -122,16 +122,16 @@ namespace OpenSim.Region.CoreModules.World.Land
122 static overrideParcelMaxPrimCountDelegate overrideParcelMaxPrimCount; 122 static overrideParcelMaxPrimCountDelegate overrideParcelMaxPrimCount;
123 static overrideSimulatorMaxPrimCountDelegate overrideSimulatorMaxPrimCount; 123 static overrideSimulatorMaxPrimCountDelegate overrideSimulatorMaxPrimCount;
124 124
125 public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel) 125 public void SetParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel)
126 { 126 {
127 overrideParcelMaxPrimCount = overrideDel; 127 overrideParcelMaxPrimCount = overrideDel;
128 } 128 }
129 public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) 129 public void SetSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
130 { 130 {
131 overrideSimulatorMaxPrimCount = overrideDel; 131 overrideSimulatorMaxPrimCount = overrideDel;
132 } 132 }
133 133
134 public int getParcelMaxPrimCount(ILandObject thisObject) 134 public int GetParcelMaxPrimCount(ILandObject thisObject)
135 { 135 {
136 if (overrideParcelMaxPrimCount != null) 136 if (overrideParcelMaxPrimCount != null)
137 { 137 {
@@ -141,11 +141,11 @@ namespace OpenSim.Region.CoreModules.World.Land
141 { 141 {
142 //Normal Calculations 142 //Normal Calculations
143 return Convert.ToInt32( 143 return Convert.ToInt32(
144 Math.Round((Convert.ToDecimal(landData.Area) / Convert.ToDecimal(65536)) * m_scene.objectCapacity * 144 Math.Round((Convert.ToDecimal(LandData.Area) / Convert.ToDecimal(65536)) * m_scene.objectCapacity *
145 Convert.ToDecimal(m_scene.RegionInfo.RegionSettings.ObjectBonus))); ; 145 Convert.ToDecimal(m_scene.RegionInfo.RegionSettings.ObjectBonus))); ;
146 } 146 }
147 } 147 }
148 public int getSimulatorMaxPrimCount(ILandObject thisObject) 148 public int GetSimulatorMaxPrimCount(ILandObject thisObject)
149 { 149 {
150 if (overrideSimulatorMaxPrimCount != null) 150 if (overrideSimulatorMaxPrimCount != null)
151 { 151 {
@@ -161,7 +161,7 @@ namespace OpenSim.Region.CoreModules.World.Land
161 161
162 #region Packet Request Handling 162 #region Packet Request Handling
163 163
164 public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) 164 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client)
165 { 165 {
166 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); 166 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>();
167 uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome)); 167 uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome));
@@ -175,18 +175,18 @@ namespace OpenSim.Region.CoreModules.World.Land
175// if (landData.OwnerID == remote_client.AgentId) 175// if (landData.OwnerID == remote_client.AgentId)
176// regionFlags |= (uint)RegionFlags.AllowSetHome; 176// regionFlags |= (uint)RegionFlags.AllowSetHome;
177 remote_client.SendLandProperties(sequence_id, 177 remote_client.SendLandProperties(sequence_id,
178 snap_selection, request_result, landData, 178 snap_selection, request_result, LandData,
179 (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, 179 (float)m_scene.RegionInfo.RegionSettings.ObjectBonus,
180 getParcelMaxPrimCount(this), 180 GetParcelMaxPrimCount(this),
181 getSimulatorMaxPrimCount(this), regionFlags); 181 GetSimulatorMaxPrimCount(this), regionFlags);
182 } 182 }
183 183
184 public void updateLandProperties(LandUpdateArgs args, IClientAPI remote_client) 184 public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client)
185 { 185 {
186 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this)) 186 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this))
187 { 187 {
188 //Needs later group support 188 //Needs later group support
189 LandData newData = landData.Copy(); 189 LandData newData = LandData.Copy();
190 190
191 if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice) 191 if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice)
192 { 192 {
@@ -212,15 +212,15 @@ namespace OpenSim.Region.CoreModules.World.Land
212 newData.UserLocation = args.UserLocation; 212 newData.UserLocation = args.UserLocation;
213 newData.UserLookAt = args.UserLookAt; 213 newData.UserLookAt = args.UserLookAt;
214 214
215 m_scene.LandChannel.UpdateLandObject(landData.LocalID, newData); 215 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
216 216
217 sendLandUpdateToAvatarsOverMe(); 217 SendLandUpdateToAvatarsOverMe();
218 } 218 }
219 } 219 }
220 220
221 public void updateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) 221 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area)
222 { 222 {
223 LandData newData = landData.Copy(); 223 LandData newData = LandData.Copy();
224 newData.OwnerID = avatarID; 224 newData.OwnerID = avatarID;
225 newData.GroupID = groupID; 225 newData.GroupID = groupID;
226 newData.IsGroupOwned = groupOwned; 226 newData.IsGroupOwned = groupOwned;
@@ -230,45 +230,45 @@ namespace OpenSim.Region.CoreModules.World.Land
230 newData.SalePrice = 0; 230 newData.SalePrice = 0;
231 newData.AuthBuyerID = UUID.Zero; 231 newData.AuthBuyerID = UUID.Zero;
232 newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects); 232 newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects);
233 m_scene.LandChannel.UpdateLandObject(landData.LocalID, newData); 233 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
234 234
235 sendLandUpdateToAvatarsOverMe(); 235 SendLandUpdateToAvatarsOverMe();
236 } 236 }
237 237
238 public void deedToGroup(UUID groupID) 238 public void DeedToGroup(UUID groupID)
239 { 239 {
240 LandData newData = landData.Copy(); 240 LandData newData = LandData.Copy();
241 newData.OwnerID = groupID; 241 newData.OwnerID = groupID;
242 newData.GroupID = groupID; 242 newData.GroupID = groupID;
243 newData.IsGroupOwned = true; 243 newData.IsGroupOwned = true;
244 244
245 m_scene.LandChannel.UpdateLandObject(landData.LocalID, newData); 245 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
246 246
247 sendLandUpdateToAvatarsOverMe(); 247 SendLandUpdateToAvatarsOverMe();
248 } 248 }
249 249
250 public bool isEitherBannedOrRestricted(UUID avatar) 250 public bool IsEitherBannedOrRestricted(UUID avatar)
251 { 251 {
252 if (isBannedFromLand(avatar)) 252 if (IsBannedFromLand(avatar))
253 { 253 {
254 return true; 254 return true;
255 } 255 }
256 else if (isRestrictedFromLand(avatar)) 256 else if (IsRestrictedFromLand(avatar))
257 { 257 {
258 return true; 258 return true;
259 } 259 }
260 return false; 260 return false;
261 } 261 }
262 262
263 public bool isBannedFromLand(UUID avatar) 263 public bool IsBannedFromLand(UUID avatar)
264 { 264 {
265 if ((landData.Flags & (uint) ParcelFlags.UseBanList) > 0) 265 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0)
266 { 266 {
267 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 267 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
268 entry.AgentID = avatar; 268 entry.AgentID = avatar;
269 entry.Flags = AccessList.Ban; 269 entry.Flags = AccessList.Ban;
270 entry.Time = new DateTime(); 270 entry.Time = new DateTime();
271 if (landData.ParcelAccessList.Contains(entry)) 271 if (LandData.ParcelAccessList.Contains(entry))
272 { 272 {
273 //They are banned, so lets send them a notice about this parcel 273 //They are banned, so lets send them a notice about this parcel
274 return true; 274 return true;
@@ -277,15 +277,15 @@ namespace OpenSim.Region.CoreModules.World.Land
277 return false; 277 return false;
278 } 278 }
279 279
280 public bool isRestrictedFromLand(UUID avatar) 280 public bool IsRestrictedFromLand(UUID avatar)
281 { 281 {
282 if ((landData.Flags & (uint) ParcelFlags.UseAccessList) > 0) 282 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
283 { 283 {
284 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 284 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
285 entry.AgentID = avatar; 285 entry.AgentID = avatar;
286 entry.Flags = AccessList.Access; 286 entry.Flags = AccessList.Access;
287 entry.Time = new DateTime(); 287 entry.Time = new DateTime();
288 if (!landData.ParcelAccessList.Contains(entry)) 288 if (!LandData.ParcelAccessList.Contains(entry))
289 { 289 {
290 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel 290 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
291 return true; 291 return true;
@@ -294,12 +294,12 @@ namespace OpenSim.Region.CoreModules.World.Land
294 return false; 294 return false;
295 } 295 }
296 296
297 public void sendLandUpdateToClient(IClientAPI remote_client) 297 public void SendLandUpdateToClient(IClientAPI remote_client)
298 { 298 {
299 sendLandProperties(0, false, 0, remote_client); 299 SendLandProperties(0, false, 0, remote_client);
300 } 300 }
301 301
302 public void sendLandUpdateToAvatarsOverMe() 302 public void SendLandUpdateToAvatarsOverMe()
303 { 303 {
304 List<ScenePresence> avatars = m_scene.GetAvatars(); 304 List<ScenePresence> avatars = m_scene.GetAvatars();
305 ILandObject over = null; 305 ILandObject over = null;
@@ -319,14 +319,15 @@ namespace OpenSim.Region.CoreModules.World.Land
319 319
320 if (over != null) 320 if (over != null)
321 { 321 {
322 if (over.landData.LocalID == landData.LocalID) 322 if (over.LandData.LocalID == LandData.LocalID)
323 { 323 {
324 if (((over.landData.Flags & (uint)ParcelFlags.AllowDamage) != 0) && m_scene.RegionInfo.RegionSettings.AllowDamage) 324 if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) &&
325 m_scene.RegionInfo.RegionSettings.AllowDamage)
325 avatars[i].Invulnerable = false; 326 avatars[i].Invulnerable = false;
326 else 327 else
327 avatars[i].Invulnerable = true; 328 avatars[i].Invulnerable = true;
328 329
329 sendLandUpdateToClient(avatars[i].ControllingClient); 330 SendLandUpdateToClient(avatars[i].ControllingClient);
330 } 331 }
331 } 332 }
332 } 333 }
@@ -336,10 +337,10 @@ namespace OpenSim.Region.CoreModules.World.Land
336 337
337 #region AccessList Functions 338 #region AccessList Functions
338 339
339 public List<UUID> createAccessListArrayByFlag(AccessList flag) 340 public List<UUID> CreateAccessListArrayByFlag(AccessList flag)
340 { 341 {
341 List<UUID> list = new List<UUID>(); 342 List<UUID> list = new List<UUID>();
342 foreach (ParcelManager.ParcelAccessEntry entry in landData.ParcelAccessList) 343 foreach (ParcelManager.ParcelAccessEntry entry in LandData.ParcelAccessList)
343 { 344 {
344 if (entry.Flags == flag) 345 if (entry.Flags == flag)
345 { 346 {
@@ -354,26 +355,26 @@ namespace OpenSim.Region.CoreModules.World.Land
354 return list; 355 return list;
355 } 356 }
356 357
357 public void sendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, 358 public void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID,
358 IClientAPI remote_client) 359 IClientAPI remote_client)
359 { 360 {
360 361
361 if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both) 362 if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both)
362 { 363 {
363 List<UUID> avatars = createAccessListArrayByFlag(AccessList.Access); 364 List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Access);
364 remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,landData.LocalID); 365 remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,LandData.LocalID);
365 } 366 }
366 367
367 if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both) 368 if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both)
368 { 369 {
369 List<UUID> avatars = createAccessListArrayByFlag(AccessList.Ban); 370 List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Ban);
370 remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, landData.LocalID); 371 remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, LandData.LocalID);
371 } 372 }
372 } 373 }
373 374
374 public void updateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) 375 public void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client)
375 { 376 {
376 LandData newData = landData.Copy(); 377 LandData newData = LandData.Copy();
377 378
378 if (entries.Count == 1 && entries[0].AgentID == UUID.Zero) 379 if (entries.Count == 1 && entries[0].AgentID == UUID.Zero)
379 { 380 {
@@ -406,36 +407,36 @@ namespace OpenSim.Region.CoreModules.World.Land
406 } 407 }
407 } 408 }
408 409
409 m_scene.LandChannel.UpdateLandObject(landData.LocalID, newData); 410 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
410 } 411 }
411 412
412 #endregion 413 #endregion
413 414
414 #region Update Functions 415 #region Update Functions
415 416
416 public void updateLandBitmapByteArray() 417 public void UpdateLandBitmapByteArray()
417 { 418 {
418 landData.Bitmap = convertLandBitmapToBytes(); 419 LandData.Bitmap = ConvertLandBitmapToBytes();
419 } 420 }
420 421
421 /// <summary> 422 /// <summary>
422 /// Update all settings in land such as area, bitmap byte array, etc 423 /// Update all settings in land such as area, bitmap byte array, etc
423 /// </summary> 424 /// </summary>
424 public void forceUpdateLandInfo() 425 public void ForceUpdateLandInfo()
425 { 426 {
426 updateAABBAndAreaValues(); 427 UpdateAABBAndAreaValues();
427 updateLandBitmapByteArray(); 428 UpdateLandBitmapByteArray();
428 } 429 }
429 430
430 public void setLandBitmapFromByteArray() 431 public void SetLandBitmapFromByteArray()
431 { 432 {
432 landBitmap = convertBytesToLandBitmap(); 433 LandBitmap = ConvertBytesToLandBitmap();
433 } 434 }
434 435
435 /// <summary> 436 /// <summary>
436 /// Updates the AABBMin and AABBMax values after area/shape modification of the land object 437 /// Updates the AABBMin and AABBMax values after area/shape modification of the land object
437 /// </summary> 438 /// </summary>
438 private void updateAABBAndAreaValues() 439 private void UpdateAABBAndAreaValues()
439 { 440 {
440 int min_x = 64; 441 int min_x = 64;
441 int min_y = 64; 442 int min_y = 64;
@@ -447,7 +448,7 @@ namespace OpenSim.Region.CoreModules.World.Land
447 { 448 {
448 for (y = 0; y < 64; y++) 449 for (y = 0; y < 64; y++)
449 { 450 {
450 if (landBitmap[x, y] == true) 451 if (LandBitmap[x, y] == true)
451 { 452 {
452 if (min_x > x) min_x = x; 453 if (min_x > x) min_x = x;
453 if (min_y > y) min_y = y; 454 if (min_y > y) min_y = y;
@@ -463,7 +464,7 @@ namespace OpenSim.Region.CoreModules.World.Land
463 int ty = min_y * 4; 464 int ty = min_y * 4;
464 if (ty > ((int)Constants.RegionSize - 1)) 465 if (ty > ((int)Constants.RegionSize - 1))
465 ty = ((int)Constants.RegionSize - 1); 466 ty = ((int)Constants.RegionSize - 1);
466 landData.AABBMin = 467 LandData.AABBMin =
467 new Vector3((float) (min_x * 4), (float) (min_y * 4), 468 new Vector3((float) (min_x * 4), (float) (min_y * 4),
468 (float) m_scene.Heightmap[tx, ty]); 469 (float) m_scene.Heightmap[tx, ty]);
469 470
@@ -473,10 +474,10 @@ namespace OpenSim.Region.CoreModules.World.Land
473 ty = max_y * 4; 474 ty = max_y * 4;
474 if (ty > ((int)Constants.RegionSize - 1)) 475 if (ty > ((int)Constants.RegionSize - 1))
475 ty = ((int)Constants.RegionSize - 1); 476 ty = ((int)Constants.RegionSize - 1);
476 landData.AABBMax = 477 LandData.AABBMax =
477 new Vector3((float) (max_x * 4), (float) (max_y * 4), 478 new Vector3((float) (max_x * 4), (float) (max_y * 4),
478 (float) m_scene.Heightmap[tx, ty]); 479 (float) m_scene.Heightmap[tx, ty]);
479 landData.Area = tempArea; 480 LandData.Area = tempArea;
480 } 481 }
481 482
482 #endregion 483 #endregion
@@ -487,7 +488,7 @@ namespace OpenSim.Region.CoreModules.World.Land
487 /// Sets the land's bitmap manually 488 /// Sets the land's bitmap manually
488 /// </summary> 489 /// </summary>
489 /// <param name="bitmap">64x64 block representing where this land is on a map</param> 490 /// <param name="bitmap">64x64 block representing where this land is on a map</param>
490 public void setLandBitmap(bool[,] bitmap) 491 public void SetLandBitmap(bool[,] bitmap)
491 { 492 {
492 if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) 493 if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2)
493 { 494 {
@@ -497,8 +498,8 @@ namespace OpenSim.Region.CoreModules.World.Land
497 else 498 else
498 { 499 {
499 //Valid: Lets set it 500 //Valid: Lets set it
500 landBitmap = bitmap; 501 LandBitmap = bitmap;
501 forceUpdateLandInfo(); 502 ForceUpdateLandInfo();
502 } 503 }
503 } 504 }
504 505
@@ -506,18 +507,18 @@ namespace OpenSim.Region.CoreModules.World.Land
506 /// Gets the land's bitmap manually 507 /// Gets the land's bitmap manually
507 /// </summary> 508 /// </summary>
508 /// <returns></returns> 509 /// <returns></returns>
509 public bool[,] getLandBitmap() 510 public bool[,] GetLandBitmap()
510 { 511 {
511 return landBitmap; 512 return LandBitmap;
512 } 513 }
513 514
514 /// <summary> 515 /// <summary>
515 /// Full sim land object creation 516 /// Full sim land object creation
516 /// </summary> 517 /// </summary>
517 /// <returns></returns> 518 /// <returns></returns>
518 public bool[,] basicFullRegionLandBitmap() 519 public bool[,] BasicFullRegionLandBitmap()
519 { 520 {
520 return getSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); 521 return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize);
521 } 522 }
522 523
523 /// <summary> 524 /// <summary>
@@ -528,12 +529,12 @@ namespace OpenSim.Region.CoreModules.World.Land
528 /// <param name="end_x"></param> 529 /// <param name="end_x"></param>
529 /// <param name="end_y"></param> 530 /// <param name="end_y"></param>
530 /// <returns></returns> 531 /// <returns></returns>
531 public bool[,] getSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) 532 public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y)
532 { 533 {
533 bool[,] tempBitmap = new bool[64,64]; 534 bool[,] tempBitmap = new bool[64,64];
534 tempBitmap.Initialize(); 535 tempBitmap.Initialize();
535 536
536 tempBitmap = modifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); 537 tempBitmap = ModifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true);
537 return tempBitmap; 538 return tempBitmap;
538 } 539 }
539 540
@@ -547,7 +548,7 @@ namespace OpenSim.Region.CoreModules.World.Land
547 /// <param name="end_y"></param> 548 /// <param name="end_y"></param>
548 /// <param name="set_value"></param> 549 /// <param name="set_value"></param>
549 /// <returns></returns> 550 /// <returns></returns>
550 public bool[,] modifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, 551 public bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y,
551 bool set_value) 552 bool set_value)
552 { 553 {
553 if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2) 554 if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2)
@@ -577,7 +578,7 @@ namespace OpenSim.Region.CoreModules.World.Land
577 /// <param name="bitmap_base"></param> 578 /// <param name="bitmap_base"></param>
578 /// <param name="bitmap_add"></param> 579 /// <param name="bitmap_add"></param>
579 /// <returns></returns> 580 /// <returns></returns>
580 public bool[,] mergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) 581 public bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add)
581 { 582 {
582 if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) 583 if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2)
583 { 584 {
@@ -608,7 +609,7 @@ namespace OpenSim.Region.CoreModules.World.Land
608 /// Converts the land bitmap to a packet friendly byte array 609 /// Converts the land bitmap to a packet friendly byte array
609 /// </summary> 610 /// </summary>
610 /// <returns></returns> 611 /// <returns></returns>
611 private byte[] convertLandBitmapToBytes() 612 private byte[] ConvertLandBitmapToBytes()
612 { 613 {
613 byte[] tempConvertArr = new byte[512]; 614 byte[] tempConvertArr = new byte[512];
614 byte tempByte = 0; 615 byte tempByte = 0;
@@ -618,7 +619,7 @@ namespace OpenSim.Region.CoreModules.World.Land
618 { 619 {
619 for (x = 0; x < 64; x++) 620 for (x = 0; x < 64; x++)
620 { 621 {
621 tempByte = Convert.ToByte(tempByte | Convert.ToByte(landBitmap[x, y]) << (i++ % 8)); 622 tempByte = Convert.ToByte(tempByte | Convert.ToByte(LandBitmap[x, y]) << (i++ % 8));
622 if (i % 8 == 0) 623 if (i % 8 == 0)
623 { 624 {
624 tempConvertArr[byteNum] = tempByte; 625 tempConvertArr[byteNum] = tempByte;
@@ -631,7 +632,7 @@ namespace OpenSim.Region.CoreModules.World.Land
631 return tempConvertArr; 632 return tempConvertArr;
632 } 633 }
633 634
634 private bool[,] convertBytesToLandBitmap() 635 private bool[,] ConvertBytesToLandBitmap()
635 { 636 {
636 bool[,] tempConvertMap = new bool[landArrayMax, landArrayMax]; 637 bool[,] tempConvertMap = new bool[landArrayMax, landArrayMax];
637 tempConvertMap.Initialize(); 638 tempConvertMap.Initialize();
@@ -639,7 +640,7 @@ namespace OpenSim.Region.CoreModules.World.Land
639 int x = 0, y = 0, i = 0, bitNum = 0; 640 int x = 0, y = 0, i = 0, bitNum = 0;
640 for (i = 0; i < 512; i++) 641 for (i = 0; i < 512; i++)
641 { 642 {
642 tempByte = landData.Bitmap[i]; 643 tempByte = LandData.Bitmap[i];
643 for (bitNum = 0; bitNum < 8; bitNum++) 644 for (bitNum = 0; bitNum < 8; bitNum++)
644 { 645 {
645 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1); 646 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1);
@@ -659,7 +660,7 @@ namespace OpenSim.Region.CoreModules.World.Land
659 660
660 #region Object Select and Object Owner Listing 661 #region Object Select and Object Owner Listing
661 662
662 public void sendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) 663 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client)
663 { 664 {
664 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) 665 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this))
665 { 666 {
@@ -672,11 +673,11 @@ namespace OpenSim.Region.CoreModules.World.Land
672 { 673 {
673 if (obj.LocalId > 0) 674 if (obj.LocalId > 0)
674 { 675 {
675 if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == landData.OwnerID) 676 if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == LandData.OwnerID)
676 { 677 {
677 resultLocalIDs.Add(obj.LocalId); 678 resultLocalIDs.Add(obj.LocalId);
678 } 679 }
679 else if (request_type == LandChannel.LAND_SELECT_OBJECTS_GROUP && obj.GroupID == landData.GroupID && landData.GroupID != UUID.Zero) 680 else if (request_type == LandChannel.LAND_SELECT_OBJECTS_GROUP && obj.GroupID == LandData.GroupID && LandData.GroupID != UUID.Zero)
680 { 681 {
681 resultLocalIDs.Add(obj.LocalId); 682 resultLocalIDs.Add(obj.LocalId);
682 } 683 }
@@ -709,7 +710,7 @@ namespace OpenSim.Region.CoreModules.World.Land
709 /// <param name="remote_client"> 710 /// <param name="remote_client">
710 /// A <see cref="IClientAPI"/> 711 /// A <see cref="IClientAPI"/>
711 /// </param> 712 /// </param>
712 public void sendLandObjectOwners(IClientAPI remote_client) 713 public void SendLandObjectOwners(IClientAPI remote_client)
713 { 714 {
714 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) 715 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this))
715 { 716 {
@@ -752,11 +753,11 @@ namespace OpenSim.Region.CoreModules.World.Land
752 } 753 }
753 } 754 }
754 755
755 remote_client.SendLandObjectOwners(landData, groups, primCount); 756 remote_client.SendLandObjectOwners(LandData, groups, primCount);
756 } 757 }
757 } 758 }
758 759
759 public Dictionary<UUID, int> getLandObjectOwners() 760 public Dictionary<UUID, int> GetLandObjectOwners()
760 { 761 {
761 Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>(); 762 Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>();
762 lock (primsOverMe) 763 lock (primsOverMe)
@@ -786,14 +787,14 @@ namespace OpenSim.Region.CoreModules.World.Land
786 787
787 #region Object Returning 788 #region Object Returning
788 789
789 public void returnObject(SceneObjectGroup obj) 790 public void ReturnObject(SceneObjectGroup obj)
790 { 791 {
791 SceneObjectGroup[] objs = new SceneObjectGroup[1]; 792 SceneObjectGroup[] objs = new SceneObjectGroup[1];
792 objs[0] = obj; 793 objs[0] = obj;
793 m_scene.returnObjects(objs, obj.OwnerID); 794 m_scene.returnObjects(objs, obj.OwnerID);
794 } 795 }
795 796
796 public void returnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client) 797 public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client)
797 { 798 {
798 Dictionary<UUID,List<SceneObjectGroup>> returns = 799 Dictionary<UUID,List<SceneObjectGroup>> returns =
799 new Dictionary<UUID,List<SceneObjectGroup>>(); 800 new Dictionary<UUID,List<SceneObjectGroup>>();
@@ -869,19 +870,19 @@ namespace OpenSim.Region.CoreModules.World.Land
869 870
870 #region Object Adding/Removing from Parcel 871 #region Object Adding/Removing from Parcel
871 872
872 public void resetLandPrimCounts() 873 public void ResetLandPrimCounts()
873 { 874 {
874 landData.GroupPrims = 0; 875 LandData.GroupPrims = 0;
875 landData.OwnerPrims = 0; 876 LandData.OwnerPrims = 0;
876 landData.OtherPrims = 0; 877 LandData.OtherPrims = 0;
877 landData.SelectedPrims = 0; 878 LandData.SelectedPrims = 0;
878 879
879 880
880 lock (primsOverMe) 881 lock (primsOverMe)
881 primsOverMe.Clear(); 882 primsOverMe.Clear();
882 } 883 }
883 884
884 public void addPrimToCount(SceneObjectGroup obj) 885 public void AddPrimToCount(SceneObjectGroup obj)
885 { 886 {
886 887
887 UUID prim_owner = obj.OwnerID; 888 UUID prim_owner = obj.OwnerID;
@@ -889,23 +890,23 @@ namespace OpenSim.Region.CoreModules.World.Land
889 890
890 if (obj.IsSelected) 891 if (obj.IsSelected)
891 { 892 {
892 landData.SelectedPrims += prim_count; 893 LandData.SelectedPrims += prim_count;
893 } 894 }
894 else 895 else
895 { 896 {
896 if (prim_owner == landData.OwnerID) 897 if (prim_owner == LandData.OwnerID)
897 { 898 {
898 landData.OwnerPrims += prim_count; 899 LandData.OwnerPrims += prim_count;
899 } 900 }
900 else if ((obj.GroupID == landData.GroupID || 901 else if ((obj.GroupID == LandData.GroupID ||
901 prim_owner == landData.GroupID) && 902 prim_owner == LandData.GroupID) &&
902 landData.GroupID != UUID.Zero) 903 LandData.GroupID != UUID.Zero)
903 { 904 {
904 landData.GroupPrims += prim_count; 905 LandData.GroupPrims += prim_count;
905 } 906 }
906 else 907 else
907 { 908 {
908 landData.OtherPrims += prim_count; 909 LandData.OtherPrims += prim_count;
909 } 910 }
910 } 911 }
911 912
@@ -913,7 +914,7 @@ namespace OpenSim.Region.CoreModules.World.Land
913 primsOverMe.Add(obj); 914 primsOverMe.Add(obj);
914 } 915 }
915 916
916 public void removePrimFromCount(SceneObjectGroup obj) 917 public void RemovePrimFromCount(SceneObjectGroup obj)
917 { 918 {
918 lock (primsOverMe) 919 lock (primsOverMe)
919 { 920 {
@@ -922,18 +923,18 @@ namespace OpenSim.Region.CoreModules.World.Land
922 UUID prim_owner = obj.OwnerID; 923 UUID prim_owner = obj.OwnerID;
923 int prim_count = obj.PrimCount; 924 int prim_count = obj.PrimCount;
924 925
925 if (prim_owner == landData.OwnerID) 926 if (prim_owner == LandData.OwnerID)
926 { 927 {
927 landData.OwnerPrims -= prim_count; 928 LandData.OwnerPrims -= prim_count;
928 } 929 }
929 else if (obj.GroupID == landData.GroupID || 930 else if (obj.GroupID == LandData.GroupID ||
930 prim_owner == landData.GroupID) 931 prim_owner == LandData.GroupID)
931 { 932 {
932 landData.GroupPrims -= prim_count; 933 LandData.GroupPrims -= prim_count;
933 } 934 }
934 else 935 else
935 { 936 {
936 landData.OtherPrims -= prim_count; 937 LandData.OtherPrims -= prim_count;
937 } 938 }
938 939
939 primsOverMe.Remove(obj); 940 primsOverMe.Remove(obj);
@@ -953,8 +954,8 @@ namespace OpenSim.Region.CoreModules.World.Land
953 /// <param name="url"></param> 954 /// <param name="url"></param>
954 public void SetMediaUrl(string url) 955 public void SetMediaUrl(string url)
955 { 956 {
956 landData.MediaURL = url; 957 LandData.MediaURL = url;
957 sendLandUpdateToAvatarsOverMe(); 958 SendLandUpdateToAvatarsOverMe();
958 } 959 }
959 960
960 /// <summary> 961 /// <summary>
@@ -963,8 +964,8 @@ namespace OpenSim.Region.CoreModules.World.Land
963 /// <param name="url"></param> 964 /// <param name="url"></param>
964 public void SetMusicUrl(string url) 965 public void SetMusicUrl(string url)
965 { 966 {
966 landData.MusicURL = url; 967 LandData.MusicURL = url;
967 sendLandUpdateToAvatarsOverMe(); 968 SendLandUpdateToAvatarsOverMe();
968 } 969 }
969 } 970 }
970} 971}
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
index 65f22b1..2cbaf96 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerIndividualEventForwarder.cs
@@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.World.Land
85 private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart, 85 private void LocalRezObject(IClientAPI remoteclient, UUID itemid, Vector3 rayend, Vector3 raystart,
86 UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem, 86 UUID raytargetid, byte bypassraycast, bool rayendisintersection, bool rezselected, bool removeitem,
87 UUID fromtaskid) 87 UUID fromtaskid)
88 { 88 {
89 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX; 89 int differenceX = (int)m_virtScene.RegionInfo.RegionLocX - (int)m_rootScene.RegionInfo.RegionLocX;
90 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY; 90 int differenceY = (int)m_virtScene.RegionInfo.RegionLocY - (int)m_rootScene.RegionInfo.RegionLocY;
91 rayend.X += differenceX * (int)Constants.RegionSize; 91 rayend.X += differenceX * (int)Constants.RegionSize;
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
index 9e46b94..7df836c 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerLargeLandChannel.cs
@@ -85,7 +85,7 @@ public class RegionCombinerLargeLandChannel : ILandChannel
85 } 85 }
86 } 86 }
87 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); 87 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
88 obj.landData.Name = "NO LAND"; 88 obj.LandData.Name = "NO LAND";
89 return obj; 89 return obj;
90 } 90 }
91 } 91 }
@@ -118,7 +118,7 @@ public class RegionCombinerLargeLandChannel : ILandChannel
118 } 118 }
119 } 119 }
120 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); 120 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
121 obj.landData.Name = "NO LAND"; 121 obj.LandData.Name = "NO LAND";
122 return obj; 122 return obj;
123 } 123 }
124 } 124 }
diff --git a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
index 1436912..05d19a2 100644
--- a/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/RegionCombinerModule.cs
@@ -35,6 +35,7 @@ using OpenSim.Framework;
35using OpenSim.Framework.Client; 35using OpenSim.Framework.Client;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Framework.Console;
38 39
39namespace OpenSim.Region.CoreModules.World.Land 40namespace OpenSim.Region.CoreModules.World.Land
40{ 41{
@@ -61,7 +62,10 @@ namespace OpenSim.Region.CoreModules.World.Land
61 IConfig myConfig = source.Configs["Startup"]; 62 IConfig myConfig = source.Configs["Startup"];
62 enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false); 63 enabledYN = myConfig.GetBoolean("CombineContiguousRegions", false);
63 //enabledYN = true; 64 //enabledYN = true;
64 } 65 if (enabledYN)
66 MainConsole.Instance.Commands.AddCommand("RegionCombinerModule", false, "fix-phantoms",
67 "Fix phantom objects", "Fixes phantom objects after an import to megaregions", FixPhantoms);
68 }
65 69
66 public void Close() 70 public void Close()
67 { 71 {
@@ -79,12 +83,12 @@ namespace OpenSim.Region.CoreModules.World.Land
79 { 83 {
80 if (!enabledYN) 84 if (!enabledYN)
81 return; 85 return;
82 86/*
83 // For testing on a single instance 87 // For testing on a single instance
84 if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000) 88 if (scene.RegionInfo.RegionLocX == 1004 && scene.RegionInfo.RegionLocY == 1000)
85 return; 89 return;
86 // 90 //
87 91*/
88 lock (m_startingScenes) 92 lock (m_startingScenes)
89 m_startingScenes.Add(scene.RegionInfo.originRegionID, scene); 93 m_startingScenes.Add(scene.RegionInfo.originRegionID, scene);
90 94
@@ -504,7 +508,7 @@ namespace OpenSim.Region.CoreModules.World.Land
504 scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY; 508 scene.WestBorders[0].TriggerRegionY = conn.RegionScene.RegionInfo.RegionLocY;
505 } 509 }
506 510
507 /* 511 /*
508 else 512 else
509 { 513 {
510 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; 514 conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
@@ -876,7 +880,7 @@ namespace OpenSim.Region.CoreModules.World.Land
876 VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject; 880 VirtualRegion.Permissions.OnDuplicateObject += BigRegion.PermissionModule.CanDuplicateObject;
877 VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED 881 VirtualRegion.Permissions.OnDeleteObject += BigRegion.PermissionModule.CanDeleteObject; //MAYBE FULLY IMPLEMENTED
878 VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED 882 VirtualRegion.Permissions.OnEditObject += BigRegion.PermissionModule.CanEditObject; //MAYBE FULLY IMPLEMENTED
879 VirtualRegion.Permissions.OnEditParcel += BigRegion.PermissionModule.CanEditParcel; //MAYBE FULLY IMPLEMENTED 883 VirtualRegion.Permissions.OnEditParcel += BigRegion.PermissionModule.CanEditParcel; //MAYBE FULLY IMPLEMENTED
880 VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage; 884 VirtualRegion.Permissions.OnInstantMessage += BigRegion.PermissionModule.CanInstantMessage;
881 VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED 885 VirtualRegion.Permissions.OnInventoryTransfer += BigRegion.PermissionModule.CanInventoryTransfer; //NOT YET IMPLEMENTED
882 VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED 886 VirtualRegion.Permissions.OnIssueEstateCommand += BigRegion.PermissionModule.CanIssueEstateCommand; //FULLY IMPLEMENTED
@@ -895,11 +899,11 @@ namespace OpenSim.Region.CoreModules.World.Land
895 VirtualRegion.Permissions.OnDelinkObject += BigRegion.PermissionModule.CanDelinkObject; //NOT YET IMPLEMENTED 899 VirtualRegion.Permissions.OnDelinkObject += BigRegion.PermissionModule.CanDelinkObject; //NOT YET IMPLEMENTED
896 VirtualRegion.Permissions.OnBuyLand += BigRegion.PermissionModule.CanBuyLand; //NOT YET IMPLEMENTED 900 VirtualRegion.Permissions.OnBuyLand += BigRegion.PermissionModule.CanBuyLand; //NOT YET IMPLEMENTED
897 VirtualRegion.Permissions.OnViewNotecard += BigRegion.PermissionModule.CanViewNotecard; //NOT YET IMPLEMENTED 901 VirtualRegion.Permissions.OnViewNotecard += BigRegion.PermissionModule.CanViewNotecard; //NOT YET IMPLEMENTED
898 VirtualRegion.Permissions.OnViewScript += BigRegion.PermissionModule.CanViewScript; //NOT YET IMPLEMENTED 902 VirtualRegion.Permissions.OnViewScript += BigRegion.PermissionModule.CanViewScript; //NOT YET IMPLEMENTED
899 VirtualRegion.Permissions.OnEditNotecard += BigRegion.PermissionModule.CanEditNotecard; //NOT YET IMPLEMENTED 903 VirtualRegion.Permissions.OnEditNotecard += BigRegion.PermissionModule.CanEditNotecard; //NOT YET IMPLEMENTED
900 VirtualRegion.Permissions.OnEditScript += BigRegion.PermissionModule.CanEditScript; //NOT YET IMPLEMENTED 904 VirtualRegion.Permissions.OnEditScript += BigRegion.PermissionModule.CanEditScript; //NOT YET IMPLEMENTED
901 VirtualRegion.Permissions.OnCreateObjectInventory += BigRegion.PermissionModule.CanCreateObjectInventory; //NOT IMPLEMENTED HERE 905 VirtualRegion.Permissions.OnCreateObjectInventory += BigRegion.PermissionModule.CanCreateObjectInventory; //NOT IMPLEMENTED HERE
902 VirtualRegion.Permissions.OnEditObjectInventory += BigRegion.PermissionModule.CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED 906 VirtualRegion.Permissions.OnEditObjectInventory += BigRegion.PermissionModule.CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
903 VirtualRegion.Permissions.OnCopyObjectInventory += BigRegion.PermissionModule.CanCopyObjectInventory; //NOT YET IMPLEMENTED 907 VirtualRegion.Permissions.OnCopyObjectInventory += BigRegion.PermissionModule.CanCopyObjectInventory; //NOT YET IMPLEMENTED
904 VirtualRegion.Permissions.OnDeleteObjectInventory += BigRegion.PermissionModule.CanDeleteObjectInventory; //NOT YET IMPLEMENTED 908 VirtualRegion.Permissions.OnDeleteObjectInventory += BigRegion.PermissionModule.CanDeleteObjectInventory; //NOT YET IMPLEMENTED
905 VirtualRegion.Permissions.OnResetScript += BigRegion.PermissionModule.CanResetScript; 909 VirtualRegion.Permissions.OnResetScript += BigRegion.PermissionModule.CanResetScript;
@@ -910,5 +914,20 @@ namespace OpenSim.Region.CoreModules.World.Land
910 VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED 914 VirtualRegion.Permissions.OnTeleport += BigRegion.PermissionModule.CanTeleport; //NOT YET IMPLEMENTED
911 VirtualRegion.Permissions.OnUseObjectReturn += BigRegion.PermissionModule.CanUseObjectReturn; //NOT YET IMPLEMENTED 915 VirtualRegion.Permissions.OnUseObjectReturn += BigRegion.PermissionModule.CanUseObjectReturn; //NOT YET IMPLEMENTED
912 } 916 }
917
918 #region console commands
919 public void FixPhantoms(string module, string[] cmdparams)
920 {
921 List<Scene> scenes = new List<Scene>(m_startingScenes.Values);
922 foreach (Scene s in scenes)
923 {
924 s.ForEachSOG(delegate(SceneObjectGroup e)
925 {
926 e.AbsolutePosition = e.AbsolutePosition;
927 }
928 );
929 }
930 }
931 #endregion
913 } 932 }
914} 933}