diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 32 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/ITerrainModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 6 |
3 files changed, 38 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index ba271fd..a40828b 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Net; | ||
32 | using log4net; | 33 | using log4net; |
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
@@ -259,6 +260,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
259 | } | 260 | } |
260 | 261 | ||
261 | /// <summary> | 262 | /// <summary> |
263 | /// Loads a terrain file from the specified URI | ||
264 | /// </summary> | ||
265 | /// <param name="filename">The name of the terrain to load</param> | ||
266 | /// <param name="pathToTerrainHeightmap">The URI to the terrain height map</param> | ||
267 | public void LoadFromStream(string filename, Uri pathToTerrainHeightmap) | ||
268 | { | ||
269 | LoadFromStream(filename, URIFetch(pathToTerrainHeightmap)); | ||
270 | } | ||
271 | |||
272 | /// <summary> | ||
262 | /// Loads a terrain file from a stream and installs it in the scene. | 273 | /// Loads a terrain file from a stream and installs it in the scene. |
263 | /// </summary> | 274 | /// </summary> |
264 | /// <param name="filename">Filename to terrain file. Type is determined by extension.</param> | 275 | /// <param name="filename">Filename to terrain file. Type is determined by extension.</param> |
@@ -267,7 +278,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
267 | { | 278 | { |
268 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) | 279 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) |
269 | { | 280 | { |
270 | if (@filename.EndsWith(loader.Key)) | 281 | if (filename.EndsWith(loader.Key)) |
271 | { | 282 | { |
272 | lock (m_scene) | 283 | lock (m_scene) |
273 | { | 284 | { |
@@ -295,6 +306,25 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
295 | throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename)); | 306 | throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename)); |
296 | } | 307 | } |
297 | 308 | ||
309 | private static Stream URIFetch(Uri uri) | ||
310 | { | ||
311 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); | ||
312 | |||
313 | // request.Credentials = credentials; | ||
314 | |||
315 | request.ContentLength = 0; | ||
316 | request.KeepAlive = false; | ||
317 | |||
318 | WebResponse response = request.GetResponse(); | ||
319 | Stream file = response.GetResponseStream(); | ||
320 | |||
321 | if (response.ContentLength == 0) | ||
322 | throw new Exception(String.Format("{0} returned an empty file", uri.ToString())); | ||
323 | |||
324 | // return new BufferedStream(file, (int) response.ContentLength); | ||
325 | return new BufferedStream(file, 1000000); | ||
326 | } | ||
327 | |||
298 | /// <summary> | 328 | /// <summary> |
299 | /// Modify Land | 329 | /// Modify Land |
300 | /// </summary> | 330 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs index 2dcba0c..7caac55 100644 --- a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
51 | /// </param> | 51 | /// </param> |
52 | /// <param name="stream"></param> | 52 | /// <param name="stream"></param> |
53 | void LoadFromStream(string filename, Stream stream); | 53 | void LoadFromStream(string filename, Stream stream); |
54 | 54 | void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap); | |
55 | /// <summary> | 55 | /// <summary> |
56 | /// Save a terrain to a stream. | 56 | /// Save a terrain to a stream. |
57 | /// </summary> | 57 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 09d02f4..0b0c205 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -2393,6 +2393,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2393 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 2393 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
2394 | item = InventoryService.GetItem(item); | 2394 | item = InventoryService.GetItem(item); |
2395 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | 2395 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); |
2396 | |||
2397 | if (m_AvatarFactory != null) | ||
2398 | { | ||
2399 | m_AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | ||
2400 | } | ||
2401 | |||
2396 | } | 2402 | } |
2397 | } | 2403 | } |
2398 | 2404 | ||