From d8e18ad0f072e6edfdcdcef65efc9a2ca42b3150 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Sun, 29 Jun 2008 20:08:58 +0000
Subject: * Reload terrain from archive if there is one
---
.../Modules/World/Archiver/ArchiveReadRequest.cs | 36 +++++++++++++++++++---
1 file changed, 31 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
index 8f73c2c..610adfb 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
@@ -28,6 +28,7 @@
using OpenSim.Framework;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Modules.World.Serialiser;
+using OpenSim.Region.Environment.Modules.World.Terrain;
using System;
using System.Collections.Generic;
using System.IO;
@@ -83,7 +84,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
// }
else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
{
- ResolveAssetData(filePath, data);
+ LoadAsset(filePath, data);
+ }
+ else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH))
+ {
+ LoadTerrain(filePath, data);
}
}
@@ -105,12 +110,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
}
///
- /// Resolve a new piece of asset data against stored metadata
+ /// Load an asset
///
///
///
/// true if asset was successfully loaded, false otherwise
- protected bool ResolveAssetData(string assetPath, byte[] data)
+ protected bool LoadAsset(string assetPath, byte[] data)
{
// Right now we're nastily obtaining the lluuid from the filename
string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length);
@@ -134,11 +139,32 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
else
{
m_log.ErrorFormat(
- "[DEARCHIVER]: Tried to dearchive data with path {0} with an unknown type extension {1}",
+ "[ARCHIVER]: Tried to dearchive data with path {0} with an unknown type extension {1}",
assetPath, extension);
return false;
}
- }
+ }
+
+ ///
+ /// Load terrain data
+ ///
+ ///
+ ///
+ ///
+ /// true if terrain was resolved successfully, false otherwise.
+ ///
+ protected bool LoadTerrain(string terrainPath, byte[] data)
+ {
+ ITerrainModule terrainModule = m_scene.RequestModuleInterface();
+
+ MemoryStream ms = new MemoryStream(data);
+ terrainModule.LoadFromStream(terrainPath, ms);
+ ms.Close();
+
+ m_log.DebugFormat("[ARCHIVER]: Successfully loaded terrain {0}", terrainPath);
+
+ return true;
+ }
}
}
--
cgit v1.1