varregion: properly sense size of terrain heightmap and store as

compressed 2D database blob if a varregion.
varregion
Robert Adams 2013-11-05 21:33:02 -08:00
parent c931b16c1f
commit d0854e4ace
1 changed files with 15 additions and 4 deletions

View File

@ -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;
}
}
}