aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteRegionData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/SQLite/SQLiteRegionData.cs')
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs18
1 files changed, 9 insertions, 9 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index 2f9f59d..3555caf 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -571,7 +571,7 @@ namespace OpenSim.Data.SQLite
571 { 571 {
572 lock (ds) 572 lock (ds)
573 { 573 {
574 double[,] terret = new double[256,256]; 574 double[,] terret = new double[(int)Constants.RegionSize, (int)Constants.RegionSize];
575 terret.Initialize(); 575 terret.Initialize();
576 576
577 String sql = "select RegionUUID, Revision, Heightfield from terrain" + 577 String sql = "select RegionUUID, Revision, Heightfield from terrain" +
@@ -589,9 +589,9 @@ namespace OpenSim.Data.SQLite
589 // TODO: put this into a function 589 // TODO: put this into a function
590 MemoryStream str = new MemoryStream((byte[]) row["Heightfield"]); 590 MemoryStream str = new MemoryStream((byte[]) row["Heightfield"]);
591 BinaryReader br = new BinaryReader(str); 591 BinaryReader br = new BinaryReader(str);
592 for (int x = 0; x < 256; x++) 592 for (int x = 0; x < (int)Constants.RegionSize; x++)
593 { 593 {
594 for (int y = 0; y < 256; y++) 594 for (int y = 0; y < (int)Constants.RegionSize; y++)
595 { 595 {
596 terret[x, y] = br.ReadDouble(); 596 terret[x, y] = br.ReadDouble();
597 } 597 }
@@ -1427,12 +1427,12 @@ namespace OpenSim.Data.SQLite
1427 /// <returns></returns> 1427 /// <returns></returns>
1428 private static Array serializeTerrain(double[,] val) 1428 private static Array serializeTerrain(double[,] val)
1429 { 1429 {
1430 MemoryStream str = new MemoryStream(65536*sizeof (double)); 1430 MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize) *sizeof (double));
1431 BinaryWriter bw = new BinaryWriter(str); 1431 BinaryWriter bw = new BinaryWriter(str);
1432 1432
1433 // TODO: COMPATIBILITY - Add byte-order conversions 1433 // TODO: COMPATIBILITY - Add byte-order conversions
1434 for (int x = 0; x < 256; x++) 1434 for (int x = 0; x < (int)Constants.RegionSize; x++)
1435 for (int y = 0; y < 256; y++) 1435 for (int y = 0; y < (int)Constants.RegionSize; y++)
1436 bw.Write(val[x, y]); 1436 bw.Write(val[x, y]);
1437 1437
1438 return str.ToArray(); 1438 return str.ToArray();
@@ -1443,12 +1443,12 @@ namespace OpenSim.Data.SQLite
1443// row["RegionUUID"] = regionUUID; 1443// row["RegionUUID"] = regionUUID;
1444// row["Revision"] = rev; 1444// row["Revision"] = rev;
1445 1445
1446// MemoryStream str = new MemoryStream(65536*sizeof (double)); 1446 // MemoryStream str = new MemoryStream(((int)Constants.RegionSize * (int)Constants.RegionSize )*sizeof (double));
1447// BinaryWriter bw = new BinaryWriter(str); 1447// BinaryWriter bw = new BinaryWriter(str);
1448 1448
1449// // TODO: COMPATIBILITY - Add byte-order conversions 1449// // TODO: COMPATIBILITY - Add byte-order conversions
1450// for (int x = 0; x < 256; x++) 1450 // for (int x = 0; x < (int)Constants.RegionSize; x++)
1451// for (int y = 0; y < 256; y++) 1451 // for (int y = 0; y < (int)Constants.RegionSize; y++)
1452// bw.Write(val[x, y]); 1452// bw.Write(val[x, y]);
1453 1453
1454// row["Heightfield"] = str.ToArray(); 1454// row["Heightfield"] = str.ToArray();