aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MSSQL/MSSQLRegionData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/MSSQL/MSSQLRegionData.cs')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLRegionData.cs12
1 files changed, 6 insertions, 6 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs
index 0fe8de7..d79d32b 100644
--- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs
@@ -485,7 +485,7 @@ ELSE
485 /// <returns></returns> 485 /// <returns></returns>
486 public double[,] LoadTerrain(UUID regionID) 486 public double[,] LoadTerrain(UUID regionID)
487 { 487 {
488 double[,] terrain = new double[256, 256]; 488 double[,] terrain = new double[(int)Constants.RegionSize, (int)Constants.RegionSize];
489 terrain.Initialize(); 489 terrain.Initialize();
490 490
491 string sql = "select top 1 RegionUUID, Revision, Heightfield from terrain where RegionUUID = @RegionUUID order by Revision desc"; 491 string sql = "select top 1 RegionUUID, Revision, Heightfield from terrain where RegionUUID = @RegionUUID order by Revision desc";
@@ -502,9 +502,9 @@ ELSE
502 { 502 {
503 MemoryStream str = new MemoryStream((byte[])reader["Heightfield"]); 503 MemoryStream str = new MemoryStream((byte[])reader["Heightfield"]);
504 BinaryReader br = new BinaryReader(str); 504 BinaryReader br = new BinaryReader(str);
505 for (int x = 0; x < 256; x++) 505 for (int x = 0; x < (int)Constants.RegionSize; x++)
506 { 506 {
507 for (int y = 0; y < 256; y++) 507 for (int y = 0; y < (int)Constants.RegionSize; y++)
508 { 508 {
509 terrain[x, y] = br.ReadDouble(); 509 terrain[x, y] = br.ReadDouble();
510 } 510 }
@@ -749,12 +749,12 @@ VALUES
749 /// <returns></returns> 749 /// <returns></returns>
750 private static Array serializeTerrain(double[,] val) 750 private static Array serializeTerrain(double[,] val)
751 { 751 {
752 MemoryStream str = new MemoryStream(65536 * sizeof(double)); 752 MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) * sizeof(double));
753 BinaryWriter bw = new BinaryWriter(str); 753 BinaryWriter bw = new BinaryWriter(str);
754 754
755 // TODO: COMPATIBILITY - Add byte-order conversions 755 // TODO: COMPATIBILITY - Add byte-order conversions
756 for (int x = 0; x < 256; x++) 756 for (int x = 0; x < (int)Constants.RegionSize; x++)
757 for (int y = 0; y < 256; y++) 757 for (int y = 0; y < (int)Constants.RegionSize; y++)
758 { 758 {
759 double height = val[x, y]; 759 double height = val[x, y];
760 if (height == 0.0) 760 if (height == 0.0)