aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs13
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/TerrainChannel.cs4
3 files changed, 17 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs
index 9fb7ef7..d467abb 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/RAW32.cs
@@ -25,7 +25,10 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.IO; 29using System.IO;
30
31using OpenSim.Framework;
29using OpenSim.Region.Framework.Interfaces; 32using OpenSim.Region.Framework.Interfaces;
30using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
31 34
@@ -116,7 +119,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
116 119
117 public ITerrainChannel LoadStream(Stream s) 120 public ITerrainChannel LoadStream(Stream s)
118 { 121 {
119 TerrainChannel retval = new TerrainChannel(); 122 // The raw format doesn't contain any dimension information.
123 // Guess the square dimensions by using the length of the raw file.
124 double dimension = Math.Sqrt((double)(s.Length / 4));
125 // Regions are always multiples of 256.
126 int trimmedDimension = (int)dimension - ((int)dimension % (int)Constants.RegionSize);
127 if (trimmedDimension < Constants.RegionSize)
128 trimmedDimension = (int)Constants.RegionSize;
129
130 TerrainChannel retval = new TerrainChannel(trimmedDimension, trimmedDimension);
120 131
121 BinaryReader bs = new BinaryReader(s); 132 BinaryReader bs = new BinaryReader(s);
122 int y; 133 int y;
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
index 96c16a9..29e80ef 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
80 effect = new LowerSphere(); 80 effect = new LowerSphere();
81 81
82 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0); 82 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0);
83 Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); 83 Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128).");
84 Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); 84 Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128).");
85 Assert.That(map[125, midRegion] < 1.0, "Lower brush should lowering value at this point (124,128)."); 85 Assert.That(map[125, midRegion] < 1.0, "Lower brush should lowering value at this point (124,128).");
86 Assert.That(map[120, midRegion] == 1.0, "Lower brush should not change value at this point (120,128)."); 86 Assert.That(map[120, midRegion] == 1.0, "Lower brush should not change value at this point (120,128).");
diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
index 24709dc..60dc6c9 100644
--- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
+++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
@@ -217,6 +217,10 @@ namespace OpenSim.Region.Framework.Scenes
217 // ITerrainChannel.Merge 217 // ITerrainChannel.Merge
218 public void Merge(ITerrainChannel newTerrain, Vector3 displacement, float radianRotation, Vector2 rotationDisplacement) 218 public void Merge(ITerrainChannel newTerrain, Vector3 displacement, float radianRotation, Vector2 rotationDisplacement)
219 { 219 {
220 m_log.DebugFormat("{0} Merge. inSize=<{1},{2}>, disp={3}, rot={4}, rotDisp={5}, outSize=<{6},{7}>", LogHeader,
221 newTerrain.Width, newTerrain.Height,
222 displacement, radianRotation, rotationDisplacement,
223 m_terrainData.SizeX, m_terrainData.SizeY);
220 for (int xx = 0; xx < newTerrain.Width; xx++) 224 for (int xx = 0; xx < newTerrain.Width; xx++)
221 { 225 {
222 for (int yy = 0; yy < newTerrain.Height; yy++) 226 for (int yy = 0; yy < newTerrain.Height; yy++)