From e37e8c3bdfde9143a898959fc7c92091262a3905 Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Mon, 14 Dec 2015 12:29:00 +0000
Subject: on join parcels, keep the information of the larger parcel, since
thats how its expected now
---
.../CoreModules/World/Land/LandManagementModule.cs | 43 ++++++++++++----------
1 file changed, 24 insertions(+), 19 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 329fa81..08b9896 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -1031,52 +1031,57 @@ namespace OpenSim.Region.CoreModules.World.Land
///
/// Join 2 land objects together
///
- /// x value in first piece of land
- /// y value in first piece of land
- /// x value in second peice of land
- /// y value in second peice of land
+ /// start x of selection area
+ /// start y of selection area
+ /// end x of selection area
+ /// end y of selection area
/// UUID of the avatar trying to join the land objects
/// Returns true if successful
private void join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
{
- end_x -= 4;
- end_y -= 4;
+ int index = 0;
+ int maxindex = -1;
+ int maxArea = 0;
List selectedLandObjects = new List();
- int stepYSelected;
- for (stepYSelected = start_y; stepYSelected <= end_y; stepYSelected += 4)
+ for (int x = start_x; x < end_x; x += 4)
{
- int stepXSelected;
- for (stepXSelected = start_x; stepXSelected <= end_x; stepXSelected += 4)
+ for (int y = start_y; y < end_y; y += 4)
{
- ILandObject p = GetLandObject(stepXSelected, stepYSelected);
+ ILandObject p = GetLandObject(x, y);
if (p != null)
{
if (!selectedLandObjects.Contains(p))
{
selectedLandObjects.Add(p);
+ if(p.LandData.Area > maxArea)
+ {
+ maxArea = p.LandData.Area;
+ maxindex = index;
+ }
+ index++;
}
}
}
}
- ILandObject masterLandObject = selectedLandObjects[0];
- selectedLandObjects.RemoveAt(0);
- if (selectedLandObjects.Count < 1)
- {
+ if(maxindex < 0 || selectedLandObjects.Count < 2)
return;
- }
+
+ ILandObject masterLandObject = selectedLandObjects[maxindex];
+ selectedLandObjects.RemoveAt(maxindex);
+
if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin, true))
{
return;
}
+
+ UUID masterOwner = masterLandObject.LandData.OwnerID;
foreach (ILandObject p in selectedLandObjects)
{
- if (p.LandData.OwnerID != masterLandObject.LandData.OwnerID)
- {
+ if (p.LandData.OwnerID != masterOwner)
return;
- }
}
lock (m_landList)
--
cgit v1.1