aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs420
1 files changed, 17 insertions, 403 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 8bd46f6..749c2cc 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -69,11 +69,8 @@ namespace OpenSim.Region.CoreModules.World.Land
69 /// <summary> 69 /// <summary>
70 /// Minimum land unit size in region co-ordinates. 70 /// Minimum land unit size in region co-ordinates.
71 /// </summary> 71 /// </summary>
72<<<<<<< HEAD 72
73 public const int LandUnit = 4; 73 public const int LandUnit = 4;
74=======
75 public const int landUnit = 4;
76>>>>>>> avn/ubitvar
77 74
78 private static readonly string remoteParcelRequestPath = "0009/"; 75 private static readonly string remoteParcelRequestPath = "0009/";
79 76
@@ -106,17 +103,12 @@ namespace OpenSim.Region.CoreModules.World.Land
106 103
107 // caches ExtendedLandData 104 // caches ExtendedLandData
108 private Cache parcelInfoCache; 105 private Cache parcelInfoCache;
109<<<<<<< HEAD
110
111 106
112 /// <summary> 107 /// <summary>
113 /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. 108 /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions.
114 /// </summary> 109 /// </summary>
115 private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>(); 110 private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>();
116======= 111
117 private Dictionary<UUID, Vector3> forcedPosition =
118 new Dictionary<UUID, Vector3>();
119>>>>>>> avn/ubitvar
120 112
121 // Enables limiting parcel layer info transmission when doing simple updates 113 // Enables limiting parcel layer info transmission when doing simple updates
122 private bool shouldLimitParcelLayerInfoToViewDistance { get; set; } 114 private bool shouldLimitParcelLayerInfoToViewDistance { get; set; }
@@ -132,7 +124,6 @@ namespace OpenSim.Region.CoreModules.World.Land
132 124
133 public void Initialise(IConfigSource source) 125 public void Initialise(IConfigSource source)
134 { 126 {
135<<<<<<< HEAD
136 shouldLimitParcelLayerInfoToViewDistance = true; 127 shouldLimitParcelLayerInfoToViewDistance = true;
137 parcelLayerViewDistance = 128; 128 parcelLayerViewDistance = 128;
138 IConfig landManagementConfig = source.Configs["LandManagement"]; 129 IConfig landManagementConfig = source.Configs["LandManagement"];
@@ -140,24 +131,16 @@ namespace OpenSim.Region.CoreModules.World.Land
140 { 131 {
141 shouldLimitParcelLayerInfoToViewDistance = landManagementConfig.GetBoolean("LimitParcelLayerUpdateDistance", shouldLimitParcelLayerInfoToViewDistance); 132 shouldLimitParcelLayerInfoToViewDistance = landManagementConfig.GetBoolean("LimitParcelLayerUpdateDistance", shouldLimitParcelLayerInfoToViewDistance);
142 parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance); 133 parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance);
143======= 134 DefaultGodParcelGroup = new UUID(landManagementConfig.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString()));
144 IConfig cnf = source.Configs["LandManagement"]; 135 DefaultGodParcelName = landManagementConfig.GetString("DefaultAdministratorParcelName", "Default Parcel");
145 if (cnf != null)
146 {
147 DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString()));
148 DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel");
149>>>>>>> avn/ubitvar
150 } 136 }
151 } 137 }
152 138
153 public void AddRegion(Scene scene) 139 public void AddRegion(Scene scene)
154 { 140 {
155 m_scene = scene; 141 m_scene = scene;
156<<<<<<< HEAD
157 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; 142 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit];
158======= 143
159 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
160>>>>>>> avn/ubitvar
161 landChannel = new LandChannel(scene, this); 144 landChannel = new LandChannel(scene, this);
162 145
163 parcelInfoCache = new Cache(); 146 parcelInfoCache = new Cache();
@@ -299,11 +282,8 @@ namespace OpenSim.Region.CoreModules.World.Land
299 { 282 {
300 m_landList.Clear(); 283 m_landList.Clear();
301 m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; 284 m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
302<<<<<<< HEAD 285
303 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; 286 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit];
304=======
305 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
306>>>>>>> avn/ubitvar
307 } 287 }
308 } 288 }
309 289
@@ -313,16 +293,10 @@ namespace OpenSim.Region.CoreModules.World.Land
313 /// <returns>The parcel created.</returns> 293 /// <returns>The parcel created.</returns>
314 protected ILandObject CreateDefaultParcel() 294 protected ILandObject CreateDefaultParcel()
315 { 295 {
316<<<<<<< HEAD
317 m_log.DebugFormat(
318 "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName);
319
320 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
321=======
322 m_log.DebugFormat("{0} Creating default parcel for region {1}", LogHeader, m_scene.RegionInfo.RegionName); 296 m_log.DebugFormat("{0} Creating default parcel for region {1}", LogHeader, m_scene.RegionInfo.RegionName);
323 297
324 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); 298 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
325>>>>>>> avn/ubitvar 299
326 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, 300 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0,
327 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY)); 301 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY));
328 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 302 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
@@ -456,15 +430,10 @@ namespace OpenSim.Region.CoreModules.World.Land
456 430
457 public void SendLandUpdate(ScenePresence avatar, bool force) 431 public void SendLandUpdate(ScenePresence avatar, bool force)
458 { 432 {
459<<<<<<< HEAD
460 ILandObject over = GetLandObject((int)Math.Min(((int)m_scene.RegionInfo.RegionSizeX - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))),
461 (int)Math.Min(((int)m_scene.RegionInfo.RegionSizeY - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y))));
462=======
463 if (avatar.IsChildAgent) 433 if (avatar.IsChildAgent)
464 return; 434 return;
465 435
466 ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 436 ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
467>>>>>>> avn/ubitvar
468 437
469 if (over != null) 438 if (over != null)
470 { 439 {
@@ -621,28 +590,17 @@ namespace OpenSim.Region.CoreModules.World.Land
621 new_land.LandData.LocalID = newLandLocalID; 590 new_land.LandData.LocalID = newLandLocalID;
622 591
623 bool[,] landBitmap = new_land.GetLandBitmap(); 592 bool[,] landBitmap = new_land.GetLandBitmap();
624<<<<<<< HEAD
625 // m_log.DebugFormat("{0} AddLandObject. new_land.bitmapSize=({1},{2}). newLocalID={3}",
626 // LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), newLandLocalID);
627
628=======
629>>>>>>> avn/ubitvar
630 if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1)) 593 if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1))
631 { 594 {
632 // Going to variable sized regions can cause mismatches 595 // Going to variable sized regions can cause mismatches
633 m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})", 596 m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})",
634<<<<<<< HEAD
635 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1) );
636=======
637 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1)); 597 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1));
638>>>>>>> avn/ubitvar
639 } 598 }
640 else 599 else
641 { 600 {
642 // If other land objects still believe that they occupy any parts of the same space, 601 // If other land objects still believe that they occupy any parts of the same space,
643 // then do not allow the add to proceed. 602 // then do not allow the add to proceed.
644 for (int x = 0; x < landBitmap.GetLength(0); x++) 603 for (int x = 0; x < landBitmap.GetLength(0); x++)
645<<<<<<< HEAD
646 { 604 {
647 for (int y = 0; y < landBitmap.GetLength(1); y++) 605 for (int y = 0; y < landBitmap.GetLength(1); y++)
648 { 606 {
@@ -658,40 +616,6 @@ namespace OpenSim.Region.CoreModules.World.Land
658 { 616 {
659 m_log.ErrorFormat( 617 m_log.ErrorFormat(
660 "{0}: Cannot add parcel \"{1}\", local ID {2} at tile {3},{4} because this is still occupied by parcel \"{5}\", local ID {6} in {7}", 618 "{0}: Cannot add parcel \"{1}\", local ID {2} at tile {3},{4} because this is still occupied by parcel \"{5}\", local ID {6} in {7}",
661 LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y,
662 lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name);
663
664 return null;
665 }
666 }
667 }
668 }
669 }
670
671 for (int x = 0; x < landBitmap.GetLength(0); x++)
672=======
673>>>>>>> avn/ubitvar
674 {
675 for (int y = 0; y < landBitmap.GetLength(1); y++)
676 {
677 if (landBitmap[x, y])
678 {
679<<<<<<< HEAD
680 // m_log.DebugFormat(
681 // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}",
682 // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName);
683
684=======
685 int lastRecordedLandId = m_landIDList[x, y];
686
687 if (lastRecordedLandId > 0)
688 {
689 ILandObject lastRecordedLo = m_landList[lastRecordedLandId];
690
691 if (lastRecordedLo.LandBitmap[x, y])
692 {
693 m_log.ErrorFormat(
694 "{0}: Cannot add parcel \"{1}\", local ID {2} at tile {3},{4} because this is still occupied by parcel \"{5}\", local ID {6} in {7}",
695 LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y, 619 LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y,
696 lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name); 620 lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name);
697 621
@@ -712,7 +636,6 @@ namespace OpenSim.Region.CoreModules.World.Land
712 // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", 636 // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}",
713 // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); 637 // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName);
714 638
715>>>>>>> avn/ubitvar
716 m_landIDList[x, y] = newLandLocalID; 639 m_landIDList[x, y] = newLandLocalID;
717 } 640 }
718 } 641 }
@@ -829,33 +752,6 @@ namespace OpenSim.Region.CoreModules.World.Land
829 /// <returns>Land object at the point supplied</returns> 752 /// <returns>Land object at the point supplied</returns>
830 public ILandObject GetLandObject(float x_float, float y_float) 753 public ILandObject GetLandObject(float x_float, float y_float)
831 { 754 {
832<<<<<<< HEAD
833 return GetLandObject((int)x_float, (int)y_float, true /* returnNullIfLandObjectNotFound */);
834 /*
835 int x;
836 int y;
837
838 if (x_float >= m_scene.RegionInfo.RegionSizeX || x_float < 0 || y_float >= m_scene.RegionInfo.RegionSizeX || y_float < 0)
839 return null;
840
841 try
842 {
843 x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / (float)landUnit));
844 y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / (float)landUnit));
845 }
846 catch (OverflowException)
847 {
848 return null;
849 }
850
851 if (x >= (m_scene.RegionInfo.RegionSizeX / landUnit)
852 || y >= (m_scene.RegionInfo.RegionSizeY / landUnit)
853 || x < 0
854 || y < 0)
855 {
856 return null;
857 }
858=======
859 return GetLandObject((int)x_float, (int)y_float, true); 755 return GetLandObject((int)x_float, (int)y_float, true);
860 } 756 }
861 757
@@ -875,45 +771,18 @@ namespace OpenSim.Region.CoreModules.World.Land
875 avy = 0; 771 avy = 0;
876 else if (avy >= m_scene.RegionInfo.RegionSizeY) 772 else if (avy >= m_scene.RegionInfo.RegionSizeY)
877 avy = (int)Constants.RegionSize - 1; 773 avy = (int)Constants.RegionSize - 1;
878>>>>>>> avn/ubitvar
879 774
880 lock (m_landIDList) 775 lock (m_landIDList)
881 { 776 {
882<<<<<<< HEAD
883 // Corner case. If an autoreturn happens during sim startup
884 // we will come here with the list uninitialized
885 //
886// int landId = m_landIDList[x, y];
887
888// if (landId == 0)
889// m_log.DebugFormat(
890// "[LAND MANAGEMENT MODULE]: No land object found at ({0}, {1}) on {2}",
891// x, y, m_scene.RegionInfo.RegionName);
892
893 try
894 {
895 if (m_landList.ContainsKey(m_landIDList[x, y]))
896 return m_landList[m_landIDList[x, y]];
897 }
898 catch (Exception e)
899 {
900 m_log.DebugFormat("{0} GetLandObject exception. x={1}, y={2}, m_landIDList.len=({3},{4})",
901 LogHeader, x, y, m_landIDList.GetLength(0), m_landIDList.GetLength(1));
902 }
903
904 return null;
905=======
906 try 777 try
907 { 778 {
908 return m_landList[m_landIDList[avx / landUnit, avy / landUnit]]; 779 return m_landList[m_landIDList[avx / LandUnit, avy / LandUnit]];
909 } 780 }
910 catch (IndexOutOfRangeException) 781 catch (IndexOutOfRangeException)
911 { 782 {
912 return null; 783 return null;
913 } 784 }
914>>>>>>> avn/ubitvar
915 } 785 }
916 */
917 } 786 }
918 787
919 // Public entry. 788 // Public entry.
@@ -923,38 +792,15 @@ namespace OpenSim.Region.CoreModules.World.Land
923 return GetLandObject(x, y, false /* returnNullIfLandObjectNotFound */); 792 return GetLandObject(x, y, false /* returnNullIfLandObjectNotFound */);
924 } 793 }
925 794
926<<<<<<< HEAD
927 /// <summary>
928 /// Given a region position, return the parcel land object for that location
929 /// </summary>
930 /// <returns>
931 /// The land object.
932 /// </returns>
933 /// <param name='x'></param>
934 /// <param name='y'></param>
935 /// <param name='returnNullIfLandObjectNotFound'>
936 /// Return null if the land object requested is not within the region's bounds.
937 /// </param>
938 private ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds)
939 {
940 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0)
941=======
942 public ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds) 795 public ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds)
943 { 796 {
944 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0) 797 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0)
945>>>>>>> avn/ubitvar
946 { 798 {
947 // These exceptions here will cause a lot of complaints from the users specifically because 799 // These exceptions here will cause a lot of complaints from the users specifically because
948 // they happen every time at border crossings 800 // they happen every time at border crossings
949 if (returnNullIfLandObjectOutsideBounds) 801 if (returnNullIfLandObjectOutsideBounds)
950 return null; 802 return null;
951 else 803 else
952<<<<<<< HEAD
953 throw new Exception(
954 String.Format("{0} GetLandObject for non-existent position. Region={1}, pos=<{2},{3}",
955 LogHeader, m_scene.RegionInfo.RegionName, x, y)
956 );
957=======
958 throw new Exception("Error: Parcel not found at point " + x + ", " + y); 804 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
959 } 805 }
960 806
@@ -968,7 +814,6 @@ namespace OpenSim.Region.CoreModules.World.Land
968 { 814 {
969 return null; 815 return null;
970 } 816 }
971>>>>>>> avn/ubitvar
972 } 817 }
973 818
974 return m_landList[m_landIDList[x / 4, y / 4]]; 819 return m_landList[m_landIDList[x / 4, y / 4]];
@@ -987,19 +832,6 @@ namespace OpenSim.Region.CoreModules.World.Land
987 return ret; 832 return ret;
988 } 833 }
989 834
990 // Create a 'parcel is here' bitmap for the parcel identified by the passed landID
991 private bool[,] CreateBitmapForID(int landID)
992 {
993 bool[,] ret = new bool[m_landIDList.GetLength(0), m_landIDList.GetLength(1)];
994
995 for (int xx = 0; xx < m_landIDList.GetLength(0); xx++)
996 for (int yy = 0; yy < m_landIDList.GetLength(0); yy++)
997 if (m_landIDList[xx, yy] == landID)
998 ret[xx, yy] = true;
999
1000 return ret;
1001 }
1002
1003 #endregion 835 #endregion
1004 836
1005 #region Parcel Modification 837 #region Parcel Modification
@@ -1169,19 +1001,12 @@ namespace OpenSim.Region.CoreModules.World.Land
1169 1001
1170 //Now add the new land object 1002 //Now add the new land object
1171 ILandObject result = AddLandObject(newLand); 1003 ILandObject result = AddLandObject(newLand);
1172<<<<<<< HEAD
1173 1004
1174 if (result != null)
1175 {
1176 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData);
1177 result.SendLandUpdateToAvatarsOverMe();
1178 }
1179=======
1180 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); 1005 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData);
1181 result.SendLandUpdateToAvatarsOverMe(); 1006 result.SendLandUpdateToAvatarsOverMe();
1182 startLandObject.SendLandUpdateToAvatarsOverMe(); 1007 startLandObject.SendLandUpdateToAvatarsOverMe();
1183 m_scene.ForEachClient(SendParcelOverlay); 1008 m_scene.ForEachClient(SendParcelOverlay);
1184>>>>>>> avn/ubitvar 1009
1185 } 1010 }
1186 1011
1187 /// <summary> 1012 /// <summary>
@@ -1263,15 +1088,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1263 1088
1264 #region Parcel Updating 1089 #region Parcel Updating
1265 1090
1266<<<<<<< HEAD
1267 // Send parcel layer info for the whole region
1268 public void SendParcelOverlay(IClientAPI remote_client)
1269 {
1270 SendParcelOverlay(remote_client, 0, 0, (int)Constants.MaximumRegionSize);
1271 }
1272=======
1273>>>>>>> avn/ubitvar
1274
1275 /// <summary> 1091 /// <summary>
1276 /// Send the parcel overlay blocks to the client. We send the overlay packets 1092 /// Send the parcel overlay blocks to the client. We send the overlay packets
1277 /// around a location and limited by the 'parcelLayerViewDistance'. This number 1093 /// around a location and limited by the 'parcelLayerViewDistance'. This number
@@ -1285,7 +1101,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1285 /// <param name="xPlace">X position in the region to send surrounding parcel layer info</param> 1101 /// <param name="xPlace">X position in the region to send surrounding parcel layer info</param>
1286 /// <param name="yPlace">y position in the region to send surrounding parcel layer info</param> 1102 /// <param name="yPlace">y position in the region to send surrounding parcel layer info</param>
1287 /// <param name="layerViewDistance">Distance from x,y position to send parcel layer info</param> 1103 /// <param name="layerViewDistance">Distance from x,y position to send parcel layer info</param>
1288 private void SendParcelOverlay(IClientAPI remote_client, int xPlace, int yPlace, int layerViewDistance) 1104 public void SendParcelOverlay(IClientAPI remote_client)
1289 { 1105 {
1290 if (remote_client.SceneAgent.PresenceType == PresenceType.Npc) 1106 if (remote_client.SceneAgent.PresenceType == PresenceType.Npc)
1291 return; 1107 return;
@@ -1295,149 +1111,18 @@ namespace OpenSim.Region.CoreModules.World.Land
1295 byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; 1111 byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET];
1296 int byteArrayCount = 0; 1112 int byteArrayCount = 0;
1297 int sequenceID = 0; 1113 int sequenceID = 0;
1298<<<<<<< HEAD
1299
1300 int xLow = 0;
1301 int xHigh = (int)m_scene.RegionInfo.RegionSizeX;
1302 int yLow = 0;
1303 int yHigh = (int)m_scene.RegionInfo.RegionSizeY;
1304
1305 if (shouldLimitParcelLayerInfoToViewDistance)
1306 {
1307 // Compute view distance around the given point
1308 int txLow = xPlace - layerViewDistance;
1309 int txHigh = xPlace + layerViewDistance;
1310 // If the distance is outside the region area, move the view distance to ba all in the region
1311 if (txLow < xLow)
1312=======
1313 1114
1314 // Layer data is in landUnit (4m) chunks 1115 // Layer data is in LandUnit (4m) chunks
1315 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += landUnit) 1116 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += LandUnit)
1316 { 1117 {
1317 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += landUnit) 1118 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += LandUnit)
1318>>>>>>> avn/ubitvar
1319 { 1119 {
1320 txLow = xLow; 1120 byte tempByte = 0; //This represents the byte for the current 4x4
1321 txHigh = Math.Min(yLow + (layerViewDistance * 2), xHigh);
1322 }
1323 if (txHigh > xHigh)
1324 {
1325 txLow = Math.Max(xLow, xHigh - (layerViewDistance * 2));
1326 txHigh = xHigh;
1327 }
1328 xLow = txLow;
1329 xHigh = txHigh;
1330 1121
1331<<<<<<< HEAD
1332 int tyLow = yPlace - layerViewDistance;
1333 int tyHigh = yPlace + layerViewDistance;
1334 if (tyLow < yLow)
1335 {
1336 tyLow = yLow;
1337 tyHigh = Math.Min(yLow + (layerViewDistance * 2), yHigh);
1338 }
1339 if (tyHigh > yHigh)
1340 {
1341 tyLow = Math.Max(yLow, yHigh - (layerViewDistance * 2));
1342 tyHigh = yHigh;
1343 }
1344 yLow = tyLow;
1345 yHigh = tyHigh;
1346 }
1347 // m_log.DebugFormat("{0} SendParcelOverlay: place=<{1},{2}>, vDist={3}, xLH=<{4},{5}, yLH=<{6},{7}>",
1348 // LogHeader, xPlace, yPlace, layerViewDistance, xLow, xHigh, yLow, yHigh);
1349=======
1350 ILandObject currentParcelBlock = GetLandObject(x, y); 1122 ILandObject currentParcelBlock = GetLandObject(x, y);
1351>>>>>>> avn/ubitvar
1352 1123
1353 // Layer data is in landUnit (4m) chunks 1124 if (currentParcelBlock != null)
1354 for (int y = yLow; y < yHigh / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++)
1355 {
1356 for (int x = xLow; x < xHigh / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++)
1357 {
1358 byteArray[byteArrayCount] = BuildLayerByte(GetLandObject(x * LandUnit, y * LandUnit), x, y, remote_client);
1359 byteArrayCount++;
1360 if (byteArrayCount >= LAND_BLOCKS_PER_PACKET)
1361 { 1125 {
1362<<<<<<< HEAD
1363 // m_log.DebugFormat("{0} SendParcelOverlay, sending packet, bytes={1}", LogHeader, byteArray.Length);
1364 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1365 byteArrayCount = 0;
1366 sequenceID++;
1367 byteArray = new byte[LAND_BLOCKS_PER_PACKET];
1368 }
1369
1370 }
1371 }
1372
1373 if (byteArrayCount != 0)
1374 {
1375 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1376 // m_log.DebugFormat("{0} SendParcelOverlay, complete sending packet, bytes={1}", LogHeader, byteArray.Length);
1377 }
1378 }
1379
1380 private byte BuildLayerByte(ILandObject currentParcelBlock, int x, int y, IClientAPI remote_client)
1381 {
1382 byte tempByte = 0; //This represents the byte for the current 4x4
1383
1384 if (currentParcelBlock != null)
1385 {
1386 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId)
1387 {
1388 //Owner Flag
1389 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER);
1390 }
1391 else if (currentParcelBlock.LandData.SalePrice > 0 &&
1392 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero ||
1393 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId))
1394 {
1395 //Sale Flag
1396 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_IS_FOR_SALE);
1397 }
1398 else if (currentParcelBlock.LandData.OwnerID == UUID.Zero)
1399 {
1400 //Public Flag
1401 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_PUBLIC);
1402 }
1403 else
1404 {
1405 //Other Flag
1406 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_OTHER);
1407 }
1408
1409 //Now for border control
1410
1411 ILandObject westParcel = null;
1412 ILandObject southParcel = null;
1413 if (x > 0)
1414 {
1415 westParcel = GetLandObject((x - 1) * LandUnit, y * LandUnit);
1416 }
1417 if (y > 0)
1418 {
1419 southParcel = GetLandObject(x * LandUnit, (y - 1) * LandUnit);
1420 }
1421
1422 if (x == 0)
1423 {
1424 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST);
1425 }
1426 else if (westParcel != null && westParcel != currentParcelBlock)
1427 {
1428 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST);
1429 }
1430
1431 if (y == 0)
1432 {
1433 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH);
1434 }
1435 else if (southParcel != null && southParcel != currentParcelBlock)
1436 {
1437 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH);
1438 }
1439
1440=======
1441 // types 1126 // types
1442 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId) 1127 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId)
1443 { 1128 {
@@ -1525,10 +1210,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1525 if (byteArrayCount > 0) 1210 if (byteArrayCount > 0)
1526 { 1211 {
1527 remote_client.SendLandParcelOverlay(byteArray, sequenceID); 1212 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1528>>>>>>> avn/ubitvar
1529 } 1213 }
1530
1531 return tempByte;
1532 } 1214 }
1533 1215
1534 public void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, 1216 public void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id,
@@ -1569,10 +1251,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1569 temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client); 1251 temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client);
1570 } 1252 }
1571 1253
1572<<<<<<< HEAD
1573 // Also send the layer data around the point of interest
1574 SendParcelOverlay(remote_client, (start_x + end_x) / 2, (start_y + end_y) / 2, parcelLayerViewDistance);
1575=======
1576// SendParcelOverlay(remote_client); 1254// SendParcelOverlay(remote_client);
1577 } 1255 }
1578 1256
@@ -1612,7 +1290,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1612 avatar.currentParcelUUID = parcelID; // force parcel flags review 1290 avatar.currentParcelUUID = parcelID; // force parcel flags review
1613 }); 1291 });
1614 } 1292 }
1615>>>>>>> avn/ubitvar
1616 } 1293 }
1617 1294
1618 public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client) 1295 public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client)
@@ -1821,35 +1498,17 @@ namespace OpenSim.Region.CoreModules.World.Land
1821 for (int i = 0; i < data.Count; i++) 1498 for (int i = 0; i < data.Count; i++)
1822 IncomingLandObjectFromStorage(data[i]); 1499 IncomingLandObjectFromStorage(data[i]);
1823 1500
1824<<<<<<< HEAD 1501 // Layer data is in LandUnit (4m) chunks
1825 // Prevent race conditions from any auto-creation of new parcels for varregions whilst we are still loading
1826 // the existing parcels.
1827 lock (m_landList)
1828 {
1829 for (int i = 0; i < data.Count; i++)
1830 IncomingLandObjectFromStorage(data[i]);
1831
1832 // Layer data is in landUnit (4m) chunks
1833 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++) 1502 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++)
1834 { 1503 {
1835 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++) 1504 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++)
1836=======
1837 // Layer data is in landUnit (4m) chunks
1838 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); y++)
1839 {
1840 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); x++)
1841>>>>>>> avn/ubitvar
1842 { 1505 {
1843 if (m_landIDList[x, y] == 0) 1506 if (m_landIDList[x, y] == 0)
1844 { 1507 {
1845 if (m_landList.Count == 1) 1508 if (m_landList.Count == 1)
1846 { 1509 {
1847 m_log.DebugFormat( 1510 m_log.DebugFormat(
1848<<<<<<< HEAD
1849 "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}",
1850=======
1851 "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}", 1511 "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}",
1852>>>>>>> avn/ubitvar
1853 LogHeader, x, y, m_scene.Name); 1512 LogHeader, x, y, m_scene.Name);
1854 1513
1855 int onlyParcelID = 0; 1514 int onlyParcelID = 0;
@@ -1872,19 +1531,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1872 else if (m_landList.Count > 1) 1531 else if (m_landList.Count > 1)
1873 { 1532 {
1874 m_log.DebugFormat( 1533 m_log.DebugFormat(
1875<<<<<<< HEAD
1876 "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}",
1877 LogHeader, x, y, m_scene.Name);
1878
1879 // There are several other parcels so we must create a new one for the unassigned space
1880 ILandObject newLand = new LandObject(UUID.Zero, false, m_scene);
1881=======
1882 "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}", 1534 "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}",
1883 LogHeader, x, y, m_scene.Name); 1535 LogHeader, x, y, m_scene.Name);
1884 1536
1885 // There are several other parcels so we must create a new one for the unassigned space 1537 // There are several other parcels so we must create a new one for the unassigned space
1886 ILandObject newLand = new LandObject(UUID.Zero, false, m_scene); 1538 ILandObject newLand = new LandObject(UUID.Zero, false, m_scene);
1887>>>>>>> avn/ubitvar
1888 // Claim all the unclaimed "0" ids 1539 // Claim all the unclaimed "0" ids
1889 newLand.SetLandBitmap(CreateBitmapForID(0)); 1540 newLand.SetLandBitmap(CreateBitmapForID(0));
1890 newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 1541 newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
@@ -1895,11 +1546,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1895 { 1546 {
1896 // We should never reach this point as the separate code path when no land data exists should have fired instead. 1547 // We should never reach this point as the separate code path when no land data exists should have fired instead.
1897 m_log.WarnFormat( 1548 m_log.WarnFormat(
1898<<<<<<< HEAD
1899 "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present",
1900=======
1901 "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present", 1549 "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present",
1902>>>>>>> avn/ubitvar
1903 LogHeader, m_scene.Name); 1550 LogHeader, m_scene.Name);
1904 } 1551 }
1905 } 1552 }
@@ -1910,13 +1557,9 @@ namespace OpenSim.Region.CoreModules.World.Land
1910 1557
1911 private void IncomingLandObjectFromStorage(LandData data) 1558 private void IncomingLandObjectFromStorage(LandData data)
1912 { 1559 {
1913<<<<<<< HEAD
1914 ILandObject new_land = new LandObject(data, m_scene);
1915=======
1916
1917 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); 1560 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
1918 new_land.LandData = data.Copy(); 1561 new_land.LandData = data.Copy();
1919>>>>>>> avn/ubitvar 1562
1920 new_land.SetLandBitmapFromByteArray(); 1563 new_land.SetLandBitmapFromByteArray();
1921 AddLandObject(new_land); 1564 AddLandObject(new_land);
1922// new_land.SendLandUpdateToAvatarsOverMe(); 1565// new_land.SendLandUpdateToAvatarsOverMe();
@@ -2568,17 +2211,6 @@ namespace OpenSim.Region.CoreModules.World.Land
2568 2211
2569 private void AppendParcelsSummaryReport(StringBuilder report) 2212 private void AppendParcelsSummaryReport(StringBuilder report)
2570 { 2213 {
2571<<<<<<< HEAD
2572 report.AppendFormat("Land information for {0}\n", m_scene.Name);
2573
2574 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
2575 cdt.AddColumn("Parcel Name", ConsoleDisplayUtil.ParcelNameSize);
2576 cdt.AddColumn("ID", 3);
2577 cdt.AddColumn("Area", 6);
2578 cdt.AddColumn("Starts", ConsoleDisplayUtil.VectorSize);
2579 cdt.AddColumn("Ends", ConsoleDisplayUtil.VectorSize);
2580 cdt.AddColumn("Owner", ConsoleDisplayUtil.UserNameSize);
2581=======
2582 report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); 2214 report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName);
2583 report.AppendFormat( 2215 report.AppendFormat(
2584 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", 2216 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n",
@@ -2588,27 +2220,12 @@ namespace OpenSim.Region.CoreModules.World.Land
2588 "AABBMin", 2220 "AABBMin",
2589 "AABBMax", 2221 "AABBMax",
2590 "Owner"); 2222 "Owner");
2591>>>>>>> avn/ubitvar
2592 2223
2593 lock (m_landList) 2224 lock (m_landList)
2594 { 2225 {
2595 foreach (ILandObject lo in m_landList.Values) 2226 foreach (ILandObject lo in m_landList.Values)
2596 { 2227 {
2597 LandData ld = lo.LandData; 2228 LandData ld = lo.LandData;
2598<<<<<<< HEAD
2599 string ownerName;
2600 if (ld.IsGroupOwned)
2601 {
2602 GroupRecord rec = m_groupManager.GetGroupRecord(ld.GroupID);
2603 ownerName = (rec != null) ? rec.GroupName : "Unknown Group";
2604 }
2605 else
2606 {
2607 ownerName = m_userManager.GetUserName(ld.OwnerID);
2608 }
2609 cdt.AddRow(
2610 ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, ownerName);
2611=======
2612 2229
2613 report.AppendFormat( 2230 report.AppendFormat(
2614 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", 2231 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n",
@@ -2636,11 +2253,8 @@ namespace OpenSim.Region.CoreModules.World.Land
2636 else 2253 else
2637 { 2254 {
2638 ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); 2255 ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition);
2639>>>>>>> avn/ubitvar
2640 } 2256 }
2641 } 2257 }
2642
2643 report.Append(cdt.ToString());
2644 } 2258 }
2645 2259
2646 private void AppendParcelReport(StringBuilder report, ILandObject lo) 2260 private void AppendParcelReport(StringBuilder report, ILandObject lo)