diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land')
5 files changed, 919 insertions, 49 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs index bd22155..d17c517 100644 --- a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs | |||
@@ -52,10 +52,12 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; | |||
52 | 52 | ||
53 | namespace OpenSim.Region.CoreModules.World.Land | 53 | namespace OpenSim.Region.CoreModules.World.Land |
54 | { | 54 | { |
55 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DwellModule")] | 55 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DefaultDwellModule")] |
56 | public class DwellModule : IDwellModule, INonSharedRegionModule | 56 | public class DefaultDwellModule : IDwellModule, INonSharedRegionModule |
57 | { | 57 | { |
58 | private Scene m_scene; | 58 | private Scene m_scene; |
59 | private IConfigSource m_Config; | ||
60 | private bool m_Enabled = false; | ||
59 | 61 | ||
60 | public Type ReplaceableInterface | 62 | public Type ReplaceableInterface |
61 | { | 63 | { |
@@ -64,15 +66,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
64 | 66 | ||
65 | public string Name | 67 | public string Name |
66 | { | 68 | { |
67 | get { return "DwellModule"; } | 69 | get { return "DefaultDwellModule"; } |
68 | } | 70 | } |
69 | 71 | ||
70 | public void Initialise(IConfigSource source) | 72 | public void Initialise(IConfigSource source) |
71 | { | 73 | { |
74 | m_Config = source; | ||
75 | |||
76 | IConfig DwellConfig = m_Config.Configs ["Dwell"]; | ||
77 | |||
78 | if (DwellConfig == null) { | ||
79 | m_Enabled = false; | ||
80 | return; | ||
81 | } | ||
82 | m_Enabled = (DwellConfig.GetString ("DwellModule", "DefaultDwellModule") == "DefaultDwellModule"); | ||
72 | } | 83 | } |
73 | 84 | ||
74 | public void AddRegion(Scene scene) | 85 | public void AddRegion(Scene scene) |
75 | { | 86 | { |
87 | if (!m_Enabled) | ||
88 | return; | ||
89 | |||
76 | m_scene = scene; | 90 | m_scene = scene; |
77 | 91 | ||
78 | m_scene.EventManager.OnNewClient += OnNewClient; | 92 | m_scene.EventManager.OnNewClient += OnNewClient; |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 6f3249d..8bd46f6 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -69,13 +69,18 @@ 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 | ||
73 | public const int LandUnit = 4; | ||
74 | ======= | ||
72 | public const int landUnit = 4; | 75 | public const int landUnit = 4; |
76 | >>>>>>> avn/ubitvar | ||
73 | 77 | ||
74 | private static readonly string remoteParcelRequestPath = "0009/"; | 78 | private static readonly string remoteParcelRequestPath = "0009/"; |
75 | 79 | ||
76 | private LandChannel landChannel; | 80 | private LandChannel landChannel; |
77 | private Scene m_scene; | 81 | private Scene m_scene; |
78 | 82 | ||
83 | protected IGroupsModule m_groupManager; | ||
79 | protected IUserManagement m_userManager; | 84 | protected IUserManagement m_userManager; |
80 | protected IPrimCountModule m_primCountModule; | 85 | protected IPrimCountModule m_primCountModule; |
81 | protected IDialogModule m_Dialog; | 86 | protected IDialogModule m_Dialog; |
@@ -101,8 +106,22 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
101 | 106 | ||
102 | // caches ExtendedLandData | 107 | // caches ExtendedLandData |
103 | private Cache parcelInfoCache; | 108 | private Cache parcelInfoCache; |
109 | <<<<<<< HEAD | ||
110 | |||
111 | |||
112 | /// <summary> | ||
113 | /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. | ||
114 | /// </summary> | ||
115 | private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>(); | ||
116 | ======= | ||
104 | private Dictionary<UUID, Vector3> forcedPosition = | 117 | private Dictionary<UUID, Vector3> forcedPosition = |
105 | new Dictionary<UUID, Vector3>(); | 118 | new Dictionary<UUID, Vector3>(); |
119 | >>>>>>> avn/ubitvar | ||
120 | |||
121 | // Enables limiting parcel layer info transmission when doing simple updates | ||
122 | private bool shouldLimitParcelLayerInfoToViewDistance { get; set; } | ||
123 | // "View distance" for sending parcel layer info if asked for from a view point in the region | ||
124 | private int parcelLayerViewDistance { get; set; } | ||
106 | 125 | ||
107 | #region INonSharedRegionModule Members | 126 | #region INonSharedRegionModule Members |
108 | 127 | ||
@@ -113,18 +132,32 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
113 | 132 | ||
114 | public void Initialise(IConfigSource source) | 133 | public void Initialise(IConfigSource source) |
115 | { | 134 | { |
135 | <<<<<<< HEAD | ||
136 | shouldLimitParcelLayerInfoToViewDistance = true; | ||
137 | parcelLayerViewDistance = 128; | ||
138 | IConfig landManagementConfig = source.Configs["LandManagement"]; | ||
139 | if (landManagementConfig != null) | ||
140 | { | ||
141 | shouldLimitParcelLayerInfoToViewDistance = landManagementConfig.GetBoolean("LimitParcelLayerUpdateDistance", shouldLimitParcelLayerInfoToViewDistance); | ||
142 | parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance); | ||
143 | ======= | ||
116 | IConfig cnf = source.Configs["LandManagement"]; | 144 | IConfig cnf = source.Configs["LandManagement"]; |
117 | if (cnf != null) | 145 | if (cnf != null) |
118 | { | 146 | { |
119 | DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); | 147 | DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); |
120 | DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel"); | 148 | DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel"); |
149 | >>>>>>> avn/ubitvar | ||
121 | } | 150 | } |
122 | } | 151 | } |
123 | 152 | ||
124 | public void AddRegion(Scene scene) | 153 | public void AddRegion(Scene scene) |
125 | { | 154 | { |
126 | m_scene = scene; | 155 | m_scene = scene; |
156 | <<<<<<< HEAD | ||
157 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; | ||
158 | ======= | ||
127 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; | 159 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; |
160 | >>>>>>> avn/ubitvar | ||
128 | landChannel = new LandChannel(scene, this); | 161 | landChannel = new LandChannel(scene, this); |
129 | 162 | ||
130 | parcelInfoCache = new Cache(); | 163 | parcelInfoCache = new Cache(); |
@@ -158,9 +191,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
158 | 191 | ||
159 | public void RegionLoaded(Scene scene) | 192 | public void RegionLoaded(Scene scene) |
160 | { | 193 | { |
161 | m_userManager = m_scene.RequestModuleInterface<IUserManagement>(); | 194 | m_userManager = m_scene.RequestModuleInterface<IUserManagement>(); |
162 | m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>(); | 195 | m_groupManager = m_scene.RequestModuleInterface<IGroupsModule>(); |
163 | m_Dialog = m_scene.RequestModuleInterface<IDialogModule>(); | 196 | m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>(); |
197 | m_Dialog = m_scene.RequestModuleInterface<IDialogModule>(); | ||
164 | } | 198 | } |
165 | 199 | ||
166 | public void RemoveRegion(Scene scene) | 200 | public void RemoveRegion(Scene scene) |
@@ -265,7 +299,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
265 | { | 299 | { |
266 | m_landList.Clear(); | 300 | m_landList.Clear(); |
267 | m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 301 | m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
302 | <<<<<<< HEAD | ||
303 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; | ||
304 | ======= | ||
268 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; | 305 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; |
306 | >>>>>>> avn/ubitvar | ||
269 | } | 307 | } |
270 | } | 308 | } |
271 | 309 | ||
@@ -275,9 +313,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
275 | /// <returns>The parcel created.</returns> | 313 | /// <returns>The parcel created.</returns> |
276 | protected ILandObject CreateDefaultParcel() | 314 | protected ILandObject CreateDefaultParcel() |
277 | { | 315 | { |
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 | ======= | ||
278 | m_log.DebugFormat("{0} Creating default parcel for region {1}", LogHeader, m_scene.RegionInfo.RegionName); | 322 | m_log.DebugFormat("{0} Creating default parcel for region {1}", LogHeader, m_scene.RegionInfo.RegionName); |
279 | 323 | ||
280 | ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); | 324 | ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); |
325 | >>>>>>> avn/ubitvar | ||
281 | fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, | 326 | fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, |
282 | (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY)); | 327 | (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY)); |
283 | fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 328 | fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
@@ -411,10 +456,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
411 | 456 | ||
412 | public void SendLandUpdate(ScenePresence avatar, bool force) | 457 | public void SendLandUpdate(ScenePresence avatar, bool force) |
413 | { | 458 | { |
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 | ======= | ||
414 | if (avatar.IsChildAgent) | 463 | if (avatar.IsChildAgent) |
415 | return; | 464 | return; |
416 | 465 | ||
417 | ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 466 | ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); |
467 | >>>>>>> avn/ubitvar | ||
418 | 468 | ||
419 | if (over != null) | 469 | if (over != null) |
420 | { | 470 | { |
@@ -487,16 +537,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
487 | /// </summary> | 537 | /// </summary> |
488 | /// <param name="avatar"></param> | 538 | /// <param name="avatar"></param> |
489 | public void EventManagerOnClientMovement(ScenePresence avatar) | 539 | public void EventManagerOnClientMovement(ScenePresence avatar) |
490 | // | ||
491 | { | 540 | { |
492 | ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | 541 | Vector3 pos = avatar.AbsolutePosition; |
542 | ILandObject over = GetLandObject(pos.X, pos.Y); | ||
493 | if (over != null) | 543 | if (over != null) |
494 | { | 544 | { |
495 | if (!over.IsRestrictedFromLand(avatar.UUID) && (!over.IsBannedFromLand(avatar.UUID) || avatar.AbsolutePosition.Z >= LandChannel.BAN_LINE_SAFETY_HIEGHT)) | 545 | if (!over.IsRestrictedFromLand(avatar.UUID) && (!over.IsBannedFromLand(avatar.UUID) || pos.Z >= LandChannel.BAN_LINE_SAFETY_HIEGHT)) |
496 | { | 546 | avatar.lastKnownAllowedPosition = pos; |
497 | avatar.lastKnownAllowedPosition = | ||
498 | new Vector3(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y, avatar.AbsolutePosition.Z); | ||
499 | } | ||
500 | } | 547 | } |
501 | } | 548 | } |
502 | 549 | ||
@@ -555,7 +602,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
555 | /// <summary> | 602 | /// <summary> |
556 | /// Adds a land object to the stored list and adds them to the landIDList to what they own | 603 | /// Adds a land object to the stored list and adds them to the landIDList to what they own |
557 | /// </summary> | 604 | /// </summary> |
558 | /// <param name="new_land">The land object being added</param> | 605 | /// <param name="new_land"> |
606 | /// The land object being added. | ||
607 | /// Will return null if this overlaps with an existing parcel that has not had its bitmap adjusted. | ||
608 | /// </param> | ||
559 | public ILandObject AddLandObject(ILandObject land) | 609 | public ILandObject AddLandObject(ILandObject land) |
560 | { | 610 | { |
561 | ILandObject new_land = land.Copy(); | 611 | ILandObject new_land = land.Copy(); |
@@ -567,21 +617,32 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
567 | 617 | ||
568 | lock (m_landList) | 618 | lock (m_landList) |
569 | { | 619 | { |
570 | int newLandLocalID = ++m_lastLandLocalID; | 620 | int newLandLocalID = m_lastLandLocalID + 1; |
571 | new_land.LandData.LocalID = newLandLocalID; | 621 | new_land.LandData.LocalID = newLandLocalID; |
572 | 622 | ||
573 | bool[,] landBitmap = new_land.GetLandBitmap(); | 623 | 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 | ||
574 | if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1)) | 630 | if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1)) |
575 | { | 631 | { |
576 | // Going to variable sized regions can cause mismatches | 632 | // Going to variable sized regions can cause mismatches |
577 | m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})", | 633 | 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 | ======= | ||
578 | LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1)); | 637 | LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1)); |
638 | >>>>>>> avn/ubitvar | ||
579 | } | 639 | } |
580 | else | 640 | else |
581 | { | 641 | { |
582 | // If other land objects still believe that they occupy any parts of the same space, | 642 | // If other land objects still believe that they occupy any parts of the same space, |
583 | // then do not allow the add to proceed. | 643 | // then do not allow the add to proceed. |
584 | for (int x = 0; x < landBitmap.GetLength(0); x++) | 644 | for (int x = 0; x < landBitmap.GetLength(0); x++) |
645 | <<<<<<< HEAD | ||
585 | { | 646 | { |
586 | for (int y = 0; y < landBitmap.GetLength(1); y++) | 647 | for (int y = 0; y < landBitmap.GetLength(1); y++) |
587 | { | 648 | { |
@@ -597,6 +658,40 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
597 | { | 658 | { |
598 | m_log.ErrorFormat( | 659 | m_log.ErrorFormat( |
599 | "{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}", | 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}", |
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}", | ||
600 | LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y, | 695 | LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y, |
601 | lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name); | 696 | lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name); |
602 | 697 | ||
@@ -617,6 +712,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
617 | // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", | 712 | // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", |
618 | // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); | 713 | // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); |
619 | 714 | ||
715 | >>>>>>> avn/ubitvar | ||
620 | m_landIDList[x, y] = newLandLocalID; | 716 | m_landIDList[x, y] = newLandLocalID; |
621 | } | 717 | } |
622 | } | 718 | } |
@@ -624,10 +720,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
624 | } | 720 | } |
625 | 721 | ||
626 | m_landList.Add(newLandLocalID, new_land); | 722 | m_landList.Add(newLandLocalID, new_land); |
723 | m_lastLandLocalID++; | ||
627 | } | 724 | } |
628 | 725 | ||
629 | new_land.ForceUpdateLandInfo(); | 726 | new_land.ForceUpdateLandInfo(); |
630 | m_scene.EventManager.TriggerLandObjectAdded(new_land); | 727 | m_scene.EventManager.TriggerLandObjectAdded(new_land); |
728 | |||
631 | return new_land; | 729 | return new_land; |
632 | } | 730 | } |
633 | 731 | ||
@@ -731,6 +829,33 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
731 | /// <returns>Land object at the point supplied</returns> | 829 | /// <returns>Land object at the point supplied</returns> |
732 | public ILandObject GetLandObject(float x_float, float y_float) | 830 | public ILandObject GetLandObject(float x_float, float y_float) |
733 | { | 831 | { |
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 | ======= | ||
734 | return GetLandObject((int)x_float, (int)y_float, true); | 859 | return GetLandObject((int)x_float, (int)y_float, true); |
735 | } | 860 | } |
736 | 861 | ||
@@ -750,9 +875,34 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
750 | avy = 0; | 875 | avy = 0; |
751 | else if (avy >= m_scene.RegionInfo.RegionSizeY) | 876 | else if (avy >= m_scene.RegionInfo.RegionSizeY) |
752 | avy = (int)Constants.RegionSize - 1; | 877 | avy = (int)Constants.RegionSize - 1; |
878 | >>>>>>> avn/ubitvar | ||
753 | 879 | ||
754 | lock (m_landIDList) | 880 | lock (m_landIDList) |
755 | { | 881 | { |
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 | ======= | ||
756 | try | 906 | try |
757 | { | 907 | { |
758 | return m_landList[m_landIDList[avx / landUnit, avy / landUnit]]; | 908 | return m_landList[m_landIDList[avx / landUnit, avy / landUnit]]; |
@@ -761,23 +911,50 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
761 | { | 911 | { |
762 | return null; | 912 | return null; |
763 | } | 913 | } |
914 | >>>>>>> avn/ubitvar | ||
764 | } | 915 | } |
916 | */ | ||
765 | } | 917 | } |
766 | 918 | ||
919 | // Public entry. | ||
920 | // Throws exception if land object is not found | ||
767 | public ILandObject GetLandObject(int x, int y) | 921 | public ILandObject GetLandObject(int x, int y) |
768 | { | 922 | { |
769 | return GetLandObject(x, y, false /* returnNullIfLandObjectNotFound */); | 923 | return GetLandObject(x, y, false /* returnNullIfLandObjectNotFound */); |
770 | } | 924 | } |
771 | 925 | ||
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 | ======= | ||
772 | public ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds) | 942 | public ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds) |
773 | { | 943 | { |
774 | if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0) | 944 | if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0) |
945 | >>>>>>> avn/ubitvar | ||
775 | { | 946 | { |
776 | // These exceptions here will cause a lot of complaints from the users specifically because | 947 | // These exceptions here will cause a lot of complaints from the users specifically because |
777 | // they happen every time at border crossings | 948 | // they happen every time at border crossings |
778 | if (returnNullIfLandObjectOutsideBounds) | 949 | if (returnNullIfLandObjectOutsideBounds) |
779 | return null; | 950 | return null; |
780 | else | 951 | 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 | ======= | ||
781 | throw new Exception("Error: Parcel not found at point " + x + ", " + y); | 958 | throw new Exception("Error: Parcel not found at point " + x + ", " + y); |
782 | } | 959 | } |
783 | 960 | ||
@@ -791,7 +968,23 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
791 | { | 968 | { |
792 | return null; | 969 | return null; |
793 | } | 970 | } |
971 | >>>>>>> avn/ubitvar | ||
794 | } | 972 | } |
973 | |||
974 | return m_landList[m_landIDList[x / 4, y / 4]]; | ||
975 | } | ||
976 | |||
977 | // Create a 'parcel is here' bitmap for the parcel identified by the passed landID | ||
978 | private bool[,] CreateBitmapForID(int landID) | ||
979 | { | ||
980 | bool[,] ret = new bool[m_landIDList.GetLength(0), m_landIDList.GetLength(1)]; | ||
981 | |||
982 | for (int xx = 0; xx < m_landIDList.GetLength(0); xx++) | ||
983 | for (int yy = 0; yy < m_landIDList.GetLength(0); yy++) | ||
984 | if (m_landIDList[xx, yy] == landID) | ||
985 | ret[xx, yy] = true; | ||
986 | |||
987 | return ret; | ||
795 | } | 988 | } |
796 | 989 | ||
797 | // Create a 'parcel is here' bitmap for the parcel identified by the passed landID | 990 | // Create a 'parcel is here' bitmap for the parcel identified by the passed landID |
@@ -976,10 +1169,19 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
976 | 1169 | ||
977 | //Now add the new land object | 1170 | //Now add the new land object |
978 | ILandObject result = AddLandObject(newLand); | 1171 | ILandObject result = AddLandObject(newLand); |
1172 | <<<<<<< HEAD | ||
1173 | |||
1174 | if (result != null) | ||
1175 | { | ||
1176 | UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); | ||
1177 | result.SendLandUpdateToAvatarsOverMe(); | ||
1178 | } | ||
1179 | ======= | ||
979 | UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); | 1180 | UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); |
980 | result.SendLandUpdateToAvatarsOverMe(); | 1181 | result.SendLandUpdateToAvatarsOverMe(); |
981 | startLandObject.SendLandUpdateToAvatarsOverMe(); | 1182 | startLandObject.SendLandUpdateToAvatarsOverMe(); |
982 | m_scene.ForEachClient(SendParcelOverlay); | 1183 | m_scene.ForEachClient(SendParcelOverlay); |
1184 | >>>>>>> avn/ubitvar | ||
983 | } | 1185 | } |
984 | 1186 | ||
985 | /// <summary> | 1187 | /// <summary> |
@@ -1061,12 +1263,29 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1061 | 1263 | ||
1062 | #region Parcel Updating | 1264 | #region Parcel Updating |
1063 | 1265 | ||
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 | ||
1064 | 1274 | ||
1065 | /// <summary> | 1275 | /// <summary> |
1066 | /// Where we send the ParcelOverlay packet to the client | 1276 | /// Send the parcel overlay blocks to the client. We send the overlay packets |
1277 | /// around a location and limited by the 'parcelLayerViewDistance'. This number | ||
1278 | /// is usually 128 and the code is arranged so it sends all the parcel overlay | ||
1279 | /// information for a whole region if the region is legacy sized (256x256). If | ||
1280 | /// the region is larger, only the parcel layer information is sent around | ||
1281 | /// the point specified. This reduces the problem of parcel layer information | ||
1282 | /// blocks increasing exponentially as region size increases. | ||
1067 | /// </summary> | 1283 | /// </summary> |
1068 | /// <param name="remote_client">The object representing the client</param> | 1284 | /// <param name="remote_client">The object representing the client</param> |
1069 | public void SendParcelOverlay(IClientAPI remote_client) | 1285 | /// <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> | ||
1287 | /// <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) | ||
1070 | { | 1289 | { |
1071 | if (remote_client.SceneAgent.PresenceType == PresenceType.Npc) | 1290 | if (remote_client.SceneAgent.PresenceType == PresenceType.Npc) |
1072 | return; | 1291 | return; |
@@ -1076,18 +1295,149 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1076 | byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; | 1295 | byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; |
1077 | int byteArrayCount = 0; | 1296 | int byteArrayCount = 0; |
1078 | int sequenceID = 0; | 1297 | 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 | ======= | ||
1079 | 1313 | ||
1080 | // Layer data is in landUnit (4m) chunks | 1314 | // Layer data is in landUnit (4m) chunks |
1081 | for (int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += landUnit) | 1315 | for (int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += landUnit) |
1082 | { | 1316 | { |
1083 | for (int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += landUnit) | 1317 | for (int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += landUnit) |
1318 | >>>>>>> avn/ubitvar | ||
1084 | { | 1319 | { |
1085 | byte tempByte = 0; //This represents the byte for the current 4x4 | 1320 | txLow = xLow; |
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; | ||
1086 | 1330 | ||
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 | ======= | ||
1087 | ILandObject currentParcelBlock = GetLandObject(x, y); | 1350 | ILandObject currentParcelBlock = GetLandObject(x, y); |
1351 | >>>>>>> avn/ubitvar | ||
1088 | 1352 | ||
1089 | if (currentParcelBlock != null) | 1353 | // Layer data is in landUnit (4m) chunks |
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) | ||
1090 | { | 1361 | { |
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 | ======= | ||
1091 | // types | 1441 | // types |
1092 | if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId) | 1442 | if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId) |
1093 | { | 1443 | { |
@@ -1175,7 +1525,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1175 | if (byteArrayCount > 0) | 1525 | if (byteArrayCount > 0) |
1176 | { | 1526 | { |
1177 | remote_client.SendLandParcelOverlay(byteArray, sequenceID); | 1527 | remote_client.SendLandParcelOverlay(byteArray, sequenceID); |
1528 | >>>>>>> avn/ubitvar | ||
1178 | } | 1529 | } |
1530 | |||
1531 | return tempByte; | ||
1179 | } | 1532 | } |
1180 | 1533 | ||
1181 | public void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, | 1534 | public void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, |
@@ -1216,6 +1569,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1216 | temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client); | 1569 | temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client); |
1217 | } | 1570 | } |
1218 | 1571 | ||
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 | ======= | ||
1219 | // SendParcelOverlay(remote_client); | 1576 | // SendParcelOverlay(remote_client); |
1220 | } | 1577 | } |
1221 | 1578 | ||
@@ -1255,6 +1612,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1255 | avatar.currentParcelUUID = parcelID; // force parcel flags review | 1612 | avatar.currentParcelUUID = parcelID; // force parcel flags review |
1256 | }); | 1613 | }); |
1257 | } | 1614 | } |
1615 | >>>>>>> avn/ubitvar | ||
1258 | } | 1616 | } |
1259 | 1617 | ||
1260 | public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client) | 1618 | public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client) |
@@ -1325,6 +1683,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1325 | land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); | 1683 | land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); |
1326 | m_scene.ForEachClient(SendParcelOverlay); | 1684 | m_scene.ForEachClient(SendParcelOverlay); |
1327 | land.SendLandUpdateToClient(true, remote_client); | 1685 | land.SendLandUpdateToClient(true, remote_client); |
1686 | UpdateLandObject(land.LandData.LocalID, land.LandData); | ||
1328 | } | 1687 | } |
1329 | } | 1688 | } |
1330 | } | 1689 | } |
@@ -1345,8 +1704,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1345 | land.LandData.GroupID = UUID.Zero; | 1704 | land.LandData.GroupID = UUID.Zero; |
1346 | land.LandData.IsGroupOwned = false; | 1705 | land.LandData.IsGroupOwned = false; |
1347 | land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); | 1706 | land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); |
1707 | |||
1348 | m_scene.ForEachClient(SendParcelOverlay); | 1708 | m_scene.ForEachClient(SendParcelOverlay); |
1349 | land.SendLandUpdateToClient(true, remote_client); | 1709 | land.SendLandUpdateToClient(true, remote_client); |
1710 | UpdateLandObject(land.LandData.LocalID, land.LandData); | ||
1350 | } | 1711 | } |
1351 | } | 1712 | } |
1352 | } | 1713 | } |
@@ -1372,6 +1733,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1372 | land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); | 1733 | land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); |
1373 | m_scene.ForEachClient(SendParcelOverlay); | 1734 | m_scene.ForEachClient(SendParcelOverlay); |
1374 | land.SendLandUpdateToClient(true, remote_client); | 1735 | land.SendLandUpdateToClient(true, remote_client); |
1736 | UpdateLandObject(land.LandData.LocalID, land.LandData); | ||
1375 | } | 1737 | } |
1376 | } | 1738 | } |
1377 | } | 1739 | } |
@@ -1452,24 +1814,42 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1452 | 1814 | ||
1453 | #region Land Object From Storage Functions | 1815 | #region Land Object From Storage Functions |
1454 | 1816 | ||
1455 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) | 1817 | private void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) |
1456 | { | 1818 | { |
1457 | lock (m_landList) | 1819 | lock (m_landList) |
1458 | { | 1820 | { |
1459 | for (int i = 0; i < data.Count; i++) | 1821 | for (int i = 0; i < data.Count; i++) |
1460 | IncomingLandObjectFromStorage(data[i]); | 1822 | IncomingLandObjectFromStorage(data[i]); |
1461 | 1823 | ||
1824 | <<<<<<< HEAD | ||
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++) | ||
1834 | { | ||
1835 | for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++) | ||
1836 | ======= | ||
1462 | // Layer data is in landUnit (4m) chunks | 1837 | // Layer data is in landUnit (4m) chunks |
1463 | for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); y++) | 1838 | for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); y++) |
1464 | { | 1839 | { |
1465 | for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); x++) | 1840 | for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); x++) |
1841 | >>>>>>> avn/ubitvar | ||
1466 | { | 1842 | { |
1467 | if (m_landIDList[x, y] == 0) | 1843 | if (m_landIDList[x, y] == 0) |
1468 | { | 1844 | { |
1469 | if (m_landList.Count == 1) | 1845 | if (m_landList.Count == 1) |
1470 | { | 1846 | { |
1471 | m_log.DebugFormat( | 1847 | 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 | ======= | ||
1472 | "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}", | 1851 | "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}", |
1852 | >>>>>>> avn/ubitvar | ||
1473 | LogHeader, x, y, m_scene.Name); | 1853 | LogHeader, x, y, m_scene.Name); |
1474 | 1854 | ||
1475 | int onlyParcelID = 0; | 1855 | int onlyParcelID = 0; |
@@ -1492,11 +1872,19 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1492 | else if (m_landList.Count > 1) | 1872 | else if (m_landList.Count > 1) |
1493 | { | 1873 | { |
1494 | m_log.DebugFormat( | 1874 | 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 | ======= | ||
1495 | "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}", | 1882 | "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}", |
1496 | LogHeader, x, y, m_scene.Name); | 1883 | LogHeader, x, y, m_scene.Name); |
1497 | 1884 | ||
1498 | // There are several other parcels so we must create a new one for the unassigned space | 1885 | // There are several other parcels so we must create a new one for the unassigned space |
1499 | ILandObject newLand = new LandObject(UUID.Zero, false, m_scene); | 1886 | ILandObject newLand = new LandObject(UUID.Zero, false, m_scene); |
1887 | >>>>>>> avn/ubitvar | ||
1500 | // Claim all the unclaimed "0" ids | 1888 | // Claim all the unclaimed "0" ids |
1501 | newLand.SetLandBitmap(CreateBitmapForID(0)); | 1889 | newLand.SetLandBitmap(CreateBitmapForID(0)); |
1502 | newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 1890 | newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
@@ -1507,7 +1895,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1507 | { | 1895 | { |
1508 | // We should never reach this point as the separate code path when no land data exists should have fired instead. | 1896 | // We should never reach this point as the separate code path when no land data exists should have fired instead. |
1509 | m_log.WarnFormat( | 1897 | m_log.WarnFormat( |
1898 | <<<<<<< HEAD | ||
1899 | "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present", | ||
1900 | ======= | ||
1510 | "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present", | 1901 | "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present", |
1902 | >>>>>>> avn/ubitvar | ||
1511 | LogHeader, m_scene.Name); | 1903 | LogHeader, m_scene.Name); |
1512 | } | 1904 | } |
1513 | } | 1905 | } |
@@ -1516,11 +1908,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1516 | } | 1908 | } |
1517 | } | 1909 | } |
1518 | 1910 | ||
1519 | public void IncomingLandObjectFromStorage(LandData data) | 1911 | private void IncomingLandObjectFromStorage(LandData data) |
1520 | { | 1912 | { |
1913 | <<<<<<< HEAD | ||
1914 | ILandObject new_land = new LandObject(data, m_scene); | ||
1915 | ======= | ||
1521 | 1916 | ||
1522 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); | 1917 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); |
1523 | new_land.LandData = data.Copy(); | 1918 | new_land.LandData = data.Copy(); |
1919 | >>>>>>> avn/ubitvar | ||
1524 | new_land.SetLandBitmapFromByteArray(); | 1920 | new_land.SetLandBitmapFromByteArray(); |
1525 | AddLandObject(new_land); | 1921 | AddLandObject(new_land); |
1526 | // new_land.SendLandUpdateToAvatarsOverMe(); | 1922 | // new_land.SendLandUpdateToAvatarsOverMe(); |
@@ -2057,21 +2453,38 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2057 | telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); | 2453 | telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); |
2058 | 2454 | ||
2059 | // Can the user set home here? | 2455 | // Can the user set home here? |
2060 | if (// (a) gods and land managers can set home | 2456 | if (// Required: local user; foreign users cannot set home |
2061 | m_scene.Permissions.IsAdministrator(remoteClient.AgentId) || | 2457 | m_scene.UserManagementModule.IsLocalGridUser(remoteClient.AgentId) && |
2062 | m_scene.Permissions.IsGod(remoteClient.AgentId) || | 2458 | (// (a) gods and land managers can set home |
2063 | // (b) land owners can set home | 2459 | m_scene.Permissions.IsAdministrator(remoteClient.AgentId) || |
2064 | remoteClient.AgentId == land.LandData.OwnerID || | 2460 | m_scene.Permissions.IsGod(remoteClient.AgentId) || |
2065 | // (c) members of the land-associated group in roles that can set home | 2461 | // (b) land owners can set home |
2066 | ((gpowers & (ulong)GroupPowers.AllowSetHome) == (ulong)GroupPowers.AllowSetHome) || | 2462 | remoteClient.AgentId == land.LandData.OwnerID || |
2067 | // (d) parcels with telehubs can be the home of anyone | 2463 | // (c) members of the land-associated group in roles that can set home |
2068 | (telehub != null && land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y))) | 2464 | ((gpowers & (ulong)GroupPowers.AllowSetHome) == (ulong)GroupPowers.AllowSetHome) || |
2069 | { | 2465 | // (d) parcels with telehubs can be the home of anyone |
2070 | if (m_scene.GridUserService.SetHome(remoteClient.AgentId.ToString(), land.RegionUUID, position, lookAt)) | 2466 | (telehub != null && land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y)))) |
2467 | { | ||
2468 | string userId; | ||
2469 | UUID test; | ||
2470 | if (!m_scene.UserManagementModule.GetUserUUI(remoteClient.AgentId, out userId)) | ||
2471 | { | ||
2472 | /* Do not set a home position in this grid for a HG visitor */ | ||
2473 | m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed. (User Lookup)"); | ||
2474 | } | ||
2475 | else if (!UUID.TryParse(userId, out test)) | ||
2476 | { | ||
2477 | m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed. (HG visitor)"); | ||
2478 | } | ||
2479 | else if (m_scene.GridUserService.SetHome(userId, land.RegionUUID, position, lookAt)) | ||
2480 | { | ||
2071 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. | 2481 | // FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot. |
2072 | m_Dialog.SendAlertToUser(remoteClient, "Home position set."); | 2482 | m_Dialog.SendAlertToUser(remoteClient, "Home position set."); |
2483 | } | ||
2073 | else | 2484 | else |
2485 | { | ||
2074 | m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed."); | 2486 | m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed."); |
2487 | } | ||
2075 | } | 2488 | } |
2076 | else | 2489 | else |
2077 | m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel."); | 2490 | m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel."); |
@@ -2155,6 +2568,17 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2155 | 2568 | ||
2156 | private void AppendParcelsSummaryReport(StringBuilder report) | 2569 | private void AppendParcelsSummaryReport(StringBuilder report) |
2157 | { | 2570 | { |
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 | ======= | ||
2158 | report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); | 2582 | report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); |
2159 | report.AppendFormat( | 2583 | report.AppendFormat( |
2160 | "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", | 2584 | "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", |
@@ -2164,12 +2588,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2164 | "AABBMin", | 2588 | "AABBMin", |
2165 | "AABBMax", | 2589 | "AABBMax", |
2166 | "Owner"); | 2590 | "Owner"); |
2591 | >>>>>>> avn/ubitvar | ||
2167 | 2592 | ||
2168 | lock (m_landList) | 2593 | lock (m_landList) |
2169 | { | 2594 | { |
2170 | foreach (ILandObject lo in m_landList.Values) | 2595 | foreach (ILandObject lo in m_landList.Values) |
2171 | { | 2596 | { |
2172 | LandData ld = lo.LandData; | 2597 | 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 | ======= | ||
2173 | 2612 | ||
2174 | report.AppendFormat( | 2613 | report.AppendFormat( |
2175 | "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", | 2614 | "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", |
@@ -2197,8 +2636,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2197 | else | 2636 | else |
2198 | { | 2637 | { |
2199 | ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); | 2638 | ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); |
2639 | >>>>>>> avn/ubitvar | ||
2200 | } | 2640 | } |
2201 | } | 2641 | } |
2642 | |||
2643 | report.Append(cdt.ToString()); | ||
2202 | } | 2644 | } |
2203 | 2645 | ||
2204 | private void AppendParcelReport(StringBuilder report, ILandObject lo) | 2646 | private void AppendParcelReport(StringBuilder report, ILandObject lo) |
@@ -2213,8 +2655,17 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2213 | cdl.AddRow("Area", ld.Area); | 2655 | cdl.AddRow("Area", ld.Area); |
2214 | cdl.AddRow("AABB Min", ld.AABBMin); | 2656 | cdl.AddRow("AABB Min", ld.AABBMin); |
2215 | cdl.AddRow("AABB Max", ld.AABBMax); | 2657 | cdl.AddRow("AABB Max", ld.AABBMax); |
2216 | 2658 | string ownerName; | |
2217 | cdl.AddRow("Owner", m_userManager.GetUserName(ld.OwnerID)); | 2659 | if (ld.IsGroupOwned) |
2660 | { | ||
2661 | GroupRecord rec = m_groupManager.GetGroupRecord(ld.GroupID); | ||
2662 | ownerName = (rec != null) ? rec.GroupName : "Unknown Group"; | ||
2663 | } | ||
2664 | else | ||
2665 | { | ||
2666 | ownerName = m_userManager.GetUserName(ld.OwnerID); | ||
2667 | } | ||
2668 | cdl.AddRow("Owner", ownerName); | ||
2218 | cdl.AddRow("Is group owned?", ld.IsGroupOwned); | 2669 | cdl.AddRow("Is group owned?", ld.IsGroupOwned); |
2219 | cdl.AddRow("GroupID", ld.GroupID); | 2670 | cdl.AddRow("GroupID", ld.GroupID); |
2220 | 2671 | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 5858d6c..3b81d6b 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -46,12 +46,20 @@ 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 | ======= | ||
49 | 56 | ||
50 | private readonly int landUnit = 4; | 57 | private readonly int landUnit = 4; |
51 | 58 | ||
52 | private int m_lastSeqId = 0; | 59 | private int m_lastSeqId = 0; |
53 | private int m_expiryCounter = 0; | 60 | private int m_expiryCounter = 0; |
54 | 61 | ||
62 | >>>>>>> avn/ubitvar | ||
55 | protected Scene m_scene; | 63 | protected Scene m_scene; |
56 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); | 64 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); |
57 | protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); | 65 | protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); |
@@ -59,22 +67,29 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
59 | protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>(); | 67 | protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>(); |
60 | protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds | 68 | protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds |
61 | 69 | ||
70 | <<<<<<< HEAD | ||
71 | public bool[,] LandBitmap { get; set; } | ||
72 | ======= | ||
62 | private bool[,] m_landBitmap; | 73 | private bool[,] m_landBitmap; |
63 | public bool[,] LandBitmap | 74 | public bool[,] LandBitmap |
64 | { | 75 | { |
65 | get { return m_landBitmap; } | 76 | get { return m_landBitmap; } |
66 | set { m_landBitmap = value; } | 77 | set { m_landBitmap = value; } |
67 | } | 78 | } |
79 | >>>>>>> avn/ubitvar | ||
68 | 80 | ||
69 | #endregion | 81 | #endregion |
70 | 82 | ||
71 | public int GetPrimsFree() | 83 | public int GetPrimsFree() |
72 | { | 84 | { |
73 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | 85 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); |
74 | int free = GetSimulatorMaxPrimCount() - m_landData.SimwidePrims; | 86 | int free = GetSimulatorMaxPrimCount() - LandData.SimwidePrims; |
75 | return free; | 87 | return free; |
76 | } | 88 | } |
77 | 89 | ||
90 | <<<<<<< HEAD | ||
91 | public LandData LandData { get; set; } | ||
92 | ======= | ||
78 | protected LandData m_landData; | 93 | protected LandData m_landData; |
79 | public LandData LandData | 94 | public LandData LandData |
80 | { | 95 | { |
@@ -82,6 +97,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
82 | 97 | ||
83 | set { m_landData = value; } | 98 | set { m_landData = value; } |
84 | } | 99 | } |
100 | >>>>>>> avn/ubitvar | ||
85 | 101 | ||
86 | public IPrimCounts PrimCounts { get; set; } | 102 | public IPrimCounts PrimCounts { get; set; } |
87 | 103 | ||
@@ -103,6 +119,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
103 | } | 119 | } |
104 | } | 120 | } |
105 | 121 | ||
122 | m_log.ErrorFormat("{0} StartPoint. No start point found. bitmapSize=<{1},{2}>", | ||
123 | LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1)); | ||
106 | return new Vector3(-1, -1, -1); | 124 | return new Vector3(-1, -1, -1); |
107 | } | 125 | } |
108 | } | 126 | } |
@@ -122,6 +140,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
122 | } | 140 | } |
123 | } | 141 | } |
124 | 142 | ||
143 | m_log.ErrorFormat("{0} EndPoint. No end point found. bitmapSize=<{1},{2}>", | ||
144 | LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1)); | ||
125 | return new Vector3(-1, -1, -1); | 145 | return new Vector3(-1, -1, -1); |
126 | } | 146 | } |
127 | } | 147 | } |
@@ -179,12 +199,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
179 | 199 | ||
180 | public ILandObject Copy() | 200 | public ILandObject Copy() |
181 | { | 201 | { |
182 | ILandObject newLand = new LandObject(LandData.OwnerID, LandData.IsGroupOwned, m_scene); | 202 | ILandObject newLand = new LandObject(LandData, m_scene); |
183 | |||
184 | //Place all new variables here! | ||
185 | newLand.LandBitmap = (bool[,]) (LandBitmap.Clone()); | 203 | newLand.LandBitmap = (bool[,]) (LandBitmap.Clone()); |
186 | newLand.LandData = LandData.Copy(); | ||
187 | |||
188 | return newLand; | 204 | return newLand; |
189 | } | 205 | } |
190 | 206 | ||
@@ -209,6 +225,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
209 | else | 225 | else |
210 | { | 226 | { |
211 | // Normal Calculations | 227 | // 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 | ======= | ||
212 | int parcelMax = (int)( (long)LandData.Area | 234 | int parcelMax = (int)( (long)LandData.Area |
213 | * (long)m_scene.RegionInfo.ObjectCapacity | 235 | * (long)m_scene.RegionInfo.ObjectCapacity |
214 | * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus | 236 | * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus |
@@ -230,6 +252,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
230 | int parcelMax = (int)((long)LandData.Area | 252 | int parcelMax = (int)((long)LandData.Area |
231 | * (long)m_scene.RegionInfo.ObjectCapacity | 253 | * (long)m_scene.RegionInfo.ObjectCapacity |
232 | / 65536L); | 254 | / 65536L); |
255 | >>>>>>> avn/ubitvar | ||
233 | return parcelMax; | 256 | return parcelMax; |
234 | } | 257 | } |
235 | } | 258 | } |
@@ -243,10 +266,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
243 | else | 266 | else |
244 | { | 267 | { |
245 | //Normal Calculations | 268 | //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 | ======= | ||
246 | int simMax = (int)( (long)LandData.SimwideArea | 273 | int simMax = (int)( (long)LandData.SimwideArea |
247 | * (long)m_scene.RegionInfo.ObjectCapacity | 274 | * (long)m_scene.RegionInfo.ObjectCapacity |
248 | / (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) ); | 275 | / (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) ); |
249 | // m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}", LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax); | 276 | // m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}", LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax); |
277 | >>>>>>> avn/ubitvar | ||
250 | return simMax; | 278 | return simMax; |
251 | } | 279 | } |
252 | } | 280 | } |
@@ -261,7 +289,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
261 | return; | 289 | return; |
262 | 290 | ||
263 | IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); | 291 | IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); |
264 | uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome)); | 292 | // uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome)); |
293 | uint regionFlags = (uint)(RegionFlags.PublicAllowed | ||
294 | | RegionFlags.AllowDirectTeleport | ||
295 | | RegionFlags.AllowParcelChanges | ||
296 | | RegionFlags.AllowVoice ); | ||
297 | |||
265 | if (estateModule != null) | 298 | if (estateModule != null) |
266 | regionFlags = estateModule.GetRegionFlags(); | 299 | regionFlags = estateModule.GetRegionFlags(); |
267 | 300 | ||
@@ -406,6 +439,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
406 | { | 439 | { |
407 | uint preserve = LandData.Flags & ~allowedDelta; | 440 | uint preserve = LandData.Flags & ~allowedDelta; |
408 | newData.Flags = preserve | (args.ParcelFlags & allowedDelta); | 441 | newData.Flags = preserve | (args.ParcelFlags & allowedDelta); |
442 | <<<<<<< HEAD | ||
443 | |||
444 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); | ||
445 | SendLandUpdateToAvatarsOverMe(snap_selection); | ||
446 | } | ||
447 | ======= | ||
409 | 448 | ||
410 | uint curdelta = LandData.Flags ^ newData.Flags; | 449 | uint curdelta = LandData.Flags ^ newData.Flags; |
411 | curdelta &= (uint)(ParcelFlags.SoundLocal); | 450 | curdelta &= (uint)(ParcelFlags.SoundLocal); |
@@ -417,6 +456,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
417 | return true; | 456 | return true; |
418 | } | 457 | } |
419 | return false; | 458 | return false; |
459 | >>>>>>> avn/ubitvar | ||
420 | } | 460 | } |
421 | 461 | ||
422 | public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) | 462 | public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) |
@@ -431,9 +471,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
431 | newData.SalePrice = 0; | 471 | newData.SalePrice = 0; |
432 | newData.AuthBuyerID = UUID.Zero; | 472 | newData.AuthBuyerID = UUID.Zero; |
433 | newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); | 473 | newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); |
474 | |||
475 | bool sellObjects = (LandData.Flags & (uint)(ParcelFlags.SellParcelObjects)) != 0 | ||
476 | && !LandData.IsGroupOwned && !groupOwned; | ||
477 | UUID previousOwner = LandData.OwnerID; | ||
478 | |||
434 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); | 479 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); |
435 | // m_scene.EventManager.TriggerParcelPrimCountUpdate(); | 480 | // m_scene.EventManager.TriggerParcelPrimCountUpdate(); |
436 | SendLandUpdateToAvatarsOverMe(true); | 481 | SendLandUpdateToAvatarsOverMe(true); |
482 | |||
483 | if (sellObjects) SellLandObjects(previousOwner); | ||
437 | } | 484 | } |
438 | 485 | ||
439 | public void DeedToGroup(UUID groupID) | 486 | public void DeedToGroup(UUID groupID) |
@@ -759,10 +806,17 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
759 | /// </summary> | 806 | /// </summary> |
760 | private void UpdateAABBAndAreaValues() | 807 | private void UpdateAABBAndAreaValues() |
761 | { | 808 | { |
809 | <<<<<<< HEAD | ||
810 | int min_x = 10000; | ||
811 | int min_y = 10000; | ||
812 | int max_x = 0; | ||
813 | int max_y = 0; | ||
814 | ======= | ||
762 | int min_x = Int32.MaxValue; | 815 | int min_x = Int32.MaxValue; |
763 | int min_y = Int32.MaxValue; | 816 | int min_y = Int32.MaxValue; |
764 | int max_x = Int32.MinValue; | 817 | int max_x = Int32.MinValue; |
765 | int max_y = Int32.MinValue; | 818 | int max_y = Int32.MinValue; |
819 | >>>>>>> avn/ubitvar | ||
766 | int tempArea = 0; | 820 | int tempArea = 0; |
767 | int x, y; | 821 | int x, y; |
768 | for (x = 0; x < LandBitmap.GetLength(0); x++) | 822 | for (x = 0; x < LandBitmap.GetLength(0); x++) |
@@ -771,6 +825,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
771 | { | 825 | { |
772 | if (LandBitmap[x, y] == true) | 826 | if (LandBitmap[x, y] == true) |
773 | { | 827 | { |
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 | ======= | ||
774 | if (min_x > x) | 834 | if (min_x > x) |
775 | min_x = x; | 835 | min_x = x; |
776 | if (min_y > y) | 836 | if (min_y > y) |
@@ -779,6 +839,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
779 | max_x = x; | 839 | max_x = x; |
780 | if (max_y < y) | 840 | if (max_y < y) |
781 | max_y = y; | 841 | max_y = y; |
842 | >>>>>>> avn/ubitvar | ||
782 | tempArea += landUnit * landUnit; //16sqm peice of land | 843 | tempArea += landUnit * landUnit; //16sqm peice of land |
783 | } | 844 | } |
784 | } | 845 | } |
@@ -786,6 +847,26 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
786 | int tx = min_x * landUnit; | 847 | int tx = min_x * landUnit; |
787 | if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1)) | 848 | if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1)) |
788 | tx = ((int)m_scene.RegionInfo.RegionSizeX - 1); | 849 | 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 | ======= | ||
789 | 870 | ||
790 | int htx; | 871 | int htx; |
791 | if (tx >= ((int)m_scene.RegionInfo.RegionSizeX)) | 872 | if (tx >= ((int)m_scene.RegionInfo.RegionSizeX)) |
@@ -823,6 +904,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
823 | LandData.AABBMax | 904 | LandData.AABBMax |
824 | = new Vector3( | 905 | = new Vector3( |
825 | (float)(tx), (float)(ty), m_scene != null ? (float)m_scene.Heightmap[htx, hty] : 0); | 906 | (float)(tx), (float)(ty), m_scene != null ? (float)m_scene.Heightmap[htx, hty] : 0); |
907 | >>>>>>> avn/ubitvar | ||
826 | 908 | ||
827 | LandData.Area = tempArea; | 909 | LandData.Area = tempArea; |
828 | } | 910 | } |
@@ -838,6 +920,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
838 | public void SetLandBitmap(bool[,] bitmap) | 920 | public void SetLandBitmap(bool[,] bitmap) |
839 | { | 921 | { |
840 | LandBitmap = bitmap; | 922 | LandBitmap = bitmap; |
923 | <<<<<<< HEAD | ||
924 | // m_log.DebugFormat("{0} SetLandBitmap. BitmapSize=<{1},{2}>", LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1)); | ||
925 | ======= | ||
926 | >>>>>>> avn/ubitvar | ||
841 | ForceUpdateLandInfo(); | 927 | ForceUpdateLandInfo(); |
842 | } | 928 | } |
843 | 929 | ||
@@ -863,6 +949,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
863 | 949 | ||
864 | // Fill the bitmap square area specified by state and end | 950 | // Fill the bitmap square area specified by state and end |
865 | tempBitmap = ModifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); | 951 | tempBitmap = ModifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); |
952 | // m_log.DebugFormat("{0} GetSquareLandBitmap. tempBitmapSize=<{1},{2}>", | ||
953 | // LogHeader, tempBitmap.GetLength(0), tempBitmap.GetLength(1)); | ||
866 | return tempBitmap; | 954 | return tempBitmap; |
867 | } | 955 | } |
868 | 956 | ||
@@ -891,6 +979,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
891 | } | 979 | } |
892 | } | 980 | } |
893 | } | 981 | } |
982 | // m_log.DebugFormat("{0} ModifyLandBitmapSquare. startXY=<{1},{2}>, endXY=<{3},{4}>, val={5}, landBitmapSize=<{6},{7}>", | ||
983 | // LogHeader, start_x, start_y, end_x, end_y, set_value, land_bitmap.GetLength(0), land_bitmap.GetLength(1)); | ||
894 | return land_bitmap; | 984 | return land_bitmap; |
895 | } | 985 | } |
896 | 986 | ||
@@ -934,10 +1024,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
934 | private byte[] ConvertLandBitmapToBytes() | 1024 | private byte[] ConvertLandBitmapToBytes() |
935 | { | 1025 | { |
936 | byte[] tempConvertArr = new byte[LandBitmap.GetLength(0) * LandBitmap.GetLength(1) / 8]; | 1026 | byte[] tempConvertArr = new byte[LandBitmap.GetLength(0) * LandBitmap.GetLength(1) / 8]; |
1027 | <<<<<<< HEAD | ||
1028 | byte tempByte = 0; | ||
1029 | int byteNum = 0; | ||
1030 | int i = 0; | ||
1031 | ======= | ||
937 | int tempByte = 0; | 1032 | int tempByte = 0; |
938 | int i, byteNum = 0; | 1033 | int i, byteNum = 0; |
939 | int mask = 1; | 1034 | int mask = 1; |
940 | i = 0; | 1035 | i = 0; |
1036 | >>>>>>> avn/ubitvar | ||
941 | for (int y = 0; y < LandBitmap.GetLength(1); y++) | 1037 | for (int y = 0; y < LandBitmap.GetLength(1); y++) |
942 | { | 1038 | { |
943 | for (int x = 0; x < LandBitmap.GetLength(0); x++) | 1039 | for (int x = 0; x < LandBitmap.GetLength(0); x++) |
@@ -967,7 +1063,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
967 | i = 0; | 1063 | i = 0; |
968 | byteNum++; | 1064 | byteNum++; |
969 | } | 1065 | } |
1066 | <<<<<<< HEAD | ||
1067 | } | ||
1068 | } | ||
1069 | // m_log.DebugFormat("{0} ConvertLandBitmapToBytes. BitmapSize=<{1},{2}>", | ||
1070 | // LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1)); | ||
1071 | ======= | ||
970 | */ | 1072 | */ |
1073 | >>>>>>> avn/ubitvar | ||
971 | return tempConvertArr; | 1074 | return tempConvertArr; |
972 | } | 1075 | } |
973 | 1076 | ||
@@ -1148,6 +1251,43 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1148 | 1251 | ||
1149 | #endregion | 1252 | #endregion |
1150 | 1253 | ||
1254 | #region Object Sales | ||
1255 | |||
1256 | public void SellLandObjects(UUID previousOwner) | ||
1257 | { | ||
1258 | // m_log.DebugFormat( | ||
1259 | // "[LAND OBJECT]: Request to sell objects in {0} from {1}", LandData.Name, previousOwner); | ||
1260 | |||
1261 | if (LandData.IsGroupOwned) | ||
1262 | return; | ||
1263 | |||
1264 | IBuySellModule m_BuySellModule = m_scene.RequestModuleInterface<IBuySellModule>(); | ||
1265 | if (m_BuySellModule == null) | ||
1266 | { | ||
1267 | m_log.Error("[LAND OBJECT]: BuySellModule not found"); | ||
1268 | return; | ||
1269 | } | ||
1270 | |||
1271 | ScenePresence sp; | ||
1272 | if (!m_scene.TryGetScenePresence(LandData.OwnerID, out sp)) | ||
1273 | { | ||
1274 | m_log.Error("[LAND OBJECT]: New owner is not present in scene"); | ||
1275 | return; | ||
1276 | } | ||
1277 | |||
1278 | lock (primsOverMe) | ||
1279 | { | ||
1280 | foreach (SceneObjectGroup obj in primsOverMe) | ||
1281 | { | ||
1282 | if (obj.OwnerID == previousOwner && obj.GroupID == UUID.Zero && | ||
1283 | (obj.GetEffectivePermissions() & (uint)(OpenSim.Framework.PermissionMask.Transfer)) != 0) | ||
1284 | m_BuySellModule.BuyObject(sp.ControllingClient, UUID.Zero, obj.LocalId, 1, 0); | ||
1285 | } | ||
1286 | } | ||
1287 | } | ||
1288 | |||
1289 | #endregion | ||
1290 | |||
1151 | #region Object Returning | 1291 | #region Object Returning |
1152 | 1292 | ||
1153 | public void ReturnObject(SceneObjectGroup obj) | 1293 | public void ReturnObject(SceneObjectGroup obj) |
@@ -1170,7 +1310,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1170 | { | 1310 | { |
1171 | foreach (SceneObjectGroup obj in primsOverMe) | 1311 | foreach (SceneObjectGroup obj in primsOverMe) |
1172 | { | 1312 | { |
1173 | if (obj.OwnerID == m_landData.OwnerID) | 1313 | if (obj.OwnerID == LandData.OwnerID) |
1174 | { | 1314 | { |
1175 | if (!returns.ContainsKey(obj.OwnerID)) | 1315 | if (!returns.ContainsKey(obj.OwnerID)) |
1176 | returns[obj.OwnerID] = | 1316 | returns[obj.OwnerID] = |
@@ -1179,11 +1319,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1179 | } | 1319 | } |
1180 | } | 1320 | } |
1181 | } | 1321 | } |
1182 | else if (type == (uint)ObjectReturnType.Group && m_landData.GroupID != UUID.Zero) | 1322 | else if (type == (uint)ObjectReturnType.Group && LandData.GroupID != UUID.Zero) |
1183 | { | 1323 | { |
1184 | foreach (SceneObjectGroup obj in primsOverMe) | 1324 | foreach (SceneObjectGroup obj in primsOverMe) |
1185 | { | 1325 | { |
1186 | if (obj.GroupID == m_landData.GroupID) | 1326 | if (obj.GroupID == LandData.GroupID) |
1187 | { | 1327 | { |
1188 | if (!returns.ContainsKey(obj.OwnerID)) | 1328 | if (!returns.ContainsKey(obj.OwnerID)) |
1189 | returns[obj.OwnerID] = | 1329 | returns[obj.OwnerID] = |
@@ -1196,9 +1336,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1196 | { | 1336 | { |
1197 | foreach (SceneObjectGroup obj in primsOverMe) | 1337 | foreach (SceneObjectGroup obj in primsOverMe) |
1198 | { | 1338 | { |
1199 | if (obj.OwnerID != m_landData.OwnerID && | 1339 | if (obj.OwnerID != LandData.OwnerID && |
1200 | (obj.GroupID != m_landData.GroupID || | 1340 | (obj.GroupID != LandData.GroupID || |
1201 | m_landData.GroupID == UUID.Zero)) | 1341 | LandData.GroupID == UUID.Zero)) |
1202 | { | 1342 | { |
1203 | if (!returns.ContainsKey(obj.OwnerID)) | 1343 | if (!returns.ContainsKey(obj.OwnerID)) |
1204 | returns[obj.OwnerID] = | 1344 | returns[obj.OwnerID] = |
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs new file mode 100644 index 0000000..4ed67f3 --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Land/Tests/LandManagementModuleTests.cs | |||
@@ -0,0 +1,266 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using NUnit.Framework; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | using OpenSim.Tests.Common; | ||
34 | |||
35 | namespace OpenSim.Region.CoreModules.World.Land.Tests | ||
36 | { | ||
37 | public class LandManagementModuleTests : OpenSimTestCase | ||
38 | { | ||
39 | [Test] | ||
40 | public void TestAddLandObject() | ||
41 | { | ||
42 | TestHelpers.InMethod(); | ||
43 | // TestHelpers.EnableLogging(); | ||
44 | |||
45 | UUID userId = TestHelpers.ParseTail(0x1); | ||
46 | |||
47 | LandManagementModule lmm = new LandManagementModule(); | ||
48 | Scene scene = new SceneHelpers().SetupScene(); | ||
49 | SceneHelpers.SetupSceneModules(scene, lmm); | ||
50 | |||
51 | ILandObject lo = new LandObject(userId, false, scene); | ||
52 | lo.LandData.Name = "lo1"; | ||
53 | lo.SetLandBitmap( | ||
54 | lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); | ||
55 | lo = lmm.AddLandObject(lo); | ||
56 | |||
57 | // TODO: Should add asserts to check that land object was added properly. | ||
58 | |||
59 | // At the moment, this test just makes sure that we can't add a land object that overlaps the areas that | ||
60 | // the first still holds. | ||
61 | ILandObject lo2 = new LandObject(userId, false, scene); | ||
62 | lo2.SetLandBitmap( | ||
63 | lo2.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); | ||
64 | lo2.LandData.Name = "lo2"; | ||
65 | lo2 = lmm.AddLandObject(lo2); | ||
66 | |||
67 | { | ||
68 | ILandObject loAtCoord = lmm.GetLandObject(0, 0); | ||
69 | Assert.That(loAtCoord.LandData.LocalID, Is.EqualTo(lo.LandData.LocalID)); | ||
70 | Assert.That(loAtCoord.LandData.GlobalID, Is.EqualTo(lo.LandData.GlobalID)); | ||
71 | } | ||
72 | |||
73 | { | ||
74 | ILandObject loAtCoord = lmm.GetLandObject((int)Constants.RegionSize - 1, ((int)Constants.RegionSize - 1)); | ||
75 | Assert.That(loAtCoord.LandData.LocalID, Is.EqualTo(lo.LandData.LocalID)); | ||
76 | Assert.That(loAtCoord.LandData.GlobalID, Is.EqualTo(lo.LandData.GlobalID)); | ||
77 | } | ||
78 | } | ||
79 | |||
80 | /// <summary> | ||
81 | /// Test parcels on region when no land data exists to be loaded. | ||
82 | /// </summary> | ||
83 | [Test] | ||
84 | public void TestLoadWithNoParcels() | ||
85 | { | ||
86 | TestHelpers.InMethod(); | ||
87 | // TestHelpers.EnableLogging(); | ||
88 | |||
89 | SceneHelpers sh = new SceneHelpers(); | ||
90 | LandManagementModule lmm = new LandManagementModule(); | ||
91 | Scene scene = sh.SetupScene(); | ||
92 | SceneHelpers.SetupSceneModules(scene, lmm); | ||
93 | |||
94 | scene.loadAllLandObjectsFromStorage(scene.RegionInfo.RegionID); | ||
95 | |||
96 | ILandObject loAtCoord1 = lmm.GetLandObject(0, 0); | ||
97 | Assert.That(loAtCoord1.LandData.LocalID, Is.Not.EqualTo(0)); | ||
98 | Assert.That(loAtCoord1.LandData.GlobalID, Is.Not.EqualTo(UUID.Zero)); | ||
99 | |||
100 | ILandObject loAtCoord2 = lmm.GetLandObject((int)Constants.RegionSize - 1, ((int)Constants.RegionSize - 1)); | ||
101 | Assert.That(loAtCoord2.LandData.LocalID, Is.EqualTo(loAtCoord1.LandData.LocalID)); | ||
102 | Assert.That(loAtCoord2.LandData.GlobalID, Is.EqualTo(loAtCoord1.LandData.GlobalID)); | ||
103 | } | ||
104 | |||
105 | /// <summary> | ||
106 | /// Test parcels on region when a single parcel already exists but it does not cover the whole region. | ||
107 | /// </summary> | ||
108 | [Test] | ||
109 | public void TestLoadWithSinglePartialCoveringParcel() | ||
110 | { | ||
111 | TestHelpers.InMethod(); | ||
112 | // TestHelpers.EnableLogging(); | ||
113 | |||
114 | UUID userId = TestHelpers.ParseTail(0x1); | ||
115 | |||
116 | SceneHelpers sh = new SceneHelpers(); | ||
117 | LandManagementModule lmm = new LandManagementModule(); | ||
118 | Scene scene = sh.SetupScene(); | ||
119 | SceneHelpers.SetupSceneModules(scene, lmm); | ||
120 | |||
121 | ILandObject originalLo1 = new LandObject(userId, false, scene); | ||
122 | originalLo1.LandData.Name = "lo1"; | ||
123 | originalLo1.SetLandBitmap( | ||
124 | originalLo1.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize / 2)); | ||
125 | |||
126 | sh.SimDataService.StoreLandObject(originalLo1); | ||
127 | |||
128 | scene.loadAllLandObjectsFromStorage(scene.RegionInfo.RegionID); | ||
129 | |||
130 | ILandObject loAtCoord1 = lmm.GetLandObject(0, 0); | ||
131 | Assert.That(loAtCoord1.LandData.Name, Is.EqualTo(originalLo1.LandData.Name)); | ||
132 | Assert.That(loAtCoord1.LandData.GlobalID, Is.EqualTo(originalLo1.LandData.GlobalID)); | ||
133 | |||
134 | ILandObject loAtCoord2 = lmm.GetLandObject((int)Constants.RegionSize - 1, ((int)Constants.RegionSize - 1)); | ||
135 | Assert.That(loAtCoord2.LandData.LocalID, Is.EqualTo(loAtCoord1.LandData.LocalID)); | ||
136 | Assert.That(loAtCoord2.LandData.GlobalID, Is.EqualTo(loAtCoord1.LandData.GlobalID)); | ||
137 | } | ||
138 | |||
139 | /// <summary> | ||
140 | /// Test parcels on region when a single parcel already exists but it does not cover the whole region. | ||
141 | /// </summary> | ||
142 | [Test] | ||
143 | public void TestLoadWithMultiplePartialCoveringParcels() | ||
144 | { | ||
145 | TestHelpers.InMethod(); | ||
146 | // TestHelpers.EnableLogging(); | ||
147 | |||
148 | UUID userId = TestHelpers.ParseTail(0x1); | ||
149 | |||
150 | SceneHelpers sh = new SceneHelpers(); | ||
151 | LandManagementModule lmm = new LandManagementModule(); | ||
152 | Scene scene = sh.SetupScene(); | ||
153 | SceneHelpers.SetupSceneModules(scene, lmm); | ||
154 | |||
155 | ILandObject originalLo1 = new LandObject(userId, false, scene); | ||
156 | originalLo1.LandData.Name = "lo1"; | ||
157 | originalLo1.SetLandBitmap( | ||
158 | originalLo1.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize / 2)); | ||
159 | |||
160 | sh.SimDataService.StoreLandObject(originalLo1); | ||
161 | |||
162 | ILandObject originalLo2 = new LandObject(userId, false, scene); | ||
163 | originalLo2.LandData.Name = "lo2"; | ||
164 | originalLo2.SetLandBitmap( | ||
165 | originalLo2.GetSquareLandBitmap( | ||
166 | 0, (int)Constants.RegionSize / 2, (int)Constants.RegionSize, ((int)Constants.RegionSize / 4) * 3)); | ||
167 | |||
168 | sh.SimDataService.StoreLandObject(originalLo2); | ||
169 | |||
170 | scene.loadAllLandObjectsFromStorage(scene.RegionInfo.RegionID); | ||
171 | |||
172 | ILandObject loAtCoord1 = lmm.GetLandObject(0, 0); | ||
173 | Assert.That(loAtCoord1.LandData.Name, Is.EqualTo(originalLo1.LandData.Name)); | ||
174 | Assert.That(loAtCoord1.LandData.GlobalID, Is.EqualTo(originalLo1.LandData.GlobalID)); | ||
175 | |||
176 | ILandObject loAtCoord2 | ||
177 | = lmm.GetLandObject((int)Constants.RegionSize - 1, (((int)Constants.RegionSize / 4) * 3) - 1); | ||
178 | Assert.That(loAtCoord2.LandData.Name, Is.EqualTo(originalLo2.LandData.Name)); | ||
179 | Assert.That(loAtCoord2.LandData.GlobalID, Is.EqualTo(originalLo2.LandData.GlobalID)); | ||
180 | |||
181 | ILandObject loAtCoord3 = lmm.GetLandObject((int)Constants.RegionSize - 1, ((int)Constants.RegionSize - 1)); | ||
182 | Assert.That(loAtCoord3.LandData.LocalID, Is.Not.EqualTo(loAtCoord1.LandData.LocalID)); | ||
183 | Assert.That(loAtCoord3.LandData.LocalID, Is.Not.EqualTo(loAtCoord2.LandData.LocalID)); | ||
184 | Assert.That(loAtCoord3.LandData.GlobalID, Is.Not.EqualTo(loAtCoord1.LandData.GlobalID)); | ||
185 | Assert.That(loAtCoord3.LandData.GlobalID, Is.Not.EqualTo(loAtCoord2.LandData.GlobalID)); | ||
186 | } | ||
187 | |||
188 | /// <summary> | ||
189 | /// Test parcels on region when whole region is parcelled (which should normally always be the case). | ||
190 | /// </summary> | ||
191 | [Test] | ||
192 | public void TestLoad() | ||
193 | { | ||
194 | TestHelpers.InMethod(); | ||
195 | // TestHelpers.EnableLogging(); | ||
196 | |||
197 | UUID userId = TestHelpers.ParseTail(0x1); | ||
198 | |||
199 | SceneHelpers sh = new SceneHelpers(); | ||
200 | LandManagementModule lmm = new LandManagementModule(); | ||
201 | Scene scene = sh.SetupScene(); | ||
202 | SceneHelpers.SetupSceneModules(scene, lmm); | ||
203 | |||
204 | ILandObject originalLo1 = new LandObject(userId, false, scene); | ||
205 | originalLo1.LandData.Name = "lo1"; | ||
206 | originalLo1.SetLandBitmap( | ||
207 | originalLo1.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize / 2)); | ||
208 | |||
209 | sh.SimDataService.StoreLandObject(originalLo1); | ||
210 | |||
211 | ILandObject originalLo2 = new LandObject(userId, false, scene); | ||
212 | originalLo2.LandData.Name = "lo2"; | ||
213 | originalLo2.SetLandBitmap( | ||
214 | originalLo2.GetSquareLandBitmap(0, (int)Constants.RegionSize / 2, (int)Constants.RegionSize, (int)Constants.RegionSize)); | ||
215 | |||
216 | sh.SimDataService.StoreLandObject(originalLo2); | ||
217 | |||
218 | scene.loadAllLandObjectsFromStorage(scene.RegionInfo.RegionID); | ||
219 | |||
220 | { | ||
221 | ILandObject loAtCoord = lmm.GetLandObject(0, 0); | ||
222 | Assert.That(loAtCoord.LandData.Name, Is.EqualTo(originalLo1.LandData.Name)); | ||
223 | Assert.That(loAtCoord.LandData.GlobalID, Is.EqualTo(originalLo1.LandData.GlobalID)); | ||
224 | } | ||
225 | |||
226 | { | ||
227 | ILandObject loAtCoord = lmm.GetLandObject((int)Constants.RegionSize - 1, ((int)Constants.RegionSize - 1)); | ||
228 | Assert.That(loAtCoord.LandData.Name, Is.EqualTo(originalLo2.LandData.Name)); | ||
229 | Assert.That(loAtCoord.LandData.GlobalID, Is.EqualTo(originalLo2.LandData.GlobalID)); | ||
230 | } | ||
231 | } | ||
232 | |||
233 | [Test] | ||
234 | public void TestSubdivide() | ||
235 | { | ||
236 | TestHelpers.InMethod(); | ||
237 | // TestHelpers.EnableLogging(); | ||
238 | |||
239 | UUID userId = TestHelpers.ParseTail(0x1); | ||
240 | |||
241 | LandManagementModule lmm = new LandManagementModule(); | ||
242 | Scene scene = new SceneHelpers().SetupScene(); | ||
243 | SceneHelpers.SetupSceneModules(scene, lmm); | ||
244 | |||
245 | ILandObject lo = new LandObject(userId, false, scene); | ||
246 | lo.LandData.Name = "lo1"; | ||
247 | lo.SetLandBitmap( | ||
248 | lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); | ||
249 | lo = lmm.AddLandObject(lo); | ||
250 | |||
251 | lmm.Subdivide(0, 0, LandManagementModule.LandUnit, LandManagementModule.LandUnit, userId); | ||
252 | |||
253 | { | ||
254 | ILandObject loAtCoord = lmm.GetLandObject(0, 0); | ||
255 | Assert.That(loAtCoord.LandData.LocalID, Is.Not.EqualTo(lo.LandData.LocalID)); | ||
256 | Assert.That(loAtCoord.LandData.GlobalID, Is.Not.EqualTo(lo.LandData.GlobalID)); | ||
257 | } | ||
258 | |||
259 | { | ||
260 | ILandObject loAtCoord = lmm.GetLandObject(LandManagementModule.LandUnit, LandManagementModule.LandUnit); | ||
261 | Assert.That(loAtCoord.LandData.LocalID, Is.EqualTo(lo.LandData.LocalID)); | ||
262 | Assert.That(loAtCoord.LandData.GlobalID, Is.EqualTo(lo.LandData.GlobalID)); | ||
263 | } | ||
264 | } | ||
265 | } | ||
266 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 0945b43..949acb6 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs | |||
@@ -36,7 +36,6 @@ using OpenSim.Framework; | |||
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Tests.Common; | 38 | using OpenSim.Tests.Common; |
39 | using OpenSim.Tests.Common.Mock; | ||
40 | 39 | ||
41 | namespace OpenSim.Region.CoreModules.World.Land.Tests | 40 | namespace OpenSim.Region.CoreModules.World.Land.Tests |
42 | { | 41 | { |