aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorMelanie2010-03-06 12:24:09 +0000
committerMelanie2010-03-06 12:24:09 +0000
commit1f7a0cf892bf23c5b8ba8e3ae1a9036de428db90 (patch)
tree69419084feb98d59888b59a643e5fa062314605d /OpenSim/Region/CoreModules
parentRemove a superfluous array creation (diff)
parent- implementing server 1.38 functions (diff)
downloadopensim-SC-1f7a0cf892bf23c5b8ba8e3ae1a9036de428db90.zip
opensim-SC-1f7a0cf892bf23c5b8ba8e3ae1a9036de428db90.tar.gz
opensim-SC-1f7a0cf892bf23c5b8ba8e3ae1a9036de428db90.tar.bz2
opensim-SC-1f7a0cf892bf23c5b8ba8e3ae1a9036de428db90.tar.xz
Merge branch '0.6.9-post-fixes' into careminster
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs14
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs66
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Access/AccessModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs16
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs24
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModule.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs41
12 files changed, 167 insertions, 34 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
index 1903eb9..b1b7b27 100644
--- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
@@ -330,7 +330,7 @@ namespace OpenSim.Region.CoreModules.Asset
330 //m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); 330 //m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name);
331 331
332 if (name != Name) 332 if (name != Name)
333 return; 333 return;
334 334
335 long maxSize = DefaultMaxSize; 335 long maxSize = DefaultMaxSize;
336 int maxCount = DefaultMaxCount; 336 int maxCount = DefaultMaxCount;
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 9216e0b..967c0a1 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -69,7 +69,7 @@ namespace Flotsam.RegionModules.AssetCache
69 69
70 private readonly List<char> m_InvalidChars = new List<char>(); 70 private readonly List<char> m_InvalidChars = new List<char>();
71 71
72 private int m_LogLevel = 1; 72 private int m_LogLevel = 0;
73 private ulong m_HitRateDisplay = 1; // How often to display hit statistics, given in requests 73 private ulong m_HitRateDisplay = 1; // How often to display hit statistics, given in requests
74 74
75 private static ulong m_Requests; 75 private static ulong m_Requests;
@@ -156,7 +156,7 @@ namespace Flotsam.RegionModules.AssetCache
156 m_WaitOnInprogressTimeout = assetConfig.GetInt("WaitOnInprogressTimeout", 3000); 156 m_WaitOnInprogressTimeout = assetConfig.GetInt("WaitOnInprogressTimeout", 3000);
157#endif 157#endif
158 158
159 m_LogLevel = assetConfig.GetInt("LogLevel", 1); 159 m_LogLevel = assetConfig.GetInt("LogLevel", 0);
160 m_HitRateDisplay = (ulong)assetConfig.GetInt("HitRateDisplay", 1000); 160 m_HitRateDisplay = (ulong)assetConfig.GetInt("HitRateDisplay", 1000);
161 161
162 m_FileExpiration = TimeSpan.FromHours(assetConfig.GetDouble("FileCacheTimeout", m_DefaultFileExpiration)); 162 m_FileExpiration = TimeSpan.FromHours(assetConfig.GetDouble("FileCacheTimeout", m_DefaultFileExpiration));
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
index 61b6d65..1a6cd6c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
@@ -148,13 +148,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
148 private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID) 148 private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID)
149 { 149 {
150 ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 150 ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
151 if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) 151 try
152 { 152 {
153 avatar.Invulnerable = false; 153 if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0)
154 {
155 avatar.Invulnerable = false;
156 }
157 else
158 {
159 avatar.Invulnerable = true;
160 }
154 } 161 }
155 else 162 catch (Exception)
156 { 163 {
157 avatar.Invulnerable = true;
158 } 164 }
159 } 165 }
160 } 166 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index ecd60bd..a898992 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -131,7 +131,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
131 { 131 {
132 if (CheckPresence(userInfo.UserProfile.ID)) 132 if (CheckPresence(userInfo.UserProfile.ID))
133 { 133 {
134 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(); 134 try
135 {
136 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute();
137 }
138 catch (EntryPointNotFoundException e)
139 {
140 m_log.ErrorFormat(
141 "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
142 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
143 m_log.Error(e);
144
145 return false;
146 }
147
135 return true; 148 return true;
136 } 149 }
137 else 150 else
@@ -156,7 +169,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
156 { 169 {
157 if (CheckPresence(userInfo.UserProfile.ID)) 170 if (CheckPresence(userInfo.UserProfile.ID))
158 { 171 {
159 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(); 172 try
173 {
174 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute();
175 }
176 catch (EntryPointNotFoundException e)
177 {
178 m_log.ErrorFormat(
179 "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
180 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
181 m_log.Error(e);
182
183 return false;
184 }
185
160 return true; 186 return true;
161 } 187 }
162 else 188 else
@@ -181,8 +207,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
181 { 207 {
182 if (CheckPresence(userInfo.UserProfile.ID)) 208 if (CheckPresence(userInfo.UserProfile.ID))
183 { 209 {
184 InventoryArchiveReadRequest request = 210 InventoryArchiveReadRequest request;
185 new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream); 211
212 try
213 {
214 request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream);
215 }
216 catch (EntryPointNotFoundException e)
217 {
218 m_log.ErrorFormat(
219 "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
220 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
221 m_log.Error(e);
222
223 return false;
224 }
225
186 UpdateClientWithLoadedNodes(userInfo, request.Execute()); 226 UpdateClientWithLoadedNodes(userInfo, request.Execute());
187 227
188 return true; 228 return true;
@@ -209,8 +249,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
209 { 249 {
210 if (CheckPresence(userInfo.UserProfile.ID)) 250 if (CheckPresence(userInfo.UserProfile.ID))
211 { 251 {
212 InventoryArchiveReadRequest request = 252 InventoryArchiveReadRequest request;
213 new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath); 253
254 try
255 {
256 request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath);
257 }
258 catch (EntryPointNotFoundException e)
259 {
260 m_log.ErrorFormat(
261 "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
262 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
263 m_log.Error(e);
264
265 return false;
266 }
267
214 UpdateClientWithLoadedNodes(userInfo, request.Execute()); 268 UpdateClientWithLoadedNodes(userInfo, request.Execute());
215 269
216 return true; 270 return true;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
index 2f21e6d..50348da 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
@@ -224,7 +224,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
224 m_Cache.Cache(a); 224 m_Cache.Cache(a);
225 225
226// if (null == a) 226// if (null == a)
227// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id); 227// m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id);
228 228
229 Util.FireAndForget(delegate { handler(assetID, s, a); }); 229 Util.FireAndForget(delegate { handler(assetID, s, a); });
230 }); 230 });
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index 3883dc6..191e859 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -317,7 +317,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
317 item = m_InventoryService.GetItem(item); 317 item = m_InventoryService.GetItem(item);
318 318
319 if (null == item) 319 if (null == item)
320 m_log.ErrorFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}"); 320 m_log.ErrorFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find item with id {0}", item.ID);
321 321
322 return item; 322 return item;
323 } 323 }
diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
index 73f7ae3..e4fe352 100644
--- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
+++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
@@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.World
109 { 109 {
110 foreach (Scene s in m_SceneList) 110 foreach (Scene s in m_SceneList)
111 { 111 {
112 if(!ProcessCommand(s, cmd)) 112 if (!ProcessCommand(s, cmd))
113 break; 113 break;
114 } 114 }
115 } 115 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index c7c9778..e6d4549 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -73,7 +73,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver
73 public ArchiveReadRequest(Scene scene, string loadPath, bool merge, Guid requestId) 73 public ArchiveReadRequest(Scene scene, string loadPath, bool merge, Guid requestId)
74 { 74 {
75 m_scene = scene; 75 m_scene = scene;
76 m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress); 76
77 try
78 {
79 m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress);
80 }
81 catch (EntryPointNotFoundException e)
82 {
83 m_log.ErrorFormat(
84 "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
85 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
86 m_log.Error(e);
87 }
88
77 m_errorMessage = String.Empty; 89 m_errorMessage = String.Empty;
78 m_merge = merge; 90 m_merge = merge;
79 m_requestId = requestId; 91 m_requestId = requestId;
@@ -422,6 +434,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
422 currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; 434 currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4;
423 currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; 435 currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun;
424 currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; 436 currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight;
437
438 currentRegionSettings.Save();
425 439
426 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); 440 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>();
427 441
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index 71bfe57..b61b341 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -65,7 +65,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver
65 public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId) 65 public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId)
66 { 66 {
67 m_scene = scene; 67 m_scene = scene;
68 m_saveStream = new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress); 68
69 try
70 {
71 m_saveStream = new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress);
72 }
73 catch (EntryPointNotFoundException e)
74 {
75 m_log.ErrorFormat(
76 "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
77 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
78 m_log.Error(e);
79 }
80
69 m_requestId = requestId; 81 m_requestId = requestId;
70 } 82 }
71 83
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index c3e57f0..e77a23b 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
99 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); 99 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
100 Vector3 offsetPosition = new Vector3(5, 10, 15); 100 Vector3 offsetPosition = new Vector3(5, 10, 15);
101 101
102 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; 102 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
103 } 103 }
104 104
105 protected SceneObjectPart CreateSceneObjectPart2() 105 protected SceneObjectPart CreateSceneObjectPart2()
@@ -112,7 +112,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
112 Vector3 offsetPosition = new Vector3(20, 25, 30); 112 Vector3 offsetPosition = new Vector3(20, 25, 30);
113 113
114 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; 114 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
115 } 115 }
116 116
117 /// <summary> 117 /// <summary>
118 /// Test saving a V0.2 OpenSim Region Archive. 118 /// Test saving a V0.2 OpenSim Region Archive.
@@ -231,7 +231,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
231 foreach (string name in names) 231 foreach (string name in names)
232 { 232 {
233 if (name.EndsWith(".Resources.test-sound.wav")) 233 if (name.EndsWith(".Resources.test-sound.wav"))
234 soundDataResourceName = name; 234 soundDataResourceName = name;
235 } 235 }
236 Assert.That(soundDataResourceName, Is.Not.Null); 236 Assert.That(soundDataResourceName, Is.Not.Null);
237 237
@@ -259,7 +259,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
259 = new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid, Name = soundItemName }; 259 = new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid, Name = soundItemName };
260 part1.Inventory.AddInventoryItem(item1, true); 260 part1.Inventory.AddInventoryItem(item1, true);
261 } 261 }
262 } 262 }
263 263
264 m_scene.AddNewSceneObject(object1, false); 264 m_scene.AddNewSceneObject(object1, false);
265 265
@@ -306,15 +306,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
306 /// Test loading the region settings of a V0.2 OpenSim Region Archive. 306 /// Test loading the region settings of a V0.2 OpenSim Region Archive.
307 /// </summary> 307 /// </summary>
308 [Test] 308 [Test]
309 public void TestLoadOarV0_2RegionSettings() 309 public void TestLoadOarV0_2RegionSettings()
310 { 310 {
311 TestHelper.InMethod(); 311 TestHelper.InMethod();
312 //log4net.Config.XmlConfigurator.Configure(); 312 //log4net.Config.XmlConfigurator.Configure();
313 313
314 MemoryStream archiveWriteStream = new MemoryStream(); 314 MemoryStream archiveWriteStream = new MemoryStream();
315 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); 315 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
316 316
317 tar.WriteDir(ArchiveConstants.TERRAINS_PATH); 317 tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
318 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); 318 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
319 319
320 RegionSettings rs = new RegionSettings(); 320 RegionSettings rs = new RegionSettings();
@@ -329,11 +329,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
329 rs.DisablePhysics = true; 329 rs.DisablePhysics = true;
330 rs.DisableScripts = true; 330 rs.DisableScripts = true;
331 rs.Elevation1NW = 15.9; 331 rs.Elevation1NW = 15.9;
332 rs.Elevation1NE = 45.3; 332 rs.Elevation1NE = 45.3;
333 rs.Elevation1SE = 49; 333 rs.Elevation1SE = 49;
334 rs.Elevation1SW = 1.9; 334 rs.Elevation1SW = 1.9;
335 rs.Elevation2NW = 4.5; 335 rs.Elevation2NW = 4.5;
336 rs.Elevation2NE = 19.2; 336 rs.Elevation2NE = 19.2;
337 rs.Elevation2SE = 9.2; 337 rs.Elevation2SE = 9.2;
338 rs.Elevation2SW = 2.1; 338 rs.Elevation2SW = 2.1;
339 rs.FixedSun = true; 339 rs.FixedSun = true;
@@ -411,7 +411,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
411// Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90); 411// Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90);
412// Vector3 part2OffsetPosition = new Vector3(20, 25, 30); 412// Vector3 part2OffsetPosition = new Vector3(20, 25, 30);
413 413
414 SceneObjectPart part2 = CreateSceneObjectPart2(); 414 SceneObjectPart part2 = CreateSceneObjectPart2();
415 415
416 // Create an oar file that we can use for the merge 416 // Create an oar file that we can use for the merge
417 { 417 {
@@ -420,9 +420,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
420 TerrainModule terrainModule = new TerrainModule(); 420 TerrainModule terrainModule = new TerrainModule();
421 421
422 Scene scene = SceneSetupHelpers.SetupScene(); 422 Scene scene = SceneSetupHelpers.SetupScene();
423 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); 423 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
424 424
425 m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false); 425 m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
426 426
427 // Write out this scene 427 // Write out this scene
428 scene.EventManager.OnOarFileSaved += SaveCompleted; 428 scene.EventManager.OnOarFileSaved += SaveCompleted;
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
index 37f1f2e..1f5a4ff 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Region.CoreModules.World.Sound
60 } 60 }
61 61
62 public virtual void PlayAttachedSound( 62 public virtual void PlayAttachedSound(
63 UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags) 63 UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius)
64 { 64 {
65 foreach (ScenePresence p in m_scene.GetAvatars()) 65 foreach (ScenePresence p in m_scene.GetAvatars())
66 { 66 {
@@ -69,14 +69,17 @@ namespace OpenSim.Region.CoreModules.World.Sound
69 continue; 69 continue;
70 70
71 // Scale by distance 71 // Scale by distance
72 gain = (float)((double)gain*((100.0 - dis) / 100.0)); 72 if (radius == 0)
73 gain = (float)((double)gain * ((100.0 - dis) / 100.0));
74 else
75 gain = (float)((double)gain * ((radius - dis) / radius));
73 76
74 p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); 77 p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags);
75 } 78 }
76 } 79 }
77 80
78 public virtual void TriggerSound( 81 public virtual void TriggerSound(
79 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle) 82 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius)
80 { 83 {
81 foreach (ScenePresence p in m_scene.GetAvatars()) 84 foreach (ScenePresence p in m_scene.GetAvatars())
82 { 85 {
@@ -85,7 +88,10 @@ namespace OpenSim.Region.CoreModules.World.Sound
85 continue; 88 continue;
86 89
87 // Scale by distance 90 // Scale by distance
88 gain = (float)((double)gain*((100.0 - dis) / 100.0)); 91 if (radius == 0)
92 gain = (float)((double)gain * ((100.0 - dis) / 100.0));
93 else
94 gain = (float)((double)gain * ((radius - dis) / radius));
89 95
90 p.ControllingClient.SendTriggeredSound( 96 p.ControllingClient.SendTriggeredSound(
91 soundId, ownerID, objectID, parentID, handle, position, (float)gain); 97 soundId, ownerID, objectID, parentID, handle, position, (float)gain);
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index a40828b..1e7ea7b 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -84,6 +84,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
84 private ITerrainChannel m_revert; 84 private ITerrainChannel m_revert;
85 private Scene m_scene; 85 private Scene m_scene;
86 private volatile bool m_tainted; 86 private volatile bool m_tainted;
87 private readonly UndoStack<LandUndoState> m_undo = new UndoStack<LandUndoState>(5);
87 88
88 #region ICommandableModule Members 89 #region ICommandableModule Members
89 90
@@ -174,6 +175,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
174 175
175 #region ITerrainModule Members 176 #region ITerrainModule Members
176 177
178 public void UndoTerrain(ITerrainChannel channel)
179 {
180 m_channel = channel;
181 }
182
177 /// <summary> 183 /// <summary>
178 /// Loads a terrain file from disk and installs it in the scene. 184 /// Loads a terrain file from disk and installs it in the scene.
179 /// </summary> 185 /// </summary>
@@ -574,6 +580,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
574 { 580 {
575 client.OnModifyTerrain += client_OnModifyTerrain; 581 client.OnModifyTerrain += client_OnModifyTerrain;
576 client.OnBakeTerrain += client_OnBakeTerrain; 582 client.OnBakeTerrain += client_OnBakeTerrain;
583 client.OnLandUndo += client_OnLandUndo;
577 } 584 }
578 585
579 /// <summary> 586 /// <summary>
@@ -664,6 +671,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain
664 return changesLimited; 671 return changesLimited;
665 } 672 }
666 673
674 private void client_OnLandUndo(IClientAPI client)
675 {
676 lock (m_undo)
677 {
678 if (m_undo.Count > 0)
679 {
680 LandUndoState goback = m_undo.Pop();
681 if (goback != null)
682 goback.PlaybackState();
683 }
684 }
685 }
686
667 /// <summary> 687 /// <summary>
668 /// Sends a copy of the current terrain to the scenes clients 688 /// Sends a copy of the current terrain to the scenes clients
669 /// </summary> 689 /// </summary>
@@ -718,6 +738,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
718 } 738 }
719 if (allowed) 739 if (allowed)
720 { 740 {
741 StoreUndoState();
721 m_painteffects[(StandardTerrainEffects) action].PaintEffect( 742 m_painteffects[(StandardTerrainEffects) action].PaintEffect(
722 m_channel, allowMask, west, south, height, size, seconds); 743 m_channel, allowMask, west, south, height, size, seconds);
723 744
@@ -758,6 +779,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
758 779
759 if (allowed) 780 if (allowed)
760 { 781 {
782 StoreUndoState();
761 m_floodeffects[(StandardTerrainEffects) action].FloodEffect( 783 m_floodeffects[(StandardTerrainEffects) action].FloodEffect(
762 m_channel, fillArea, size); 784 m_channel, fillArea, size);
763 785
@@ -782,6 +804,25 @@ namespace OpenSim.Region.CoreModules.World.Terrain
782 } 804 }
783 } 805 }
784 806
807 private void StoreUndoState()
808 {
809 lock (m_undo)
810 {
811 if (m_undo.Count > 0)
812 {
813 LandUndoState last = m_undo.Peek();
814 if (last != null)
815 {
816 if (last.Compare(m_channel))
817 return;
818 }
819 }
820
821 LandUndoState nUndo = new LandUndoState(this, m_channel);
822 m_undo.Push(nUndo);
823 }
824 }
825
785 #region Console Commands 826 #region Console Commands
786 827
787 private void InterfaceLoadFile(Object[] args) 828 private void InterfaceLoadFile(Object[] args)