From bedafb8fae9898ef0c5fc6470236ee7244e616a9 Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Fri, 27 Mar 2015 19:32:50 -0700
Subject: varregion: refactor use of 'double heightmap[,]' into references to
 new class TerrainData and push the implementation from Scene into the
 database readers and writers.

---
 OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs | 29 ++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

(limited to 'OpenSim/Tests')

diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
index 5c1ec0b..3ab9020 100644
--- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
@@ -69,11 +69,21 @@ namespace OpenSim.Data.Null
             m_store.StoreTerrain(terrain, regionID);
         }
 
+        public void StoreTerrain(TerrainData terrain, UUID regionID)
+        {
+            m_store.StoreTerrain(terrain, regionID);
+        }
+
         public double[,] LoadTerrain(UUID regionID)
         {
             return m_store.LoadTerrain(regionID);
         }
 
+        public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
+        {
+            return m_store.LoadTerrain(regionID, pSizeX, pSizeY, pSizeZ);
+        }
+
         public void StoreLandObject(ILandObject Parcel)
         {
             m_store.StoreLandObject(Parcel);
@@ -159,7 +169,7 @@ namespace OpenSim.Data.Null
         protected Dictionary<UUID, SceneObjectPart> m_sceneObjectParts = new Dictionary<UUID, SceneObjectPart>();
         protected Dictionary<UUID, ICollection<TaskInventoryItem>> m_primItems 
             = new Dictionary<UUID, ICollection<TaskInventoryItem>>();
-        protected Dictionary<UUID, double[,]> m_terrains = new Dictionary<UUID, double[,]>();
+        protected Dictionary<UUID, TerrainData> m_terrains = new Dictionary<UUID, TerrainData>();
         protected Dictionary<UUID, LandData> m_landData = new Dictionary<UUID, LandData>();
         
         public void Initialise(string dbfile)
@@ -304,12 +314,17 @@ namespace OpenSim.Data.Null
             return new List<SceneObjectGroup>(objects.Values);
         }
 
-        public void StoreTerrain(double[,] ter, UUID regionID)
+        public void StoreTerrain(TerrainData ter, UUID regionID)
         {
             m_terrains[regionID] = ter;
         }
 
-        public double[,] LoadTerrain(UUID regionID)
+        public void StoreTerrain(double[,] ter, UUID regionID)
+        {
+            m_terrains[regionID] = new HeightmapTerrainData(ter);
+        }
+
+        public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
         {
             if (m_terrains.ContainsKey(regionID))
                 return m_terrains[regionID];
@@ -317,6 +332,14 @@ namespace OpenSim.Data.Null
                 return null;
         }
 
+        public double[,] LoadTerrain(UUID regionID)
+        {
+            if (m_terrains.ContainsKey(regionID))
+                return m_terrains[regionID].GetDoubles();
+            else
+                return null;
+        }
+
         public void RemoveLandObject(UUID globalID)
         {
             if (m_landData.ContainsKey(globalID))
-- 
cgit v1.1


From 07dead7dcb8b0f2a27a50748e4a460d9669903fc Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Sun, 29 Mar 2015 14:25:12 -0700
Subject: varregion: any conversions of use of Constants.RegionSize converted
 into Util.cs routines to convert region coords to and from world coords or
 handles.

---
 OpenSim/Tests/Clients/Grid/GridClient.cs              |  8 ++++----
 OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs | 10 +++-------
 2 files changed, 7 insertions(+), 11 deletions(-)

(limited to 'OpenSim/Tests')

diff --git a/OpenSim/Tests/Clients/Grid/GridClient.cs b/OpenSim/Tests/Clients/Grid/GridClient.cs
index 8e33373..fed7a16 100644
--- a/OpenSim/Tests/Clients/Grid/GridClient.cs
+++ b/OpenSim/Tests/Clients/Grid/GridClient.cs
@@ -150,16 +150,16 @@ namespace OpenSim.Tests.Clients.GridClient
 
             Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 2 regions)");
             regions = m_Connector.GetRegionRange(UUID.Zero, 
-                900 * (int)Constants.RegionSize, 1002 * (int) Constants.RegionSize,
-                900 * (int)Constants.RegionSize, 1002 * (int) Constants.RegionSize);
+                (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(1002),
+                (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(1002) );
             if (regions == null)
                 Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
             else
                 Console.WriteLine("[GRID CLIENT]: GetRegionRange returned " + regions.Count + " regions");
             Console.WriteLine("[GRID CLIENT]: *** GetRegionRange (this should return 0 regions)");
             regions = m_Connector.GetRegionRange(UUID.Zero,
-                900 * (int)Constants.RegionSize, 950 * (int)Constants.RegionSize,
-                900 * (int)Constants.RegionSize, 950 * (int)Constants.RegionSize);
+                (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(950),
+                (int)Util.RegionToWorldLoc(900), (int)Util.RegionToWorldLoc(950) );
             if (regions == null)
                 Console.WriteLine("[GRID CLIENT]: GetRegionRange returned null");
             else
diff --git a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
index 52a17e7..84de47f 100644
--- a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
@@ -69,9 +69,7 @@ namespace OpenSim.Tests.Common
             tc.OnTestClientInformClientOfNeighbour += (neighbourHandle, neighbourExternalEndPoint) =>
             {
                 uint x, y;
-                Utils.LongToUInts(neighbourHandle, out x, out y);
-                x /= Constants.RegionSize;
-                y /= Constants.RegionSize;
+                Util.RegionHandleToRegionLoc(neighbourHandle, out x, out y);
 
                 m_log.DebugFormat(
                     "[TEST CLIENT]: Processing inform client of neighbour located at {0},{1} at {2}", 
@@ -104,9 +102,7 @@ namespace OpenSim.Tests.Common
                 += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL) =>
             {
                 uint x, y;
-                Utils.LongToUInts(regionHandle, out x, out y);
-                x /= Constants.RegionSize;
-                y /= Constants.RegionSize;
+                Util.RegionHandleToRegionLoc(regionHandle, out x, out y);
 
                 m_log.DebugFormat(
                     "[TEST CLIENT]: Processing send region teleport for destination at {0},{1} at {2}", 
@@ -125,4 +121,4 @@ namespace OpenSim.Tests.Common
             };
         }
     }
-}
\ No newline at end of file
+}
-- 
cgit v1.1