aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLSimulationData.cs
diff options
context:
space:
mode:
authorRobert Adams2013-11-01 11:35:31 -0700
committerRobert Adams2013-11-01 11:35:31 -0700
commitff5885ab234bc9a7efda49eea0e2200711c4933c (patch)
tree21ef180072b30891700f139792d34ca9b2c7e0d6 /OpenSim/Data/MySQL/MySQLSimulationData.cs
parentvarregion: fix problem of X/Y dimensions swapped and incorrect terrain (diff)
downloadopensim-SC_OLD-ff5885ab234bc9a7efda49eea0e2200711c4933c.zip
opensim-SC_OLD-ff5885ab234bc9a7efda49eea0e2200711c4933c.tar.gz
opensim-SC_OLD-ff5885ab234bc9a7efda49eea0e2200711c4933c.tar.bz2
opensim-SC_OLD-ff5885ab234bc9a7efda49eea0e2200711c4933c.tar.xz
varregion: push TerrainData implementation up and down the database storage stack.
Implement both LoadTerrain and StoreTerrain for all DBs. Move all database blob serialization/deserialization into TerrainData.
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLSimulationData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs32
1 files changed, 11 insertions, 21 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 4bd8617..42f2ebb 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -613,9 +613,16 @@ namespace OpenSim.Data.MySQL
613 } 613 }
614 } 614 }
615 615
616 // Legacy region loading
616 public double[,] LoadTerrain(UUID regionID) 617 public double[,] LoadTerrain(UUID regionID)
617 { 618 {
618 double[,] terrain = null; 619 TerrainData terrData = LoadTerrain(regionID, (int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight);
620 return terrData.GetDoubles();
621 }
622
623 public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
624 {
625 TerrainData terrData = null;
619 626
620 lock (m_dbLock) 627 lock (m_dbLock)
621 { 628 {
@@ -635,32 +642,15 @@ namespace OpenSim.Data.MySQL
635 while (reader.Read()) 642 while (reader.Read())
636 { 643 {
637 int rev = Convert.ToInt32(reader["Revision"]); 644 int rev = Convert.ToInt32(reader["Revision"]);
638 645 byte[] blob = (byte[])reader["Heightfield"];
639 terrain = new double[(int)Constants.RegionSize, (int)Constants.RegionSize]; 646 terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
640 terrain.Initialize();
641
642 using (MemoryStream mstr = new MemoryStream((byte[])reader["Heightfield"]))
643 {
644 using (BinaryReader br = new BinaryReader(mstr))
645 {
646 for (int x = 0; x < (int)Constants.RegionSize; x++)
647 {
648 for (int y = 0; y < (int)Constants.RegionSize; y++)
649 {
650 terrain[x, y] = br.ReadDouble();
651 }
652 }
653 }
654
655 m_log.InfoFormat("[REGION DB]: Loaded terrain revision r{0}", rev);
656 }
657 } 647 }
658 } 648 }
659 } 649 }
660 } 650 }
661 } 651 }
662 652
663 return terrain; 653 return terrData;
664 } 654 }
665 655
666 public void RemoveLandObject(UUID globalID) 656 public void RemoveLandObject(UUID globalID)