aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-06-29 20:08:58 +0000
committerJustin Clarke Casey2008-06-29 20:08:58 +0000
commitd8e18ad0f072e6edfdcdcef65efc9a2ca42b3150 (patch)
treeafe06f2fd94d8a9de8a9adb1d86d356639ad4df3 /OpenSim/Region/Environment/Modules
parent* Save terrain information in archive (diff)
downloadopensim-SC_OLD-d8e18ad0f072e6edfdcdcef65efc9a2ca42b3150.zip
opensim-SC_OLD-d8e18ad0f072e6edfdcdcef65efc9a2ca42b3150.tar.gz
opensim-SC_OLD-d8e18ad0f072e6edfdcdcef65efc9a2ca42b3150.tar.bz2
opensim-SC_OLD-d8e18ad0f072e6edfdcdcef65efc9a2ca42b3150.tar.xz
* Reload terrain from archive if there is one
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs36
1 files changed, 31 insertions, 5 deletions
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 @@
28using OpenSim.Framework; 28using OpenSim.Framework;
29using OpenSim.Region.Environment.Scenes; 29using OpenSim.Region.Environment.Scenes;
30using OpenSim.Region.Environment.Modules.World.Serialiser; 30using OpenSim.Region.Environment.Modules.World.Serialiser;
31using OpenSim.Region.Environment.Modules.World.Terrain;
31using System; 32using System;
32using System.Collections.Generic; 33using System.Collections.Generic;
33using System.IO; 34using System.IO;
@@ -83,7 +84,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
83// } 84// }
84 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) 85 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
85 { 86 {
86 ResolveAssetData(filePath, data); 87 LoadAsset(filePath, data);
88 }
89 else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH))
90 {
91 LoadTerrain(filePath, data);
87 } 92 }
88 } 93 }
89 94
@@ -105,12 +110,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
105 } 110 }
106 111
107 /// <summary> 112 /// <summary>
108 /// Resolve a new piece of asset data against stored metadata 113 /// Load an asset
109 /// </summary> 114 /// </summary>
110 /// <param name="assetFilename"></param> 115 /// <param name="assetFilename"></param>
111 /// <param name="data"></param> 116 /// <param name="data"></param>
112 /// <returns>true if asset was successfully loaded, false otherwise</returns> 117 /// <returns>true if asset was successfully loaded, false otherwise</returns>
113 protected bool ResolveAssetData(string assetPath, byte[] data) 118 protected bool LoadAsset(string assetPath, byte[] data)
114 { 119 {
115 // Right now we're nastily obtaining the lluuid from the filename 120 // Right now we're nastily obtaining the lluuid from the filename
116 string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length); 121 string filename = assetPath.Remove(0, ArchiveConstants.ASSETS_PATH.Length);
@@ -134,11 +139,32 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
134 else 139 else
135 { 140 {
136 m_log.ErrorFormat( 141 m_log.ErrorFormat(
137 "[DEARCHIVER]: Tried to dearchive data with path {0} with an unknown type extension {1}", 142 "[ARCHIVER]: Tried to dearchive data with path {0} with an unknown type extension {1}",
138 assetPath, extension); 143 assetPath, extension);
139 144
140 return false; 145 return false;
141 } 146 }
142 } 147 }
148
149 /// <summary>
150 /// Load terrain data
151 /// </summary>
152 /// <param name="terrainPath"></param>
153 /// <param name="data"></param>
154 /// <returns>
155 /// true if terrain was resolved successfully, false otherwise.
156 /// </returns>
157 protected bool LoadTerrain(string terrainPath, byte[] data)
158 {
159 ITerrainModule terrainModule = m_scene.RequestModuleInterface<ITerrainModule>();
160
161 MemoryStream ms = new MemoryStream(data);
162 terrainModule.LoadFromStream(terrainPath, ms);
163 ms.Close();
164
165 m_log.DebugFormat("[ARCHIVER]: Successfully loaded terrain {0}", terrainPath);
166
167 return true;
168 }
143 } 169 }
144} 170}