From d0854e4ace64d105d06e2b6b4e342a34f6e7e44a Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 5 Nov 2013 21:33:02 -0800 Subject: varregion: properly sense size of terrain heightmap and store as compressed 2D database blob if a varregion. --- OpenSim/Framework/TerrainData.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/OpenSim/Framework/TerrainData.cs b/OpenSim/Framework/TerrainData.cs index 9c036ca..d5dad8f 100644 --- a/OpenSim/Framework/TerrainData.cs +++ b/OpenSim/Framework/TerrainData.cs @@ -168,9 +168,20 @@ namespace OpenSim.Framework // The user wants something to store in the database. public override bool GetDatabaseBlob(out int DBRevisionCode, out Array blob) { - DBRevisionCode = (int)DBTerrainRevision.Legacy256; - blob = ToLegacyTerrainSerialization(); - return false; + bool ret = false; + if (SizeX == Constants.RegionSize && SizeY == Constants.RegionSize) + { + DBRevisionCode = (int)DBTerrainRevision.Legacy256; + blob = ToLegacyTerrainSerialization(); + ret = true; + } + else + { + DBRevisionCode = (int)DBTerrainRevision.Compressed2D; + blob = ToCompressedTerrainSerialization(); + ret = true; + } + return ret; } // TerrainData.CompressionFactor @@ -391,7 +402,7 @@ namespace OpenSim.Framework { Int16 val = br.ReadInt16(); if (xx < SizeX && yy < SizeY) - m_heightmap[xx, yy] = ToCompressedHeight(val); + m_heightmap[xx, yy] = val; } } } -- cgit v1.1