diff options
Diffstat (limited to 'OpenSim/Data/PGSQL/PGSQLSimulationData.cs')
-rwxr-xr-x | OpenSim/Data/PGSQL/PGSQLSimulationData.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs index e6161a2..902aae0 100755 --- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs +++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs | |||
@@ -573,6 +573,39 @@ namespace OpenSim.Data.PGSQL | |||
573 | return terrData; | 573 | return terrData; |
574 | } | 574 | } |
575 | 575 | ||
576 | public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) | ||
577 | { | ||
578 | TerrainData terrData = null; | ||
579 | |||
580 | string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from bakedterrain | ||
581 | where ""RegionUUID"" = :RegionUUID; "; | ||
582 | |||
583 | using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) | ||
584 | { | ||
585 | using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) | ||
586 | { | ||
587 | // PGSqlParameter param = new PGSqlParameter(); | ||
588 | cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID)); | ||
589 | conn.Open(); | ||
590 | using (NpgsqlDataReader reader = cmd.ExecuteReader()) | ||
591 | { | ||
592 | int rev; | ||
593 | if (reader.Read()) | ||
594 | { | ||
595 | rev = Convert.ToInt32(reader["Revision"]); | ||
596 | if ((reader["Heightfield"] != DBNull.Value)) | ||
597 | { | ||
598 | byte[] blob = (byte[])reader["Heightfield"]; | ||
599 | terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); | ||
600 | } | ||
601 | } | ||
602 | } | ||
603 | } | ||
604 | } | ||
605 | |||
606 | return terrData; | ||
607 | } | ||
608 | |||
576 | // Legacy entry point for when terrain was always a 256x256 heightmap | 609 | // Legacy entry point for when terrain was always a 256x256 heightmap |
577 | public void StoreTerrain(double[,] terrain, UUID regionID) | 610 | public void StoreTerrain(double[,] terrain, UUID regionID) |
578 | { | 611 | { |