From bff26ccdbb94fbdf9623b0b00a16ef88549e648e Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sat, 8 Aug 2009 00:10:19 -0400 Subject: * More tweaking of the various services to work with nonstandard region sizes. * Now, what's available of the terrain will show and it'll be truncated if it's larger on Linden Clients. Parcel minimum is 64 (256/4) for the client to accept it. --- .../CoreModules/World/Land/LandManagementModule.cs | 24 ++++++++++++++++------ .../Region/CoreModules/World/Land/LandObject.cs | 5 +++-- 2 files changed, 21 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 097a62d..c917840 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -60,7 +60,10 @@ namespace OpenSim.Region.CoreModules.World.Land private LandChannel landChannel; private Scene m_scene; - private readonly int[,] m_landIDList = new int[64, 64]; + // Minimum for parcels to work is 64m even if we don't actually use them. + private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64; + + private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax]; private readonly Dictionary m_landList = new Dictionary(); private bool m_landPrimCountTainted; @@ -456,9 +459,9 @@ namespace OpenSim.Region.CoreModules.World.Land new_land.landData.LocalID = newLandLocalID; bool[,] landBitmap = new_land.getLandBitmap(); - for (int x = 0; x < 64; x++) + for (int x = 0; x < landArrayMax; x++) { - for (int y = 0; y < 64; y++) + for (int y = 0; y < landArrayMax; y++) { if (landBitmap[x, y]) { @@ -581,10 +584,17 @@ namespace OpenSim.Region.CoreModules.World.Land } lock (m_landIDList) { - if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) - return m_landList[m_landIDList[x / 4, y / 4]]; - else + try + { + if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) + return m_landList[m_landIDList[x / 4, y / 4]]; + else + return null; + } + catch (IndexOutOfRangeException) + { return null; + } } } @@ -941,6 +951,7 @@ namespace OpenSim.Region.CoreModules.World.Land { for (int y = 0; y < inc_y; y++) { + ILandObject currentParcel = GetLandObject(start_x + x, start_y + y); if (currentParcel != null) @@ -951,6 +962,7 @@ namespace OpenSim.Region.CoreModules.World.Land temp.Add(currentParcel); } } + } } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index f41bdac..bb06996 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -44,7 +44,8 @@ namespace OpenSim.Region.CoreModules.World.Land #region Member Variables private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private bool[,] m_landBitmap = new bool[64,64]; + private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64; + private bool[,] m_landBitmap = new bool[landArrayMax,landArrayMax]; protected LandData m_landData = new LandData(); protected Scene m_scene; @@ -630,7 +631,7 @@ namespace OpenSim.Region.CoreModules.World.Land private bool[,] convertBytesToLandBitmap() { - bool[,] tempConvertMap = new bool[64,64]; + bool[,] tempConvertMap = new bool[landArrayMax, landArrayMax]; tempConvertMap.Initialize(); byte tempByte = 0; int x = 0, y = 0, i = 0, bitNum = 0; -- cgit v1.1