diff options
author | UbitUmarov | 2015-09-01 14:54:35 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-01 14:54:35 +0100 |
commit | 371c9dd2af01a2e7422ec901ee1f80757284a78c (patch) | |
tree | 058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Region/CoreModules/World | |
parent | remove lixo (diff) | |
parent | dont change camera on crossings (diff) | |
download | opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2 opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz |
bad merge?
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
41 files changed, 2628 insertions, 510 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 9c6706f..f0b0f4a 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -160,10 +160,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
160 | 160 | ||
161 | private IAssetService m_assetService = null; | 161 | private IAssetService m_assetService = null; |
162 | 162 | ||
163 | private UUID m_defaultUser; | ||
163 | 164 | ||
165 | <<<<<<< HEAD | ||
164 | private UUID m_defaultUser; | 166 | private UUID m_defaultUser; |
165 | 167 | ||
166 | public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string,object>options) | 168 | public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string,object>options) |
169 | ======= | ||
170 | public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string, object> options) | ||
171 | >>>>>>> avn/ubitvar | ||
167 | { | 172 | { |
168 | m_rootScene = scene; | 173 | m_rootScene = scene; |
169 | 174 | ||
@@ -172,7 +177,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
172 | m_defaultUser = (UUID)options["default-user"]; | 177 | m_defaultUser = (UUID)options["default-user"]; |
173 | m_log.InfoFormat("Using User {0} as default user", m_defaultUser.ToString()); | 178 | m_log.InfoFormat("Using User {0} as default user", m_defaultUser.ToString()); |
174 | } | 179 | } |
180 | <<<<<<< HEAD | ||
175 | else | 181 | else |
182 | ======= | ||
183 | else | ||
184 | >>>>>>> avn/ubitvar | ||
176 | { | 185 | { |
177 | m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner; | 186 | m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner; |
178 | } | 187 | } |
@@ -189,8 +198,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
189 | + "If you've manually installed Mono, have you appropriately updated zlib1g as well?"); | 198 | + "If you've manually installed Mono, have you appropriately updated zlib1g as well?"); |
190 | m_log.Error(e); | 199 | m_log.Error(e); |
191 | } | 200 | } |
192 | 201 | ||
193 | m_errorMessage = String.Empty; | 202 | m_errorMessage = String.Empty; |
203 | <<<<<<< HEAD | ||
204 | ======= | ||
205 | |||
206 | >>>>>>> avn/ubitvar | ||
194 | m_merge = options.ContainsKey("merge"); | 207 | m_merge = options.ContainsKey("merge"); |
195 | m_forceTerrain = options.ContainsKey("force-terrain"); | 208 | m_forceTerrain = options.ContainsKey("force-terrain"); |
196 | m_forceParcels = options.ContainsKey("force-parcels"); | 209 | m_forceParcels = options.ContainsKey("force-parcels"); |
@@ -199,18 +212,34 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
199 | m_requestId = requestId; | 212 | m_requestId = requestId; |
200 | m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero; | 213 | m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero; |
201 | m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f; | 214 | m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f; |
215 | <<<<<<< HEAD | ||
202 | m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"] | 216 | m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"] |
203 | : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f); | 217 | : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f); |
204 | 218 | ||
205 | // Zero can never be a valid user or group id | 219 | // Zero can never be a valid user or group id |
206 | m_validUserUuids[UUID.Zero] = false; | 220 | m_validUserUuids[UUID.Zero] = false; |
207 | m_validGroupUuids[UUID.Zero] = false; | 221 | m_validGroupUuids[UUID.Zero] = false; |
222 | ======= | ||
223 | m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"] | ||
224 | : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f); | ||
225 | |||
226 | m_requestId = requestId; | ||
227 | |||
228 | // Zero can never be a valid user id (or group) | ||
229 | m_validUserUuids[UUID.Zero] = false; | ||
230 | m_validGroupUuids[UUID.Zero] = false; | ||
231 | |||
232 | >>>>>>> avn/ubitvar | ||
208 | 233 | ||
209 | m_groupsModule = m_rootScene.RequestModuleInterface<IGroupsModule>(); | 234 | m_groupsModule = m_rootScene.RequestModuleInterface<IGroupsModule>(); |
210 | m_assetService = m_rootScene.AssetService; | 235 | m_assetService = m_rootScene.AssetService; |
211 | } | 236 | } |
212 | 237 | ||
238 | <<<<<<< HEAD | ||
213 | public ArchiveReadRequest(Scene scene, Stream loadStream, Guid requestId, Dictionary<string, object>options) | 239 | public ArchiveReadRequest(Scene scene, Stream loadStream, Guid requestId, Dictionary<string, object>options) |
240 | ======= | ||
241 | public ArchiveReadRequest(Scene scene, Stream loadStream, Guid requestId, Dictionary<string, object> options) | ||
242 | >>>>>>> avn/ubitvar | ||
214 | { | 243 | { |
215 | m_rootScene = scene; | 244 | m_rootScene = scene; |
216 | m_loadPath = null; | 245 | m_loadPath = null; |
@@ -220,7 +249,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
220 | m_requestId = requestId; | 249 | m_requestId = requestId; |
221 | 250 | ||
222 | m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner; | 251 | m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner; |
252 | <<<<<<< HEAD | ||
223 | 253 | ||
254 | ======= | ||
255 | |||
256 | >>>>>>> avn/ubitvar | ||
224 | // Zero can never be a valid user id | 257 | // Zero can never be a valid user id |
225 | m_validUserUuids[UUID.Zero] = false; | 258 | m_validUserUuids[UUID.Zero] = false; |
226 | 259 | ||
@@ -294,15 +327,24 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
294 | if ((successfulAssetRestores + failedAssetRestores) % 250 == 0) | 327 | if ((successfulAssetRestores + failedAssetRestores) % 250 == 0) |
295 | m_log.Debug("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets..."); | 328 | m_log.Debug("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets..."); |
296 | } | 329 | } |
330 | <<<<<<< HEAD | ||
297 | else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH) && (!m_merge || m_forceTerrain)) | 331 | else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH) && (!m_merge || m_forceTerrain)) |
332 | ======= | ||
333 | else if ((!m_merge || m_forceTerrain) && filePath.StartsWith(ArchiveConstants.TERRAINS_PATH)) | ||
334 | >>>>>>> avn/ubitvar | ||
298 | { | 335 | { |
299 | LoadTerrain(scene, filePath, data); | 336 | LoadTerrain(scene, filePath, data); |
300 | } | 337 | } |
301 | else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH)) | 338 | else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH)) |
302 | { | 339 | { |
303 | LoadRegionSettings(scene, filePath, data, dearchivedScenes); | 340 | LoadRegionSettings(scene, filePath, data, dearchivedScenes); |
341 | <<<<<<< HEAD | ||
304 | } | 342 | } |
305 | else if (filePath.StartsWith(ArchiveConstants.LANDDATA_PATH) && (!m_merge || m_forceParcels)) | 343 | else if (filePath.StartsWith(ArchiveConstants.LANDDATA_PATH) && (!m_merge || m_forceParcels)) |
344 | ======= | ||
345 | } | ||
346 | else if ((!m_merge || m_forceParcels) && filePath.StartsWith(ArchiveConstants.LANDDATA_PATH)) | ||
347 | >>>>>>> avn/ubitvar | ||
306 | { | 348 | { |
307 | sceneContext.SerialisedParcels.Add(Encoding.UTF8.GetString(data)); | 349 | sceneContext.SerialisedParcels.Add(Encoding.UTF8.GetString(data)); |
308 | } | 350 | } |
@@ -523,7 +565,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
523 | } | 565 | } |
524 | } | 566 | } |
525 | 567 | ||
568 | <<<<<<< HEAD | ||
526 | 569 | ||
570 | ======= | ||
571 | >>>>>>> avn/ubitvar | ||
527 | bool isTelehub = (sceneObject.UUID == oldTelehubUUID) && (oldTelehubUUID != UUID.Zero); | 572 | bool isTelehub = (sceneObject.UUID == oldTelehubUUID) && (oldTelehubUUID != UUID.Zero); |
528 | 573 | ||
529 | // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned | 574 | // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned |
@@ -540,6 +585,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
540 | } | 585 | } |
541 | 586 | ||
542 | ModifySceneObject(scene, sceneObject); | 587 | ModifySceneObject(scene, sceneObject); |
588 | <<<<<<< HEAD | ||
589 | ======= | ||
590 | |||
591 | >>>>>>> avn/ubitvar | ||
543 | 592 | ||
544 | if (scene.AddRestoredSceneObject(sceneObject, true, false)) | 593 | if (scene.AddRestoredSceneObject(sceneObject, true, false)) |
545 | { | 594 | { |
@@ -600,6 +649,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
600 | // being no copy/no mod for everyone | 649 | // being no copy/no mod for everyone |
601 | lock (part.TaskInventory) | 650 | lock (part.TaskInventory) |
602 | { | 651 | { |
652 | <<<<<<< HEAD | ||
653 | ======= | ||
654 | // And zap any troublesome sit target information | ||
655 | part.SitTargetOrientation = new Quaternion(0, 0, 0, 1); | ||
656 | part.SitTargetPosition = new Vector3(0, 0, 0); | ||
657 | |||
658 | // Fix ownership/creator of inventory items | ||
659 | // Not doing so results in inventory items | ||
660 | // being no copy/no mod for everyone | ||
661 | part.TaskInventory.LockItemsForRead(true); | ||
662 | >>>>>>> avn/ubitvar | ||
603 | TaskInventoryDictionary inv = part.TaskInventory; | 663 | TaskInventoryDictionary inv = part.TaskInventory; |
604 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) | 664 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) |
605 | { | 665 | { |
@@ -620,11 +680,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
620 | if (!ResolveGroupUuid(kvp.Value.GroupID)) | 680 | if (!ResolveGroupUuid(kvp.Value.GroupID)) |
621 | kvp.Value.GroupID = UUID.Zero; | 681 | kvp.Value.GroupID = UUID.Zero; |
622 | } | 682 | } |
683 | <<<<<<< HEAD | ||
684 | ======= | ||
685 | part.TaskInventory.LockItemsForRead(false); | ||
686 | >>>>>>> avn/ubitvar | ||
623 | } | 687 | } |
624 | } | 688 | } |
625 | } | 689 | } |
626 | 690 | ||
691 | <<<<<<< HEAD | ||
627 | 692 | ||
693 | ======= | ||
694 | >>>>>>> avn/ubitvar | ||
628 | /// <summary> | 695 | /// <summary> |
629 | /// Load serialized parcels. | 696 | /// Load serialized parcels. |
630 | /// </summary> | 697 | /// </summary> |
@@ -645,7 +712,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
645 | parcel.AABBMin += parcelDisp; | 712 | parcel.AABBMin += parcelDisp; |
646 | parcel.AABBMax += parcelDisp; | 713 | parcel.AABBMax += parcelDisp; |
647 | } | 714 | } |
715 | <<<<<<< HEAD | ||
648 | 716 | ||
717 | ======= | ||
718 | |||
719 | >>>>>>> avn/ubitvar | ||
649 | // Validate User and Group UUID's | 720 | // Validate User and Group UUID's |
650 | 721 | ||
651 | if (!ResolveGroupUuid(parcel.GroupID)) | 722 | if (!ResolveGroupUuid(parcel.GroupID)) |
@@ -660,14 +731,26 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
660 | } | 731 | } |
661 | else | 732 | else |
662 | { | 733 | { |
734 | <<<<<<< HEAD | ||
663 | parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner; | 735 | parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner; |
736 | ======= | ||
737 | parcel.OwnerID = m_defaultUser; | ||
738 | parcel.GroupID = UUID.Zero; | ||
739 | >>>>>>> avn/ubitvar | ||
664 | parcel.IsGroupOwned = false; | 740 | parcel.IsGroupOwned = false; |
665 | } | 741 | } |
666 | } | 742 | } |
667 | else | 743 | else |
668 | { | 744 | { |
669 | if (!ResolveUserUuid(scene, parcel.OwnerID)) | 745 | if (!ResolveUserUuid(scene, parcel.OwnerID)) |
746 | <<<<<<< HEAD | ||
670 | parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner; | 747 | parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner; |
748 | ======= | ||
749 | parcel.OwnerID = m_defaultUser; | ||
750 | |||
751 | if (!ResolveGroupUuid(parcel.GroupID)) | ||
752 | parcel.GroupID = UUID.Zero; | ||
753 | >>>>>>> avn/ubitvar | ||
671 | } | 754 | } |
672 | 755 | ||
673 | List<LandAccessEntry> accessList = new List<LandAccessEntry>(); | 756 | List<LandAccessEntry> accessList = new List<LandAccessEntry>(); |
@@ -796,7 +879,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
796 | if (data == null) | 879 | if (data == null) |
797 | return false; | 880 | return false; |
798 | } | 881 | } |
882 | <<<<<<< HEAD | ||
799 | 883 | ||
884 | ======= | ||
885 | >>>>>>> avn/ubitvar | ||
800 | //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); | 886 | //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); |
801 | 887 | ||
802 | AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType, UUID.Zero.ToString()); | 888 | AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType, UUID.Zero.ToString()); |
@@ -918,7 +1004,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
918 | private bool LoadTerrain(Scene scene, string terrainPath, byte[] data) | 1004 | private bool LoadTerrain(Scene scene, string terrainPath, byte[] data) |
919 | { | 1005 | { |
920 | ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>(); | 1006 | ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>(); |
1007 | <<<<<<< HEAD | ||
921 | 1008 | ||
1009 | ======= | ||
1010 | |||
1011 | >>>>>>> avn/ubitvar | ||
922 | using (MemoryStream ms = new MemoryStream(data)) | 1012 | using (MemoryStream ms = new MemoryStream(data)) |
923 | { | 1013 | { |
924 | if (m_displacement != Vector3.Zero || m_rotation != 0f) | 1014 | if (m_displacement != Vector3.Zero || m_rotation != 0f) |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 6a09caf..0fb8a32 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | |||
@@ -111,6 +111,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
111 | String defaultUser = ""; | 111 | String defaultUser = ""; |
112 | float rotation = 0f; | 112 | float rotation = 0f; |
113 | Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); | 113 | Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); |
114 | <<<<<<< HEAD | ||
114 | 115 | ||
115 | OptionSet options = new OptionSet(); | 116 | OptionSet options = new OptionSet(); |
116 | options.Add("m|merge", delegate (string v) { mergeOar = (v != null); }); | 117 | options.Add("m|merge", delegate (string v) { mergeOar = (v != null); }); |
@@ -122,6 +123,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
122 | options.Add("no-objects", delegate (string v) { noObjects = (v != null); }); | 123 | options.Add("no-objects", delegate (string v) { noObjects = (v != null); }); |
123 | options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; }); | 124 | options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; }); |
124 | options.Add("displacement=", delegate (string v) { | 125 | options.Add("displacement=", delegate (string v) { |
126 | ======= | ||
127 | |||
128 | OptionSet options = new OptionSet(); | ||
129 | options.Add("m|merge", delegate(string v) { mergeOar = (v != null); }); | ||
130 | options.Add("s|skip-assets", delegate(string v) { skipAssets = (v != null); }); | ||
131 | options.Add("force-terrain", delegate(string v) { forceTerrain = (v != null); }); | ||
132 | options.Add("forceterrain", delegate(string v) { forceTerrain = (v != null); }); // downward compatibility | ||
133 | options.Add("force-parcels", delegate(string v) { forceParcels = (v != null); }); | ||
134 | options.Add("forceparcels", delegate(string v) { forceParcels = (v != null); }); // downward compatibility | ||
135 | options.Add("no-objects", delegate(string v) { noObjects = (v != null); }); | ||
136 | options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; }); | ||
137 | options.Add("displacement=", delegate(string v) | ||
138 | { | ||
139 | >>>>>>> avn/ubitvar | ||
125 | try | 140 | try |
126 | { | 141 | { |
127 | displacement = v == null ? Vector3.Zero : Vector3.Parse(v); | 142 | displacement = v == null ? Vector3.Zero : Vector3.Parse(v); |
@@ -148,7 +163,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
148 | // Convert to radians for internals | 163 | // Convert to radians for internals |
149 | rotation = Util.Clamp<float>(rotation, -359f, 359f) / 180f * (float)Math.PI; | 164 | rotation = Util.Clamp<float>(rotation, -359f, 359f) / 180f * (float)Math.PI; |
150 | }); | 165 | }); |
166 | <<<<<<< HEAD | ||
151 | options.Add("rotation-center=", delegate (string v) { | 167 | options.Add("rotation-center=", delegate (string v) { |
168 | ======= | ||
169 | options.Add("rotation-center=", delegate(string v) | ||
170 | { | ||
171 | >>>>>>> avn/ubitvar | ||
152 | try | 172 | try |
153 | { | 173 | { |
154 | rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v); | 174 | rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v); |
@@ -288,12 +308,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
288 | Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); | 308 | Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); |
289 | DearchiveRegion(loadPath, Guid.Empty, archiveOptions); | 309 | DearchiveRegion(loadPath, Guid.Empty, archiveOptions); |
290 | } | 310 | } |
311 | <<<<<<< HEAD | ||
291 | 312 | ||
292 | public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string,object> options) | 313 | public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string,object> options) |
293 | { | 314 | { |
294 | m_log.InfoFormat( | 315 | m_log.InfoFormat( |
295 | "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath); | 316 | "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath); |
296 | 317 | ||
318 | ======= | ||
319 | |||
320 | public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string, object> options) | ||
321 | { | ||
322 | m_log.InfoFormat( | ||
323 | "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath); | ||
324 | |||
325 | >>>>>>> avn/ubitvar | ||
297 | new ArchiveReadRequest(Scene, loadPath, requestId, options).DearchiveRegion(); | 326 | new ArchiveReadRequest(Scene, loadPath, requestId, options).DearchiveRegion(); |
298 | } | 327 | } |
299 | 328 | ||
@@ -302,7 +331,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
302 | Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); | 331 | Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); |
303 | DearchiveRegion(loadStream, Guid.Empty, archiveOptions); | 332 | DearchiveRegion(loadStream, Guid.Empty, archiveOptions); |
304 | } | 333 | } |
334 | <<<<<<< HEAD | ||
305 | 335 | ||
336 | ======= | ||
337 | |||
338 | >>>>>>> avn/ubitvar | ||
306 | public void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options) | 339 | public void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options) |
307 | { | 340 | { |
308 | new ArchiveReadRequest(Scene, loadStream, requestId, options).DearchiveRegion(); | 341 | new ArchiveReadRequest(Scene, loadStream, requestId, options).DearchiveRegion(); |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index db66c83..895b55d 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | |||
@@ -271,18 +271,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
271 | 271 | ||
272 | if (asset != null) | 272 | if (asset != null) |
273 | { | 273 | { |
274 | if (m_options.ContainsKey("verbose")) | 274 | // m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id); |
275 | m_log.InfoFormat("[ARCHIVER]: Writing asset {0}", id); | ||
276 | |||
277 | m_foundAssetUuids.Add(asset.FullID); | 275 | m_foundAssetUuids.Add(asset.FullID); |
278 | 276 | ||
279 | m_assetsArchiver.WriteAsset(PostProcess(asset)); | 277 | m_assetsArchiver.WriteAsset(PostProcess(asset)); |
280 | } | 278 | } |
281 | else | 279 | else |
282 | { | 280 | { |
283 | if (m_options.ContainsKey("verbose")) | 281 | // m_log.DebugFormat("[ARCHIVER]: Recording asset {0} as not found", id); |
284 | m_log.InfoFormat("[ARCHIVER]: Recording asset {0} as not found", id); | ||
285 | |||
286 | m_notFoundAssetUuids.Add(new UUID(id)); | 282 | m_notFoundAssetUuids.Add(new UUID(id)); |
287 | } | 283 | } |
288 | 284 | ||
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 80fa08a..e6e6485 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -95,6 +95,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
95 | 95 | ||
96 | m_commands = new EstateManagementCommands(this); | 96 | m_commands = new EstateManagementCommands(this); |
97 | m_commands.Initialise(); | 97 | m_commands.Initialise(); |
98 | |||
99 | m_regionChangeTimer.Interval = 10000; | ||
100 | m_regionChangeTimer.Elapsed += RaiseRegionInfoChange; | ||
101 | m_regionChangeTimer.AutoReset = false; | ||
98 | } | 102 | } |
99 | 103 | ||
100 | public void RemoveRegion(Scene scene) {} | 104 | public void RemoveRegion(Scene scene) {} |
@@ -587,6 +591,16 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
587 | IRestartModule restartModule = Scene.RequestModuleInterface<IRestartModule>(); | 591 | IRestartModule restartModule = Scene.RequestModuleInterface<IRestartModule>(); |
588 | if (restartModule != null) | 592 | if (restartModule != null) |
589 | { | 593 | { |
594 | if (timeInSeconds == -1) | ||
595 | { | ||
596 | m_delayCount++; | ||
597 | if (m_delayCount > 3) | ||
598 | return; | ||
599 | |||
600 | restartModule.DelayRestart(3600, "Restart delayed by region manager"); | ||
601 | return; | ||
602 | } | ||
603 | |||
590 | List<int> times = new List<int>(); | 604 | List<int> times = new List<int>(); |
591 | while (timeInSeconds > 0) | 605 | while (timeInSeconds > 0) |
592 | { | 606 | { |
@@ -1477,7 +1491,68 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1477 | sendRegionHandshake(client); | 1491 | sendRegionHandshake(client); |
1478 | } | 1492 | } |
1479 | 1493 | ||
1494 | <<<<<<< HEAD | ||
1480 | private uint GetEstateFlags() | 1495 | private uint GetEstateFlags() |
1496 | ======= | ||
1497 | public uint GetRegionFlags() | ||
1498 | { | ||
1499 | RegionFlags flags = RegionFlags.None; | ||
1500 | |||
1501 | // Fully implemented | ||
1502 | // | ||
1503 | if (Scene.RegionInfo.RegionSettings.AllowDamage) | ||
1504 | flags |= RegionFlags.AllowDamage; | ||
1505 | if (Scene.RegionInfo.RegionSettings.BlockTerraform) | ||
1506 | flags |= RegionFlags.BlockTerraform; | ||
1507 | if (!Scene.RegionInfo.RegionSettings.AllowLandResell) | ||
1508 | flags |= RegionFlags.BlockLandResell; | ||
1509 | if (Scene.RegionInfo.RegionSettings.DisableCollisions) | ||
1510 | flags |= RegionFlags.SkipCollisions; | ||
1511 | if (Scene.RegionInfo.RegionSettings.DisableScripts) | ||
1512 | flags |= RegionFlags.SkipScripts; | ||
1513 | if (Scene.RegionInfo.RegionSettings.DisablePhysics) | ||
1514 | flags |= RegionFlags.SkipPhysics; | ||
1515 | if (Scene.RegionInfo.RegionSettings.BlockFly) | ||
1516 | flags |= RegionFlags.NoFly; | ||
1517 | if (Scene.RegionInfo.RegionSettings.RestrictPushing) | ||
1518 | flags |= RegionFlags.RestrictPushObject; | ||
1519 | if (Scene.RegionInfo.RegionSettings.AllowLandJoinDivide) | ||
1520 | flags |= RegionFlags.AllowParcelChanges; | ||
1521 | if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) | ||
1522 | flags |= RegionFlags.BlockParcelSearch; | ||
1523 | if (Scene.RegionInfo.RegionSettings.GodBlockSearch) | ||
1524 | flags |= (RegionFlags)(1 << 11); | ||
1525 | if (Scene.RegionInfo.RegionSettings.Casino) | ||
1526 | flags |= (RegionFlags)(1 << 10); | ||
1527 | |||
1528 | if (Scene.RegionInfo.RegionSettings.FixedSun) | ||
1529 | flags |= RegionFlags.SunFixed; | ||
1530 | if (Scene.RegionInfo.RegionSettings.Sandbox) | ||
1531 | flags |= RegionFlags.Sandbox; | ||
1532 | if (Scene.RegionInfo.EstateSettings.AllowVoice) | ||
1533 | flags |= RegionFlags.AllowVoice; | ||
1534 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
1535 | flags |= RegionFlags.AllowLandmark; | ||
1536 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
1537 | flags |= RegionFlags.AllowSetHome; | ||
1538 | if (Scene.RegionInfo.EstateSettings.BlockDwell) | ||
1539 | flags |= RegionFlags.BlockDwell; | ||
1540 | if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) | ||
1541 | flags |= RegionFlags.ResetHomeOnTeleport; | ||
1542 | |||
1543 | |||
1544 | // TODO: SkipUpdateInterestList | ||
1545 | |||
1546 | // Omitted | ||
1547 | // | ||
1548 | // Omitted: NullLayer (what is that?) | ||
1549 | // Omitted: SkipAgentAction (what does it do?) | ||
1550 | |||
1551 | return (uint)flags; | ||
1552 | } | ||
1553 | |||
1554 | public uint GetEstateFlags() | ||
1555 | >>>>>>> avn/ubitvar | ||
1481 | { | 1556 | { |
1482 | RegionFlags flags = RegionFlags.None; | 1557 | RegionFlags flags = RegionFlags.None; |
1483 | 1558 | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index 73c592d..378826d 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs | |||
@@ -40,23 +40,33 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
40 | //Land types set with flags in ParcelOverlay. | 40 | //Land types set with flags in ParcelOverlay. |
41 | //Only one of these can be used. | 41 | //Only one of these can be used. |
42 | public const float BAN_LINE_SAFETY_HIEGHT = 100; | 42 | public const float BAN_LINE_SAFETY_HIEGHT = 100; |
43 | public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = 128; //Equals 10000000 | ||
44 | public const byte LAND_FLAG_PROPERTY_BORDER_WEST = 64; //Equals 01000000 | ||
45 | 43 | ||
46 | //RequestResults (I think these are right, they seem to work): | 44 | //RequestResults (I think these are right, they seem to work): |
47 | public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land | 45 | public const int LAND_RESULT_MULTIPLE = 1; // The request they made contained more than a single peice of land |
48 | public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land | 46 | public const int LAND_RESULT_SINGLE = 0; // The request they made contained only a single piece of land |
49 | 47 | ||
50 | //ParcelSelectObjects | 48 | //ParcelSelectObjects |
49 | public const int LAND_SELECT_OBJECTS_OWNER = 2; | ||
51 | public const int LAND_SELECT_OBJECTS_GROUP = 4; | 50 | public const int LAND_SELECT_OBJECTS_GROUP = 4; |
52 | public const int LAND_SELECT_OBJECTS_OTHER = 8; | 51 | public const int LAND_SELECT_OBJECTS_OTHER = 8; |
53 | public const int LAND_SELECT_OBJECTS_OWNER = 2; | 52 | |
54 | public const byte LAND_TYPE_IS_BEING_AUCTIONED = 5; //Equals 00000101 | 53 | |
55 | public const byte LAND_TYPE_IS_FOR_SALE = 4; //Equals 00000100 | 54 | public const byte LAND_TYPE_PUBLIC = 0; //Equals 00000000 |
56 | public const byte LAND_TYPE_OWNED_BY_GROUP = 2; //Equals 00000010 | 55 | // types 1 to 7 are exclusive |
57 | public const byte LAND_TYPE_OWNED_BY_OTHER = 1; //Equals 00000001 | 56 | public const byte LAND_TYPE_OWNED_BY_OTHER = 1; //Equals 00000001 |
57 | public const byte LAND_TYPE_OWNED_BY_GROUP = 2; //Equals 00000010 | ||
58 | public const byte LAND_TYPE_OWNED_BY_REQUESTER = 3; //Equals 00000011 | 58 | public const byte LAND_TYPE_OWNED_BY_REQUESTER = 3; //Equals 00000011 |
59 | public const byte LAND_TYPE_PUBLIC = 0; //Equals 00000000 | 59 | public const byte LAND_TYPE_IS_FOR_SALE = 4; //Equals 00000100 |
60 | public const byte LAND_TYPE_IS_BEING_AUCTIONED = 5; //Equals 00000101 | ||
61 | public const byte LAND_TYPE_unused6 = 6; | ||
62 | public const byte LAND_TYPE_unused7 = 7; | ||
63 | // next are flags | ||
64 | public const byte LAND_FLAG_unused8 = 0x08; // this may become excluside in future | ||
65 | public const byte LAND_FLAG_HIDEAVATARS = 0x10; | ||
66 | public const byte LAND_FLAG_LOCALSOUND = 0x20; | ||
67 | public const byte LAND_FLAG_PROPERTY_BORDER_WEST = 0x40; //Equals 01000000 | ||
68 | public const byte LAND_FLAG_PROPERTY_BORDER_SOUTH = 0x80; //Equals 10000000 | ||
69 | |||
60 | 70 | ||
61 | //These are other constants. Yay! | 71 | //These are other constants. Yay! |
62 | public const int START_LAND_LOCAL_ID = 1; | 72 | public const int START_LAND_LOCAL_ID = 1; |
@@ -203,7 +213,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
203 | m_landManagementModule.setParcelOtherCleanTime(remoteClient, localID, otherCleanTime); | 213 | m_landManagementModule.setParcelOtherCleanTime(remoteClient, localID, otherCleanTime); |
204 | } | 214 | } |
205 | } | 215 | } |
206 | 216 | public void sendClientInitialLandInfo(IClientAPI remoteClient) | |
217 | { | ||
218 | if (m_landManagementModule != null) | ||
219 | { | ||
220 | m_landManagementModule.sendClientInitialLandInfo(remoteClient); | ||
221 | } | ||
222 | } | ||
207 | #endregion | 223 | #endregion |
208 | } | 224 | } |
209 | } | 225 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 25e1454..8bd46f6 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -69,7 +69,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
69 | /// <summary> | 69 | /// <summary> |
70 | /// Minimum land unit size in region co-ordinates. | 70 | /// Minimum land unit size in region co-ordinates. |
71 | /// </summary> | 71 | /// </summary> |
72 | <<<<<<< HEAD | ||
72 | public const int LandUnit = 4; | 73 | public const int LandUnit = 4; |
74 | ======= | ||
75 | public const int landUnit = 4; | ||
76 | >>>>>>> avn/ubitvar | ||
73 | 77 | ||
74 | private static readonly string remoteParcelRequestPath = "0009/"; | 78 | private static readonly string remoteParcelRequestPath = "0009/"; |
75 | 79 | ||
@@ -89,20 +93,30 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
89 | /// <value> | 93 | /// <value> |
90 | /// Land objects keyed by local id | 94 | /// Land objects keyed by local id |
91 | /// </value> | 95 | /// </value> |
92 | private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); | 96 | // private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); |
97 | |||
98 | //ubit: removed the readonly so i can move it around | ||
99 | private Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); | ||
93 | 100 | ||
94 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 101 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
95 | 102 | ||
96 | private bool m_allowedForcefulBans = true; | 103 | private bool m_allowedForcefulBans = true; |
104 | private UUID DefaultGodParcelGroup; | ||
105 | private string DefaultGodParcelName; | ||
97 | 106 | ||
98 | // caches ExtendedLandData | 107 | // caches ExtendedLandData |
99 | private Cache parcelInfoCache; | 108 | private Cache parcelInfoCache; |
109 | <<<<<<< HEAD | ||
100 | 110 | ||
101 | 111 | ||
102 | /// <summary> | 112 | /// <summary> |
103 | /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. | 113 | /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. |
104 | /// </summary> | 114 | /// </summary> |
105 | private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>(); | 115 | private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>(); |
116 | ======= | ||
117 | private Dictionary<UUID, Vector3> forcedPosition = | ||
118 | new Dictionary<UUID, Vector3>(); | ||
119 | >>>>>>> avn/ubitvar | ||
106 | 120 | ||
107 | // Enables limiting parcel layer info transmission when doing simple updates | 121 | // Enables limiting parcel layer info transmission when doing simple updates |
108 | private bool shouldLimitParcelLayerInfoToViewDistance { get; set; } | 122 | private bool shouldLimitParcelLayerInfoToViewDistance { get; set; } |
@@ -118,6 +132,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
118 | 132 | ||
119 | public void Initialise(IConfigSource source) | 133 | public void Initialise(IConfigSource source) |
120 | { | 134 | { |
135 | <<<<<<< HEAD | ||
121 | shouldLimitParcelLayerInfoToViewDistance = true; | 136 | shouldLimitParcelLayerInfoToViewDistance = true; |
122 | parcelLayerViewDistance = 128; | 137 | parcelLayerViewDistance = 128; |
123 | IConfig landManagementConfig = source.Configs["LandManagement"]; | 138 | IConfig landManagementConfig = source.Configs["LandManagement"]; |
@@ -125,13 +140,24 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
125 | { | 140 | { |
126 | shouldLimitParcelLayerInfoToViewDistance = landManagementConfig.GetBoolean("LimitParcelLayerUpdateDistance", shouldLimitParcelLayerInfoToViewDistance); | 141 | shouldLimitParcelLayerInfoToViewDistance = landManagementConfig.GetBoolean("LimitParcelLayerUpdateDistance", shouldLimitParcelLayerInfoToViewDistance); |
127 | parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance); | 142 | parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance); |
143 | ======= | ||
144 | IConfig cnf = source.Configs["LandManagement"]; | ||
145 | if (cnf != null) | ||
146 | { | ||
147 | DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); | ||
148 | DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel"); | ||
149 | >>>>>>> avn/ubitvar | ||
128 | } | 150 | } |
129 | } | 151 | } |
130 | 152 | ||
131 | public void AddRegion(Scene scene) | 153 | public void AddRegion(Scene scene) |
132 | { | 154 | { |
133 | m_scene = scene; | 155 | m_scene = scene; |
156 | <<<<<<< HEAD | ||
134 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; | 157 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; |
158 | ======= | ||
159 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; | ||
160 | >>>>>>> avn/ubitvar | ||
135 | landChannel = new LandChannel(scene, this); | 161 | landChannel = new LandChannel(scene, this); |
136 | 162 | ||
137 | parcelInfoCache = new Cache(); | 163 | parcelInfoCache = new Cache(); |
@@ -154,7 +180,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
154 | m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage; | 180 | m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage; |
155 | m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; | 181 | m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; |
156 | m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; | 182 | m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; |
157 | 183 | ||
158 | lock (m_scene) | 184 | lock (m_scene) |
159 | { | 185 | { |
160 | m_scene.LandChannel = (ILandChannel)landChannel; | 186 | m_scene.LandChannel = (ILandChannel)landChannel; |
@@ -204,13 +230,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
204 | client.OnParcelFreezeUser += ClientOnParcelFreezeUser; | 230 | client.OnParcelFreezeUser += ClientOnParcelFreezeUser; |
205 | client.OnSetStartLocationRequest += ClientOnSetHome; | 231 | client.OnSetStartLocationRequest += ClientOnSetHome; |
206 | 232 | ||
207 | 233 | /* avatar is still a child here position is unknown | |
208 | EntityBase presenceEntity; | 234 | EntityBase presenceEntity; |
209 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) | 235 | if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) |
210 | { | 236 | { |
211 | SendLandUpdate((ScenePresence)presenceEntity, true); | 237 | SendLandUpdate((ScenePresence)presenceEntity, true); |
212 | SendParcelOverlay(client); | 238 | SendParcelOverlay(client); |
213 | } | 239 | } |
240 | */ | ||
214 | } | 241 | } |
215 | 242 | ||
216 | public void EventMakeChildAgent(ScenePresence avatar) | 243 | public void EventMakeChildAgent(ScenePresence avatar) |
@@ -220,48 +247,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
220 | 247 | ||
221 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | 248 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) |
222 | { | 249 | { |
223 | //If we are forcing a position for them to go | ||
224 | if (forcedPosition.ContainsKey(remoteClient.AgentId)) | ||
225 | { | ||
226 | ScenePresence clientAvatar = m_scene.GetScenePresence(remoteClient.AgentId); | ||
227 | |||
228 | //Putting the user into flying, both keeps the avatar in fligth when it bumps into something and stopped from going another direction AND | ||
229 | //When the avatar walks into a ban line on the ground, it prevents getting stuck | ||
230 | agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
231 | |||
232 | //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines | ||
233 | if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2) | ||
234 | { | ||
235 | // m_log.DebugFormat( | ||
236 | // "[LAND MANAGEMENT MODULE]: Stopping force position of {0} because {1} is close enough to {2}", | ||
237 | // clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]); | ||
238 | |||
239 | forcedPosition.Remove(remoteClient.AgentId); | ||
240 | } | ||
241 | //if we are far away, teleport | ||
242 | else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3) | ||
243 | { | ||
244 | Vector3 forcePosition = forcedPosition[remoteClient.AgentId]; | ||
245 | // m_log.DebugFormat( | ||
246 | // "[LAND MANAGEMENT MODULE]: Teleporting out {0} because {1} is too far from avatar position {2}", | ||
247 | // clientAvatar.Name, clientAvatar.AbsolutePosition, forcePosition); | ||
248 | |||
249 | m_scene.RequestTeleportLocation(remoteClient, m_scene.RegionInfo.RegionHandle, | ||
250 | forcePosition, clientAvatar.Lookat, (uint)Constants.TeleportFlags.ForceRedirect); | ||
251 | |||
252 | forcedPosition.Remove(remoteClient.AgentId); | ||
253 | } | ||
254 | else | ||
255 | { | ||
256 | // m_log.DebugFormat( | ||
257 | // "[LAND MANAGEMENT MODULE]: Forcing {0} from {1} to {2}", | ||
258 | // clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]); | ||
259 | |||
260 | //Forces them toward the forced position we want if they aren't there yet | ||
261 | agentData.UseClientAgentPosition = true; | ||
262 | agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId]; | ||
263 | } | ||
264 | } | ||
265 | } | 250 | } |
266 | 251 | ||
267 | public void Close() | 252 | public void Close() |
@@ -314,7 +299,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
314 | { | 299 | { |
315 | m_landList.Clear(); | 300 | m_landList.Clear(); |
316 | m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 301 | m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
302 | <<<<<<< HEAD | ||
317 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; | 303 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; |
304 | ======= | ||
305 | m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit]; | ||
306 | >>>>>>> avn/ubitvar | ||
318 | } | 307 | } |
319 | } | 308 | } |
320 | 309 | ||
@@ -324,16 +313,22 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
324 | /// <returns>The parcel created.</returns> | 313 | /// <returns>The parcel created.</returns> |
325 | protected ILandObject CreateDefaultParcel() | 314 | protected ILandObject CreateDefaultParcel() |
326 | { | 315 | { |
316 | <<<<<<< HEAD | ||
327 | m_log.DebugFormat( | 317 | m_log.DebugFormat( |
328 | "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); | 318 | "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); |
329 | 319 | ||
330 | ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); | 320 | ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); |
321 | ======= | ||
322 | m_log.DebugFormat("{0} Creating default parcel for region {1}", LogHeader, m_scene.RegionInfo.RegionName); | ||
323 | |||
324 | ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); | ||
325 | >>>>>>> avn/ubitvar | ||
331 | fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, | 326 | fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, |
332 | (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY)); | 327 | (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY)); |
333 | fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 328 | fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
334 | fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); | 329 | fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); |
335 | 330 | ||
336 | return AddLandObject(fullSimParcel); | 331 | return AddLandObject(fullSimParcel); |
337 | } | 332 | } |
338 | 333 | ||
339 | public List<ILandObject> AllParcels() | 334 | public List<ILandObject> AllParcels() |
@@ -382,10 +377,17 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
382 | private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) | 377 | private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) |
383 | { | 378 | { |
384 | if (m_scene.Permissions.IsGod(avatar.UUID)) return; | 379 | if (m_scene.Permissions.IsGod(avatar.UUID)) return; |
385 | if (position.HasValue) | 380 | |
386 | { | 381 | if (!position.HasValue) |
387 | forcedPosition[avatar.ControllingClient.AgentId] = (Vector3)position; | 382 | return; |
388 | } | 383 | |
384 | // land should have no word on avatar physics | ||
385 | // bool isFlying = avatar.PhysicsActor.Flying; | ||
386 | // avatar.RemoveFromPhysicalScene(); | ||
387 | |||
388 | avatar.AbsolutePosition = (Vector3)position; | ||
389 | |||
390 | // avatar.AddToPhysicalScene(isFlying); | ||
389 | } | 391 | } |
390 | 392 | ||
391 | public void SendYouAreRestrictedNotice(ScenePresence avatar) | 393 | public void SendYouAreRestrictedNotice(ScenePresence avatar) |
@@ -405,36 +407,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
405 | } | 407 | } |
406 | 408 | ||
407 | if (parcelAvatarIsEntering != null) | 409 | if (parcelAvatarIsEntering != null) |
408 | { | 410 | EnforceBans(parcelAvatarIsEntering, avatar); |
409 | if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) | ||
410 | { | ||
411 | if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) | ||
412 | { | ||
413 | SendYouAreBannedNotice(avatar); | ||
414 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); | ||
415 | } | ||
416 | else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID)) | ||
417 | { | ||
418 | SendYouAreRestrictedNotice(avatar); | ||
419 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); | ||
420 | } | ||
421 | else | ||
422 | { | ||
423 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; | ||
424 | } | ||
425 | } | ||
426 | else | ||
427 | { | ||
428 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; | ||
429 | } | ||
430 | } | ||
431 | } | 411 | } |
432 | } | 412 | } |
433 | 413 | ||
434 | public void SendOutNearestBanLine(IClientAPI client) | 414 | public void SendOutNearestBanLine(IClientAPI client) |
435 | { | 415 | { |
436 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); | 416 | ScenePresence sp = m_scene.GetScenePresence(client.AgentId); |
437 | if (sp == null || sp.IsChildAgent) | 417 | if (sp == null) |
438 | return; | 418 | return; |
439 | 419 | ||
440 | List<ILandObject> checkLandParcels = ParcelsNearPoint(sp.AbsolutePosition); | 420 | List<ILandObject> checkLandParcels = ParcelsNearPoint(sp.AbsolutePosition); |
@@ -454,32 +434,49 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
454 | return; | 434 | return; |
455 | } | 435 | } |
456 | 436 | ||
437 | public void sendClientInitialLandInfo(IClientAPI remoteClient) | ||
438 | { | ||
439 | ScenePresence avatar; | ||
440 | |||
441 | if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out avatar)) | ||
442 | return; | ||
443 | |||
444 | |||
445 | if (!avatar.IsChildAgent) | ||
446 | { | ||
447 | ILandObject over = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | ||
448 | if (over == null) | ||
449 | return; | ||
450 | |||
451 | avatar.currentParcelUUID = over.LandData.GlobalID; | ||
452 | over.SendLandUpdateToClient(avatar.ControllingClient); | ||
453 | } | ||
454 | SendParcelOverlay(remoteClient); | ||
455 | } | ||
456 | |||
457 | public void SendLandUpdate(ScenePresence avatar, bool force) | 457 | public void SendLandUpdate(ScenePresence avatar, bool force) |
458 | { | 458 | { |
459 | <<<<<<< HEAD | ||
459 | ILandObject over = GetLandObject((int)Math.Min(((int)m_scene.RegionInfo.RegionSizeX - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), | 460 | ILandObject over = GetLandObject((int)Math.Min(((int)m_scene.RegionInfo.RegionSizeX - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), |
460 | (int)Math.Min(((int)m_scene.RegionInfo.RegionSizeY - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); | 461 | (int)Math.Min(((int)m_scene.RegionInfo.RegionSizeY - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); |
462 | ======= | ||
463 | if (avatar.IsChildAgent) | ||
464 | return; | ||
465 | |||
466 | ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | ||
467 | >>>>>>> avn/ubitvar | ||
461 | 468 | ||
462 | if (over != null) | 469 | if (over != null) |
463 | { | 470 | { |
464 | if (force) | 471 | bool NotsameID = (avatar.currentParcelUUID != over.LandData.GlobalID); |
472 | if (force || NotsameID) | ||
465 | { | 473 | { |
466 | if (!avatar.IsChildAgent) | 474 | over.SendLandUpdateToClient(avatar.ControllingClient); |
467 | { | 475 | // sl doesnt seem to send this now, as it used 2 |
468 | over.SendLandUpdateToClient(avatar.ControllingClient); | 476 | // SendParcelOverlay(avatar.ControllingClient); |
469 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, | 477 | avatar.currentParcelUUID = over.LandData.GlobalID; |
470 | m_scene.RegionInfo.RegionID); | 478 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, |
471 | } | 479 | m_scene.RegionInfo.RegionID); |
472 | } | ||
473 | |||
474 | if (avatar.currentParcelUUID != over.LandData.GlobalID) | ||
475 | { | ||
476 | if (!avatar.IsChildAgent) | ||
477 | { | ||
478 | over.SendLandUpdateToClient(avatar.ControllingClient); | ||
479 | avatar.currentParcelUUID = over.LandData.GlobalID; | ||
480 | m_scene.EventManager.TriggerAvatarEnteringNewParcel(avatar, over.LandData.LocalID, | ||
481 | m_scene.RegionInfo.RegionID); | ||
482 | } | ||
483 | } | 480 | } |
484 | } | 481 | } |
485 | } | 482 | } |
@@ -531,6 +528,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
531 | //when we are finally in a safe place, lets release the forced position lock | 528 | //when we are finally in a safe place, lets release the forced position lock |
532 | forcedPosition.Remove(clientAvatar.ControllingClient.AgentId); | 529 | forcedPosition.Remove(clientAvatar.ControllingClient.AgentId); |
533 | } | 530 | } |
531 | EnforceBans(parcel, clientAvatar); | ||
534 | } | 532 | } |
535 | } | 533 | } |
536 | 534 | ||
@@ -589,7 +587,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
589 | requiredPowers = GroupPowers.LandManageBanned; | 587 | requiredPowers = GroupPowers.LandManageBanned; |
590 | 588 | ||
591 | if (m_scene.Permissions.CanEditParcelProperties(agentID, | 589 | if (m_scene.Permissions.CanEditParcelProperties(agentID, |
592 | land, requiredPowers)) | 590 | land, requiredPowers, false)) |
593 | { | 591 | { |
594 | land.UpdateAccessList(flags, transactionID, sequenceID, | 592 | land.UpdateAccessList(flags, transactionID, sequenceID, |
595 | sections, entries, remote_client); | 593 | sections, entries, remote_client); |
@@ -623,20 +621,28 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
623 | new_land.LandData.LocalID = newLandLocalID; | 621 | new_land.LandData.LocalID = newLandLocalID; |
624 | 622 | ||
625 | bool[,] landBitmap = new_land.GetLandBitmap(); | 623 | bool[,] landBitmap = new_land.GetLandBitmap(); |
624 | <<<<<<< HEAD | ||
626 | // m_log.DebugFormat("{0} AddLandObject. new_land.bitmapSize=({1},{2}). newLocalID={3}", | 625 | // m_log.DebugFormat("{0} AddLandObject. new_land.bitmapSize=({1},{2}). newLocalID={3}", |
627 | // LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), newLandLocalID); | 626 | // LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), newLandLocalID); |
628 | 627 | ||
628 | ======= | ||
629 | >>>>>>> avn/ubitvar | ||
629 | if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1)) | 630 | if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1)) |
630 | { | 631 | { |
631 | // Going to variable sized regions can cause mismatches | 632 | // Going to variable sized regions can cause mismatches |
632 | m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})", | 633 | m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})", |
634 | <<<<<<< HEAD | ||
633 | LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1) ); | 635 | LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1) ); |
636 | ======= | ||
637 | LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1)); | ||
638 | >>>>>>> avn/ubitvar | ||
634 | } | 639 | } |
635 | else | 640 | else |
636 | { | 641 | { |
637 | // If other land objects still believe that they occupy any parts of the same space, | 642 | // If other land objects still believe that they occupy any parts of the same space, |
638 | // then do not allow the add to proceed. | 643 | // then do not allow the add to proceed. |
639 | for (int x = 0; x < landBitmap.GetLength(0); x++) | 644 | for (int x = 0; x < landBitmap.GetLength(0); x++) |
645 | <<<<<<< HEAD | ||
640 | { | 646 | { |
641 | for (int y = 0; y < landBitmap.GetLength(1); y++) | 647 | for (int y = 0; y < landBitmap.GetLength(1); y++) |
642 | { | 648 | { |
@@ -663,15 +669,50 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
663 | } | 669 | } |
664 | 670 | ||
665 | for (int x = 0; x < landBitmap.GetLength(0); x++) | 671 | for (int x = 0; x < landBitmap.GetLength(0); x++) |
672 | ======= | ||
673 | >>>>>>> avn/ubitvar | ||
666 | { | 674 | { |
667 | for (int y = 0; y < landBitmap.GetLength(1); y++) | 675 | for (int y = 0; y < landBitmap.GetLength(1); y++) |
668 | { | 676 | { |
669 | if (landBitmap[x, y]) | 677 | if (landBitmap[x, y]) |
670 | { | 678 | { |
679 | <<<<<<< HEAD | ||
671 | // m_log.DebugFormat( | 680 | // m_log.DebugFormat( |
672 | // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", | 681 | // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", |
673 | // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); | 682 | // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); |
674 | 683 | ||
684 | ======= | ||
685 | int lastRecordedLandId = m_landIDList[x, y]; | ||
686 | |||
687 | if (lastRecordedLandId > 0) | ||
688 | { | ||
689 | ILandObject lastRecordedLo = m_landList[lastRecordedLandId]; | ||
690 | |||
691 | if (lastRecordedLo.LandBitmap[x, y]) | ||
692 | { | ||
693 | m_log.ErrorFormat( | ||
694 | "{0}: Cannot add parcel \"{1}\", local ID {2} at tile {3},{4} because this is still occupied by parcel \"{5}\", local ID {6} in {7}", | ||
695 | LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y, | ||
696 | lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name); | ||
697 | |||
698 | return null; | ||
699 | } | ||
700 | } | ||
701 | } | ||
702 | } | ||
703 | } | ||
704 | |||
705 | for (int x = 0; x < landBitmap.GetLength(0); x++) | ||
706 | { | ||
707 | for (int y = 0; y < landBitmap.GetLength(1); y++) | ||
708 | { | ||
709 | if (landBitmap[x, y]) | ||
710 | { | ||
711 | // m_log.DebugFormat( | ||
712 | // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", | ||
713 | // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); | ||
714 | |||
715 | >>>>>>> avn/ubitvar | ||
675 | m_landIDList[x, y] = newLandLocalID; | 716 | m_landIDList[x, y] = newLandLocalID; |
676 | } | 717 | } |
677 | } | 718 | } |
@@ -723,27 +764,28 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
723 | /// </summary> | 764 | /// </summary> |
724 | public void Clear(bool setupDefaultParcel) | 765 | public void Clear(bool setupDefaultParcel) |
725 | { | 766 | { |
726 | List<ILandObject> parcels; | 767 | Dictionary<int, ILandObject> landworkList; |
768 | // move to work pointer since we are deleting it all | ||
727 | lock (m_landList) | 769 | lock (m_landList) |
728 | { | 770 | { |
729 | parcels = new List<ILandObject>(m_landList.Values); | 771 | landworkList = m_landList; |
772 | m_landList = new Dictionary<int, ILandObject>(); | ||
730 | } | 773 | } |
731 | 774 | ||
732 | foreach (ILandObject lo in parcels) | 775 | // this 2 methods have locks (now) |
776 | ResetSimLandObjects(); | ||
777 | |||
778 | if (setupDefaultParcel) | ||
779 | CreateDefaultParcel(); | ||
780 | |||
781 | // fire outside events unlocked | ||
782 | foreach (ILandObject lo in landworkList.Values) | ||
733 | { | 783 | { |
734 | //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); | 784 | //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); |
735 | m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); | 785 | m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); |
736 | } | 786 | } |
787 | landworkList.Clear(); | ||
737 | 788 | ||
738 | lock (m_landList) | ||
739 | { | ||
740 | m_landList.Clear(); | ||
741 | |||
742 | ResetSimLandObjects(); | ||
743 | } | ||
744 | |||
745 | if (setupDefaultParcel) | ||
746 | CreateDefaultParcel(); | ||
747 | } | 789 | } |
748 | 790 | ||
749 | private void performFinalLandJoin(ILandObject master, ILandObject slave) | 791 | private void performFinalLandJoin(ILandObject master, ILandObject slave) |
@@ -787,6 +829,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
787 | /// <returns>Land object at the point supplied</returns> | 829 | /// <returns>Land object at the point supplied</returns> |
788 | public ILandObject GetLandObject(float x_float, float y_float) | 830 | public ILandObject GetLandObject(float x_float, float y_float) |
789 | { | 831 | { |
832 | <<<<<<< HEAD | ||
790 | return GetLandObject((int)x_float, (int)y_float, true /* returnNullIfLandObjectNotFound */); | 833 | return GetLandObject((int)x_float, (int)y_float, true /* returnNullIfLandObjectNotFound */); |
791 | /* | 834 | /* |
792 | int x; | 835 | int x; |
@@ -812,9 +855,31 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
812 | { | 855 | { |
813 | return null; | 856 | return null; |
814 | } | 857 | } |
858 | ======= | ||
859 | return GetLandObject((int)x_float, (int)y_float, true); | ||
860 | } | ||
815 | 861 | ||
816 | lock (m_landList) | 862 | // if x,y is off region this will return the parcel at cliped x,y |
863 | // as did code it replaces | ||
864 | public ILandObject GetLandObjectClipedXY(float x, float y) | ||
865 | { | ||
866 | //do clip inline | ||
867 | int avx = (int)x; | ||
868 | if (avx < 0) | ||
869 | avx = 0; | ||
870 | else if (avx >= m_scene.RegionInfo.RegionSizeX) | ||
871 | avx = (int)Constants.RegionSize - 1; | ||
872 | |||
873 | int avy = (int)y; | ||
874 | if (avy < 0) | ||
875 | avy = 0; | ||
876 | else if (avy >= m_scene.RegionInfo.RegionSizeY) | ||
877 | avy = (int)Constants.RegionSize - 1; | ||
878 | >>>>>>> avn/ubitvar | ||
879 | |||
880 | lock (m_landIDList) | ||
817 | { | 881 | { |
882 | <<<<<<< HEAD | ||
818 | // Corner case. If an autoreturn happens during sim startup | 883 | // Corner case. If an autoreturn happens during sim startup |
819 | // we will come here with the list uninitialized | 884 | // we will come here with the list uninitialized |
820 | // | 885 | // |
@@ -837,6 +902,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
837 | } | 902 | } |
838 | 903 | ||
839 | return null; | 904 | return null; |
905 | ======= | ||
906 | try | ||
907 | { | ||
908 | return m_landList[m_landIDList[avx / landUnit, avy / landUnit]]; | ||
909 | } | ||
910 | catch (IndexOutOfRangeException) | ||
911 | { | ||
912 | return null; | ||
913 | } | ||
914 | >>>>>>> avn/ubitvar | ||
840 | } | 915 | } |
841 | */ | 916 | */ |
842 | } | 917 | } |
@@ -848,6 +923,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
848 | return GetLandObject(x, y, false /* returnNullIfLandObjectNotFound */); | 923 | return GetLandObject(x, y, false /* returnNullIfLandObjectNotFound */); |
849 | } | 924 | } |
850 | 925 | ||
926 | <<<<<<< HEAD | ||
851 | /// <summary> | 927 | /// <summary> |
852 | /// Given a region position, return the parcel land object for that location | 928 | /// Given a region position, return the parcel land object for that location |
853 | /// </summary> | 929 | /// </summary> |
@@ -862,16 +938,37 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
862 | private ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds) | 938 | private ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds) |
863 | { | 939 | { |
864 | if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0) | 940 | if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0) |
941 | ======= | ||
942 | public ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds) | ||
943 | { | ||
944 | if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0) | ||
945 | >>>>>>> avn/ubitvar | ||
865 | { | 946 | { |
866 | // These exceptions here will cause a lot of complaints from the users specifically because | 947 | // These exceptions here will cause a lot of complaints from the users specifically because |
867 | // they happen every time at border crossings | 948 | // they happen every time at border crossings |
868 | if (returnNullIfLandObjectOutsideBounds) | 949 | if (returnNullIfLandObjectOutsideBounds) |
869 | return null; | 950 | return null; |
870 | else | 951 | else |
952 | <<<<<<< HEAD | ||
871 | throw new Exception( | 953 | throw new Exception( |
872 | String.Format("{0} GetLandObject for non-existent position. Region={1}, pos=<{2},{3}", | 954 | String.Format("{0} GetLandObject for non-existent position. Region={1}, pos=<{2},{3}", |
873 | LogHeader, m_scene.RegionInfo.RegionName, x, y) | 955 | LogHeader, m_scene.RegionInfo.RegionName, x, y) |
874 | ); | 956 | ); |
957 | ======= | ||
958 | throw new Exception("Error: Parcel not found at point " + x + ", " + y); | ||
959 | } | ||
960 | |||
961 | lock (m_landIDList) | ||
962 | { | ||
963 | try | ||
964 | { | ||
965 | return m_landList[m_landIDList[x / 4, y / 4]]; | ||
966 | } | ||
967 | catch (IndexOutOfRangeException) | ||
968 | { | ||
969 | return null; | ||
970 | } | ||
971 | >>>>>>> avn/ubitvar | ||
875 | } | 972 | } |
876 | 973 | ||
877 | return m_landList[m_landIDList[x / 4, y / 4]]; | 974 | return m_landList[m_landIDList[x / 4, y / 4]]; |
@@ -890,6 +987,19 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
890 | return ret; | 987 | return ret; |
891 | } | 988 | } |
892 | 989 | ||
990 | // Create a 'parcel is here' bitmap for the parcel identified by the passed landID | ||
991 | private bool[,] CreateBitmapForID(int landID) | ||
992 | { | ||
993 | bool[,] ret = new bool[m_landIDList.GetLength(0), m_landIDList.GetLength(1)]; | ||
994 | |||
995 | for (int xx = 0; xx < m_landIDList.GetLength(0); xx++) | ||
996 | for (int yy = 0; yy < m_landIDList.GetLength(0); yy++) | ||
997 | if (m_landIDList[xx, yy] == landID) | ||
998 | ret[xx, yy] = true; | ||
999 | |||
1000 | return ret; | ||
1001 | } | ||
1002 | |||
893 | #endregion | 1003 | #endregion |
894 | 1004 | ||
895 | #region Parcel Modification | 1005 | #region Parcel Modification |
@@ -1033,7 +1143,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1033 | 1143 | ||
1034 | //If we are still here, then they are subdividing within one piece of land | 1144 | //If we are still here, then they are subdividing within one piece of land |
1035 | //Check owner | 1145 | //Check owner |
1036 | if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, startLandObject, GroupPowers.LandDivideJoin)) | 1146 | if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, startLandObject, GroupPowers.LandDivideJoin, true)) |
1037 | { | 1147 | { |
1038 | return; | 1148 | return; |
1039 | } | 1149 | } |
@@ -1043,6 +1153,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1043 | newLand.LandData.Name = newLand.LandData.Name; | 1153 | newLand.LandData.Name = newLand.LandData.Name; |
1044 | newLand.LandData.GlobalID = UUID.Random(); | 1154 | newLand.LandData.GlobalID = UUID.Random(); |
1045 | newLand.LandData.Dwell = 0; | 1155 | newLand.LandData.Dwell = 0; |
1156 | // Clear "Show in search" on the cut out parcel to prevent double-charging | ||
1157 | newLand.LandData.Flags &= ~(uint)ParcelFlags.ShowDirectory; | ||
1046 | 1158 | ||
1047 | newLand.SetLandBitmap(newLand.GetSquareLandBitmap(start_x, start_y, end_x, end_y)); | 1159 | newLand.SetLandBitmap(newLand.GetSquareLandBitmap(start_x, start_y, end_x, end_y)); |
1048 | 1160 | ||
@@ -1057,12 +1169,19 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1057 | 1169 | ||
1058 | //Now add the new land object | 1170 | //Now add the new land object |
1059 | ILandObject result = AddLandObject(newLand); | 1171 | ILandObject result = AddLandObject(newLand); |
1172 | <<<<<<< HEAD | ||
1060 | 1173 | ||
1061 | if (result != null) | 1174 | if (result != null) |
1062 | { | 1175 | { |
1063 | UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); | 1176 | UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); |
1064 | result.SendLandUpdateToAvatarsOverMe(); | 1177 | result.SendLandUpdateToAvatarsOverMe(); |
1065 | } | 1178 | } |
1179 | ======= | ||
1180 | UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); | ||
1181 | result.SendLandUpdateToAvatarsOverMe(); | ||
1182 | startLandObject.SendLandUpdateToAvatarsOverMe(); | ||
1183 | m_scene.ForEachClient(SendParcelOverlay); | ||
1184 | >>>>>>> avn/ubitvar | ||
1066 | } | 1185 | } |
1067 | 1186 | ||
1068 | /// <summary> | 1187 | /// <summary> |
@@ -1104,7 +1223,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1104 | { | 1223 | { |
1105 | return; | 1224 | return; |
1106 | } | 1225 | } |
1107 | if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin)) | 1226 | if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin, true)) |
1108 | { | 1227 | { |
1109 | return; | 1228 | return; |
1110 | } | 1229 | } |
@@ -1127,6 +1246,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1127 | } | 1246 | } |
1128 | 1247 | ||
1129 | masterLandObject.SendLandUpdateToAvatarsOverMe(); | 1248 | masterLandObject.SendLandUpdateToAvatarsOverMe(); |
1249 | m_scene.ForEachClient(SendParcelOverlay); | ||
1130 | } | 1250 | } |
1131 | 1251 | ||
1132 | public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) | 1252 | public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) |
@@ -1143,11 +1263,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1143 | 1263 | ||
1144 | #region Parcel Updating | 1264 | #region Parcel Updating |
1145 | 1265 | ||
1266 | <<<<<<< HEAD | ||
1146 | // Send parcel layer info for the whole region | 1267 | // Send parcel layer info for the whole region |
1147 | public void SendParcelOverlay(IClientAPI remote_client) | 1268 | public void SendParcelOverlay(IClientAPI remote_client) |
1148 | { | 1269 | { |
1149 | SendParcelOverlay(remote_client, 0, 0, (int)Constants.MaximumRegionSize); | 1270 | SendParcelOverlay(remote_client, 0, 0, (int)Constants.MaximumRegionSize); |
1150 | } | 1271 | } |
1272 | ======= | ||
1273 | >>>>>>> avn/ubitvar | ||
1151 | 1274 | ||
1152 | /// <summary> | 1275 | /// <summary> |
1153 | /// Send the parcel overlay blocks to the client. We send the overlay packets | 1276 | /// Send the parcel overlay blocks to the client. We send the overlay packets |
@@ -1164,11 +1287,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1164 | /// <param name="layerViewDistance">Distance from x,y position to send parcel layer info</param> | 1287 | /// <param name="layerViewDistance">Distance from x,y position to send parcel layer info</param> |
1165 | private void SendParcelOverlay(IClientAPI remote_client, int xPlace, int yPlace, int layerViewDistance) | 1288 | private void SendParcelOverlay(IClientAPI remote_client, int xPlace, int yPlace, int layerViewDistance) |
1166 | { | 1289 | { |
1290 | if (remote_client.SceneAgent.PresenceType == PresenceType.Npc) | ||
1291 | return; | ||
1292 | |||
1167 | const int LAND_BLOCKS_PER_PACKET = 1024; | 1293 | const int LAND_BLOCKS_PER_PACKET = 1024; |
1168 | 1294 | ||
1169 | byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; | 1295 | byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; |
1170 | int byteArrayCount = 0; | 1296 | int byteArrayCount = 0; |
1171 | int sequenceID = 0; | 1297 | int sequenceID = 0; |
1298 | <<<<<<< HEAD | ||
1172 | 1299 | ||
1173 | int xLow = 0; | 1300 | int xLow = 0; |
1174 | int xHigh = (int)m_scene.RegionInfo.RegionSizeX; | 1301 | int xHigh = (int)m_scene.RegionInfo.RegionSizeX; |
@@ -1182,6 +1309,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1182 | int txHigh = xPlace + layerViewDistance; | 1309 | int txHigh = xPlace + layerViewDistance; |
1183 | // If the distance is outside the region area, move the view distance to ba all in the region | 1310 | // If the distance is outside the region area, move the view distance to ba all in the region |
1184 | if (txLow < xLow) | 1311 | if (txLow < xLow) |
1312 | ======= | ||
1313 | |||
1314 | // Layer data is in landUnit (4m) chunks | ||
1315 | for (int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += landUnit) | ||
1316 | { | ||
1317 | for (int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += landUnit) | ||
1318 | >>>>>>> avn/ubitvar | ||
1185 | { | 1319 | { |
1186 | txLow = xLow; | 1320 | txLow = xLow; |
1187 | txHigh = Math.Min(yLow + (layerViewDistance * 2), xHigh); | 1321 | txHigh = Math.Min(yLow + (layerViewDistance * 2), xHigh); |
@@ -1194,6 +1328,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1194 | xLow = txLow; | 1328 | xLow = txLow; |
1195 | xHigh = txHigh; | 1329 | xHigh = txHigh; |
1196 | 1330 | ||
1331 | <<<<<<< HEAD | ||
1197 | int tyLow = yPlace - layerViewDistance; | 1332 | int tyLow = yPlace - layerViewDistance; |
1198 | int tyHigh = yPlace + layerViewDistance; | 1333 | int tyHigh = yPlace + layerViewDistance; |
1199 | if (tyLow < yLow) | 1334 | if (tyLow < yLow) |
@@ -1211,6 +1346,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1211 | } | 1346 | } |
1212 | // m_log.DebugFormat("{0} SendParcelOverlay: place=<{1},{2}>, vDist={3}, xLH=<{4},{5}, yLH=<{6},{7}>", | 1347 | // m_log.DebugFormat("{0} SendParcelOverlay: place=<{1},{2}>, vDist={3}, xLH=<{4},{5}, yLH=<{6},{7}>", |
1213 | // LogHeader, xPlace, yPlace, layerViewDistance, xLow, xHigh, yLow, yHigh); | 1348 | // LogHeader, xPlace, yPlace, layerViewDistance, xLow, xHigh, yLow, yHigh); |
1349 | ======= | ||
1350 | ILandObject currentParcelBlock = GetLandObject(x, y); | ||
1351 | >>>>>>> avn/ubitvar | ||
1214 | 1352 | ||
1215 | // Layer data is in landUnit (4m) chunks | 1353 | // Layer data is in landUnit (4m) chunks |
1216 | for (int y = yLow; y < yHigh / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++) | 1354 | for (int y = yLow; y < yHigh / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++) |
@@ -1221,6 +1359,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1221 | byteArrayCount++; | 1359 | byteArrayCount++; |
1222 | if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) | 1360 | if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) |
1223 | { | 1361 | { |
1362 | <<<<<<< HEAD | ||
1224 | // m_log.DebugFormat("{0} SendParcelOverlay, sending packet, bytes={1}", LogHeader, byteArray.Length); | 1363 | // m_log.DebugFormat("{0} SendParcelOverlay, sending packet, bytes={1}", LogHeader, byteArray.Length); |
1225 | remote_client.SendLandParcelOverlay(byteArray, sequenceID); | 1364 | remote_client.SendLandParcelOverlay(byteArray, sequenceID); |
1226 | byteArrayCount = 0; | 1365 | byteArrayCount = 0; |
@@ -1298,6 +1437,95 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1298 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH); | 1437 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH); |
1299 | } | 1438 | } |
1300 | 1439 | ||
1440 | ======= | ||
1441 | // types | ||
1442 | if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId) | ||
1443 | { | ||
1444 | //Owner Flag | ||
1445 | tempByte = (byte)LandChannel.LAND_TYPE_OWNED_BY_REQUESTER; | ||
1446 | } | ||
1447 | else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID)) | ||
1448 | { | ||
1449 | tempByte = (byte)LandChannel.LAND_TYPE_OWNED_BY_GROUP; | ||
1450 | } | ||
1451 | else if (currentParcelBlock.LandData.SalePrice > 0 && | ||
1452 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || | ||
1453 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) | ||
1454 | { | ||
1455 | //Sale type | ||
1456 | tempByte = (byte)LandChannel.LAND_TYPE_IS_FOR_SALE; | ||
1457 | } | ||
1458 | else if (currentParcelBlock.LandData.OwnerID == UUID.Zero) | ||
1459 | { | ||
1460 | //Public type | ||
1461 | tempByte = (byte)LandChannel.LAND_TYPE_PUBLIC; // this does nothing, its zero | ||
1462 | } | ||
1463 | // LAND_TYPE_IS_BEING_AUCTIONED still unsuported | ||
1464 | else | ||
1465 | { | ||
1466 | //Other Flag | ||
1467 | tempByte = (byte)LandChannel.LAND_TYPE_OWNED_BY_OTHER; | ||
1468 | } | ||
1469 | |||
1470 | // now flags | ||
1471 | // border control | ||
1472 | |||
1473 | ILandObject westParcel = null; | ||
1474 | ILandObject southParcel = null; | ||
1475 | if (x > 0) | ||
1476 | { | ||
1477 | westParcel = GetLandObject((x - 1), y); | ||
1478 | } | ||
1479 | if (y > 0) | ||
1480 | { | ||
1481 | southParcel = GetLandObject(x, (y - 1)); | ||
1482 | } | ||
1483 | |||
1484 | if (x == 0) | ||
1485 | { | ||
1486 | tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST; | ||
1487 | } | ||
1488 | else if (westParcel != null && westParcel != currentParcelBlock) | ||
1489 | { | ||
1490 | tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST; | ||
1491 | } | ||
1492 | |||
1493 | if (y == 0) | ||
1494 | { | ||
1495 | tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH; | ||
1496 | } | ||
1497 | else if (southParcel != null && southParcel != currentParcelBlock) | ||
1498 | { | ||
1499 | tempByte |= (byte)LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH; | ||
1500 | } | ||
1501 | |||
1502 | // local sound | ||
1503 | if ((currentParcelBlock.LandData.Flags & (uint)ParcelFlags.SoundLocal) != 0) | ||
1504 | tempByte |= (byte)LandChannel.LAND_FLAG_LOCALSOUND; | ||
1505 | |||
1506 | // hide avatars | ||
1507 | if (!currentParcelBlock.LandData.SeeAVs) | ||
1508 | tempByte |= (byte)LandChannel.LAND_FLAG_HIDEAVATARS; | ||
1509 | |||
1510 | |||
1511 | byteArray[byteArrayCount] = tempByte; | ||
1512 | byteArrayCount++; | ||
1513 | if (byteArrayCount >= LAND_BLOCKS_PER_PACKET) | ||
1514 | { | ||
1515 | remote_client.SendLandParcelOverlay(byteArray, sequenceID); | ||
1516 | byteArrayCount = 0; | ||
1517 | sequenceID++; | ||
1518 | byteArray = new byte[LAND_BLOCKS_PER_PACKET]; | ||
1519 | } | ||
1520 | } | ||
1521 | } | ||
1522 | |||
1523 | } | ||
1524 | |||
1525 | if (byteArrayCount > 0) | ||
1526 | { | ||
1527 | remote_client.SendLandParcelOverlay(byteArray, sequenceID); | ||
1528 | >>>>>>> avn/ubitvar | ||
1301 | } | 1529 | } |
1302 | 1530 | ||
1303 | return tempByte; | 1531 | return tempByte; |
@@ -1320,8 +1548,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1320 | { | 1548 | { |
1321 | if (!temp.Contains(currentParcel)) | 1549 | if (!temp.Contains(currentParcel)) |
1322 | { | 1550 | { |
1323 | currentParcel.ForceUpdateLandInfo(); | 1551 | if (!currentParcel.IsEitherBannedOrRestricted(remote_client.AgentId)) |
1324 | temp.Add(currentParcel); | 1552 | { |
1553 | currentParcel.ForceUpdateLandInfo(); | ||
1554 | temp.Add(currentParcel); | ||
1555 | } | ||
1325 | } | 1556 | } |
1326 | } | 1557 | } |
1327 | } | 1558 | } |
@@ -1338,8 +1569,50 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1338 | temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client); | 1569 | temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client); |
1339 | } | 1570 | } |
1340 | 1571 | ||
1572 | <<<<<<< HEAD | ||
1341 | // Also send the layer data around the point of interest | 1573 | // Also send the layer data around the point of interest |
1342 | SendParcelOverlay(remote_client, (start_x + end_x) / 2, (start_y + end_y) / 2, parcelLayerViewDistance); | 1574 | SendParcelOverlay(remote_client, (start_x + end_x) / 2, (start_y + end_y) / 2, parcelLayerViewDistance); |
1575 | ======= | ||
1576 | // SendParcelOverlay(remote_client); | ||
1577 | } | ||
1578 | |||
1579 | public void UpdateLandProperties(ILandObject land, LandUpdateArgs args, IClientAPI remote_client) | ||
1580 | { | ||
1581 | bool snap_selection = false; | ||
1582 | bool needOverlay = false; | ||
1583 | if (land.UpdateLandProperties(args, remote_client, out snap_selection, out needOverlay)) | ||
1584 | { | ||
1585 | //the proprieties to who changed them | ||
1586 | ScenePresence av = m_scene.GetScenePresence(remote_client.AgentId); | ||
1587 | if(av.IsChildAgent || land != GetLandObject(av.AbsolutePosition.X, av.AbsolutePosition.Y)) | ||
1588 | land.SendLandProperties(-10000, false, LandChannel.LAND_RESULT_SINGLE, remote_client); | ||
1589 | else | ||
1590 | land.SendLandProperties(0, false, LandChannel.LAND_RESULT_SINGLE, remote_client); | ||
1591 | |||
1592 | UUID parcelID = land.LandData.GlobalID; | ||
1593 | m_scene.ForEachScenePresence(delegate(ScenePresence avatar) | ||
1594 | { | ||
1595 | if (avatar.IsDeleted || avatar.isNPC) | ||
1596 | return; | ||
1597 | |||
1598 | IClientAPI client = avatar.ControllingClient; | ||
1599 | if (needOverlay) | ||
1600 | SendParcelOverlay(client); | ||
1601 | |||
1602 | if (avatar.IsChildAgent) | ||
1603 | return; | ||
1604 | |||
1605 | ILandObject aland = GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); | ||
1606 | if (aland != null) | ||
1607 | { | ||
1608 | if (client != remote_client && land == aland) | ||
1609 | aland.SendLandProperties(0, false, LandChannel.LAND_RESULT_SINGLE, client); | ||
1610 | } | ||
1611 | if (avatar.currentParcelUUID == parcelID) | ||
1612 | avatar.currentParcelUUID = parcelID; // force parcel flags review | ||
1613 | }); | ||
1614 | } | ||
1615 | >>>>>>> avn/ubitvar | ||
1343 | } | 1616 | } |
1344 | 1617 | ||
1345 | public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client) | 1618 | public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client) |
@@ -1352,7 +1625,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1352 | 1625 | ||
1353 | if (land != null) | 1626 | if (land != null) |
1354 | { | 1627 | { |
1355 | land.UpdateLandProperties(args, remote_client); | 1628 | UpdateLandProperties(land, args, remote_client); |
1356 | m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(args, localID, remote_client); | 1629 | m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(args, localID, remote_client); |
1357 | } | 1630 | } |
1358 | } | 1631 | } |
@@ -1408,7 +1681,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1408 | land.LandData.GroupID = UUID.Zero; | 1681 | land.LandData.GroupID = UUID.Zero; |
1409 | land.LandData.IsGroupOwned = false; | 1682 | land.LandData.IsGroupOwned = false; |
1410 | land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); | 1683 | land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); |
1411 | |||
1412 | m_scene.ForEachClient(SendParcelOverlay); | 1684 | m_scene.ForEachClient(SendParcelOverlay); |
1413 | land.SendLandUpdateToClient(true, remote_client); | 1685 | land.SendLandUpdateToClient(true, remote_client); |
1414 | UpdateLandObject(land.LandData.LocalID, land.LandData); | 1686 | UpdateLandObject(land.LandData.LocalID, land.LandData); |
@@ -1459,7 +1731,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1459 | land.LandData.SalePrice = 0; | 1731 | land.LandData.SalePrice = 0; |
1460 | land.LandData.AuthBuyerID = UUID.Zero; | 1732 | land.LandData.AuthBuyerID = UUID.Zero; |
1461 | land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); | 1733 | land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); |
1462 | |||
1463 | m_scene.ForEachClient(SendParcelOverlay); | 1734 | m_scene.ForEachClient(SendParcelOverlay); |
1464 | land.SendLandUpdateToClient(true, remote_client); | 1735 | land.SendLandUpdateToClient(true, remote_client); |
1465 | UpdateLandObject(land.LandData.LocalID, land.LandData); | 1736 | UpdateLandObject(land.LandData.LocalID, land.LandData); |
@@ -1545,9 +1816,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1545 | 1816 | ||
1546 | private void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) | 1817 | private void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) |
1547 | { | 1818 | { |
1548 | // m_log.DebugFormat( | 1819 | lock (m_landList) |
1549 | // "[LAND MANAGMENT MODULE]: Processing {0} incoming parcels on {1}", data.Count, m_scene.Name); | 1820 | { |
1821 | for (int i = 0; i < data.Count; i++) | ||
1822 | IncomingLandObjectFromStorage(data[i]); | ||
1550 | 1823 | ||
1824 | <<<<<<< HEAD | ||
1551 | // Prevent race conditions from any auto-creation of new parcels for varregions whilst we are still loading | 1825 | // Prevent race conditions from any auto-creation of new parcels for varregions whilst we are still loading |
1552 | // the existing parcels. | 1826 | // the existing parcels. |
1553 | lock (m_landList) | 1827 | lock (m_landList) |
@@ -1559,13 +1833,23 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1559 | for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++) | 1833 | for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++) |
1560 | { | 1834 | { |
1561 | for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++) | 1835 | for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++) |
1836 | ======= | ||
1837 | // Layer data is in landUnit (4m) chunks | ||
1838 | for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); y++) | ||
1839 | { | ||
1840 | for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / landUnit); x++) | ||
1841 | >>>>>>> avn/ubitvar | ||
1562 | { | 1842 | { |
1563 | if (m_landIDList[x, y] == 0) | 1843 | if (m_landIDList[x, y] == 0) |
1564 | { | 1844 | { |
1565 | if (m_landList.Count == 1) | 1845 | if (m_landList.Count == 1) |
1566 | { | 1846 | { |
1567 | m_log.DebugFormat( | 1847 | m_log.DebugFormat( |
1848 | <<<<<<< HEAD | ||
1568 | "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}", | 1849 | "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}", |
1850 | ======= | ||
1851 | "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}", | ||
1852 | >>>>>>> avn/ubitvar | ||
1569 | LogHeader, x, y, m_scene.Name); | 1853 | LogHeader, x, y, m_scene.Name); |
1570 | 1854 | ||
1571 | int onlyParcelID = 0; | 1855 | int onlyParcelID = 0; |
@@ -1588,11 +1872,19 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1588 | else if (m_landList.Count > 1) | 1872 | else if (m_landList.Count > 1) |
1589 | { | 1873 | { |
1590 | m_log.DebugFormat( | 1874 | m_log.DebugFormat( |
1875 | <<<<<<< HEAD | ||
1591 | "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}", | 1876 | "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}", |
1592 | LogHeader, x, y, m_scene.Name); | 1877 | LogHeader, x, y, m_scene.Name); |
1593 | 1878 | ||
1594 | // There are several other parcels so we must create a new one for the unassigned space | 1879 | // There are several other parcels so we must create a new one for the unassigned space |
1595 | ILandObject newLand = new LandObject(UUID.Zero, false, m_scene); | 1880 | ILandObject newLand = new LandObject(UUID.Zero, false, m_scene); |
1881 | ======= | ||
1882 | "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}", | ||
1883 | LogHeader, x, y, m_scene.Name); | ||
1884 | |||
1885 | // There are several other parcels so we must create a new one for the unassigned space | ||
1886 | ILandObject newLand = new LandObject(UUID.Zero, false, m_scene); | ||
1887 | >>>>>>> avn/ubitvar | ||
1596 | // Claim all the unclaimed "0" ids | 1888 | // Claim all the unclaimed "0" ids |
1597 | newLand.SetLandBitmap(CreateBitmapForID(0)); | 1889 | newLand.SetLandBitmap(CreateBitmapForID(0)); |
1598 | newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 1890 | newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
@@ -1603,7 +1895,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1603 | { | 1895 | { |
1604 | // We should never reach this point as the separate code path when no land data exists should have fired instead. | 1896 | // We should never reach this point as the separate code path when no land data exists should have fired instead. |
1605 | m_log.WarnFormat( | 1897 | m_log.WarnFormat( |
1898 | <<<<<<< HEAD | ||
1606 | "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present", | 1899 | "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present", |
1900 | ======= | ||
1901 | "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present", | ||
1902 | >>>>>>> avn/ubitvar | ||
1607 | LogHeader, m_scene.Name); | 1903 | LogHeader, m_scene.Name); |
1608 | } | 1904 | } |
1609 | } | 1905 | } |
@@ -1614,9 +1910,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1614 | 1910 | ||
1615 | private void IncomingLandObjectFromStorage(LandData data) | 1911 | private void IncomingLandObjectFromStorage(LandData data) |
1616 | { | 1912 | { |
1913 | <<<<<<< HEAD | ||
1617 | ILandObject new_land = new LandObject(data, m_scene); | 1914 | ILandObject new_land = new LandObject(data, m_scene); |
1915 | ======= | ||
1916 | |||
1917 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); | ||
1918 | new_land.LandData = data.Copy(); | ||
1919 | >>>>>>> avn/ubitvar | ||
1618 | new_land.SetLandBitmapFromByteArray(); | 1920 | new_land.SetLandBitmapFromByteArray(); |
1619 | AddLandObject(new_land); | 1921 | AddLandObject(new_land); |
1922 | // new_land.SendLandUpdateToAvatarsOverMe(); | ||
1620 | } | 1923 | } |
1621 | 1924 | ||
1622 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) | 1925 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) |
@@ -1773,6 +2076,19 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1773 | land_update.ObscureMusic = properties.ObscureMusic; | 2076 | land_update.ObscureMusic = properties.ObscureMusic; |
1774 | land_update.ObscureMedia = properties.ObscureMedia; | 2077 | land_update.ObscureMedia = properties.ObscureMedia; |
1775 | 2078 | ||
2079 | if (args.ContainsKey("see_avs")) | ||
2080 | { | ||
2081 | land_update.SeeAVs = args["see_avs"].AsBoolean(); | ||
2082 | land_update.AnyAVSounds = args["any_av_sounds"].AsBoolean(); | ||
2083 | land_update.GroupAVSounds = args["group_av_sounds"].AsBoolean(); | ||
2084 | } | ||
2085 | else | ||
2086 | { | ||
2087 | land_update.SeeAVs = true; | ||
2088 | land_update.AnyAVSounds = true; | ||
2089 | land_update.GroupAVSounds = true; | ||
2090 | } | ||
2091 | |||
1776 | ILandObject land; | 2092 | ILandObject land; |
1777 | lock (m_landList) | 2093 | lock (m_landList) |
1778 | { | 2094 | { |
@@ -1781,13 +2097,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1781 | 2097 | ||
1782 | if (land != null) | 2098 | if (land != null) |
1783 | { | 2099 | { |
1784 | land.UpdateLandProperties(land_update, client); | 2100 | UpdateLandProperties(land,land_update, client); |
1785 | m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client); | 2101 | m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client); |
1786 | } | 2102 | } |
1787 | else | 2103 | else |
1788 | { | 2104 | { |
1789 | m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to find parcelID {0}", parcelID); | 2105 | m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to find parcelID {0}", parcelID); |
1790 | } | 2106 | } |
2107 | |||
1791 | return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); | 2108 | return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); |
1792 | } | 2109 | } |
1793 | // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the | 2110 | // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the |
@@ -1940,14 +2257,93 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1940 | 2257 | ||
1941 | if (land == null) return; | 2258 | if (land == null) return; |
1942 | 2259 | ||
1943 | if (!m_scene.Permissions.CanEditParcelProperties(remoteClient.AgentId, land, GroupPowers.LandOptions)) | 2260 | if (!m_scene.Permissions.CanEditParcelProperties(remoteClient.AgentId, land, GroupPowers.LandOptions, false)) |
1944 | return; | 2261 | return; |
1945 | 2262 | ||
1946 | land.LandData.OtherCleanTime = otherCleanTime; | 2263 | land.LandData.OtherCleanTime = otherCleanTime; |
1947 | 2264 | ||
1948 | UpdateLandObject(localID, land.LandData); | 2265 | UpdateLandObject(localID, land.LandData); |
1949 | } | 2266 | } |
1950 | 2267 | ||
2268 | public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID) | ||
2269 | { | ||
2270 | ILandObject land = null; | ||
2271 | List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels(); | ||
2272 | foreach (ILandObject landObject in Land) | ||
2273 | { | ||
2274 | if (landObject.LandData.LocalID == landID) | ||
2275 | { | ||
2276 | land = landObject; | ||
2277 | } | ||
2278 | } | ||
2279 | land.DeedToGroup(DefaultGodParcelGroup); | ||
2280 | land.LandData.Name = DefaultGodParcelName; | ||
2281 | land.SendLandUpdateToAvatarsOverMe(); | ||
2282 | } | ||
2283 | |||
2284 | private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID) | ||
2285 | { | ||
2286 | ScenePresence SP; | ||
2287 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP); | ||
2288 | List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); | ||
2289 | if (SP.UserLevel != 0) | ||
2290 | { | ||
2291 | if (flags == 0) //All parcels, scripted or not | ||
2292 | { | ||
2293 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
2294 | { | ||
2295 | if (e.OwnerID == targetID) | ||
2296 | { | ||
2297 | returns.Add(e); | ||
2298 | } | ||
2299 | } | ||
2300 | ); | ||
2301 | } | ||
2302 | if (flags == 4) //All parcels, scripted object | ||
2303 | { | ||
2304 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
2305 | { | ||
2306 | if (e.OwnerID == targetID) | ||
2307 | { | ||
2308 | if (e.ContainsScripts()) | ||
2309 | { | ||
2310 | returns.Add(e); | ||
2311 | } | ||
2312 | } | ||
2313 | } | ||
2314 | ); | ||
2315 | } | ||
2316 | if (flags == 4) //not target parcel, scripted object | ||
2317 | { | ||
2318 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
2319 | { | ||
2320 | if (e.OwnerID == targetID) | ||
2321 | { | ||
2322 | ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y); | ||
2323 | if (landobject.LandData.OwnerID != e.OwnerID) | ||
2324 | { | ||
2325 | if (e.ContainsScripts()) | ||
2326 | { | ||
2327 | returns.Add(e); | ||
2328 | } | ||
2329 | } | ||
2330 | } | ||
2331 | } | ||
2332 | ); | ||
2333 | } | ||
2334 | foreach (SceneObjectGroup ol in returns) | ||
2335 | { | ||
2336 | ReturnObject(ol, client); | ||
2337 | } | ||
2338 | } | ||
2339 | } | ||
2340 | public void ReturnObject(SceneObjectGroup obj, IClientAPI client) | ||
2341 | { | ||
2342 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; | ||
2343 | objs[0] = obj; | ||
2344 | ((Scene)client.Scene).returnObjects(objs, client.AgentId); | ||
2345 | } | ||
2346 | |||
1951 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | 2347 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); |
1952 | 2348 | ||
1953 | public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | 2349 | public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) |
@@ -1961,7 +2357,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1961 | if (targetAvatar.UserLevel == 0) | 2357 | if (targetAvatar.UserLevel == 0) |
1962 | { | 2358 | { |
1963 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | 2359 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); |
1964 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | 2360 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze, true)) |
1965 | return; | 2361 | return; |
1966 | if (flags == 0) | 2362 | if (flags == 0) |
1967 | { | 2363 | { |
@@ -1983,7 +2379,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1983 | } | 2379 | } |
1984 | } | 2380 | } |
1985 | } | 2381 | } |
1986 | |||
1987 | private void OnEndParcelFrozen(object avatar) | 2382 | private void OnEndParcelFrozen(object avatar) |
1988 | { | 2383 | { |
1989 | ScenePresence targetAvatar = (ScenePresence)avatar; | 2384 | ScenePresence targetAvatar = (ScenePresence)avatar; |
@@ -1994,6 +2389,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1994 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); | 2389 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); |
1995 | } | 2390 | } |
1996 | 2391 | ||
2392 | |||
1997 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | 2393 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) |
1998 | { | 2394 | { |
1999 | ScenePresence targetAvatar = null; | 2395 | ScenePresence targetAvatar = null; |
@@ -2010,15 +2406,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2010 | 2406 | ||
2011 | // Check if you even have permission to do this | 2407 | // Check if you even have permission to do this |
2012 | ILandObject land = m_scene.LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | 2408 | ILandObject land = m_scene.LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); |
2013 | if (!m_scene.Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze) && | 2409 | if (!m_scene.Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze, true) && |
2014 | !m_scene.Permissions.IsAdministrator(client.AgentId)) | 2410 | !m_scene.Permissions.IsAdministrator(client.AgentId)) |
2015 | return; | 2411 | return; |
2412 | |||
2016 | Vector3 pos = m_scene.GetNearestAllowedPosition(targetAvatar, land); | 2413 | Vector3 pos = m_scene.GetNearestAllowedPosition(targetAvatar, land); |
2017 | 2414 | ||
2018 | targetAvatar.TeleportWithMomentum(pos, null); | 2415 | targetAvatar.TeleportWithMomentum(pos, null); |
2019 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | 2416 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); |
2020 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | 2417 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); |
2021 | 2418 | ||
2022 | if ((flags & 1) != 0) // Ban TODO: Remove magic number | 2419 | if ((flags & 1) != 0) // Ban TODO: Remove magic number |
2023 | { | 2420 | { |
2024 | LandAccessEntry entry = new LandAccessEntry(); | 2421 | LandAccessEntry entry = new LandAccessEntry(); |
@@ -2171,6 +2568,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2171 | 2568 | ||
2172 | private void AppendParcelsSummaryReport(StringBuilder report) | 2569 | private void AppendParcelsSummaryReport(StringBuilder report) |
2173 | { | 2570 | { |
2571 | <<<<<<< HEAD | ||
2174 | report.AppendFormat("Land information for {0}\n", m_scene.Name); | 2572 | report.AppendFormat("Land information for {0}\n", m_scene.Name); |
2175 | 2573 | ||
2176 | ConsoleDisplayTable cdt = new ConsoleDisplayTable(); | 2574 | ConsoleDisplayTable cdt = new ConsoleDisplayTable(); |
@@ -2180,12 +2578,24 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2180 | cdt.AddColumn("Starts", ConsoleDisplayUtil.VectorSize); | 2578 | cdt.AddColumn("Starts", ConsoleDisplayUtil.VectorSize); |
2181 | cdt.AddColumn("Ends", ConsoleDisplayUtil.VectorSize); | 2579 | cdt.AddColumn("Ends", ConsoleDisplayUtil.VectorSize); |
2182 | cdt.AddColumn("Owner", ConsoleDisplayUtil.UserNameSize); | 2580 | cdt.AddColumn("Owner", ConsoleDisplayUtil.UserNameSize); |
2581 | ======= | ||
2582 | report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); | ||
2583 | report.AppendFormat( | ||
2584 | "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", | ||
2585 | "Parcel Name", | ||
2586 | "Local ID", | ||
2587 | "Area", | ||
2588 | "AABBMin", | ||
2589 | "AABBMax", | ||
2590 | "Owner"); | ||
2591 | >>>>>>> avn/ubitvar | ||
2183 | 2592 | ||
2184 | lock (m_landList) | 2593 | lock (m_landList) |
2185 | { | 2594 | { |
2186 | foreach (ILandObject lo in m_landList.Values) | 2595 | foreach (ILandObject lo in m_landList.Values) |
2187 | { | 2596 | { |
2188 | LandData ld = lo.LandData; | 2597 | LandData ld = lo.LandData; |
2598 | <<<<<<< HEAD | ||
2189 | string ownerName; | 2599 | string ownerName; |
2190 | if (ld.IsGroupOwned) | 2600 | if (ld.IsGroupOwned) |
2191 | { | 2601 | { |
@@ -2198,6 +2608,35 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2198 | } | 2608 | } |
2199 | cdt.AddRow( | 2609 | cdt.AddRow( |
2200 | ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, ownerName); | 2610 | ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, ownerName); |
2611 | ======= | ||
2612 | |||
2613 | report.AppendFormat( | ||
2614 | "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", | ||
2615 | ld.Name, ld.LocalID, ld.Area, ld.AABBMin, ld.AABBMax, m_userManager.GetUserName(ld.OwnerID)); | ||
2616 | } | ||
2617 | } | ||
2618 | |||
2619 | } | ||
2620 | |||
2621 | public void EnforceBans(ILandObject land, ScenePresence avatar) | ||
2622 | { | ||
2623 | if (avatar.AbsolutePosition.Z > LandChannel.BAN_LINE_SAFETY_HIEGHT) | ||
2624 | return; | ||
2625 | |||
2626 | if (land.IsEitherBannedOrRestricted(avatar.UUID)) | ||
2627 | { | ||
2628 | if (land.ContainsPoint(Convert.ToInt32(avatar.lastKnownAllowedPosition.X), Convert.ToInt32(avatar.lastKnownAllowedPosition.Y))) | ||
2629 | { | ||
2630 | Vector3? pos = m_scene.GetNearestAllowedPosition(avatar); | ||
2631 | if (pos == null) | ||
2632 | m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient); | ||
2633 | else | ||
2634 | ForceAvatarToPosition(avatar, (Vector3)pos); | ||
2635 | } | ||
2636 | else | ||
2637 | { | ||
2638 | ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); | ||
2639 | >>>>>>> avn/ubitvar | ||
2201 | } | 2640 | } |
2202 | } | 2641 | } |
2203 | 2642 | ||
@@ -2214,8 +2653,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
2214 | cdl.AddRow("Description", ld.Description); | 2653 | cdl.AddRow("Description", ld.Description); |
2215 | cdl.AddRow("Snapshot ID", ld.SnapshotID); | 2654 | cdl.AddRow("Snapshot ID", ld.SnapshotID); |
2216 | cdl.AddRow("Area", ld.Area); | 2655 | cdl.AddRow("Area", ld.Area); |
2217 | cdl.AddRow("Starts", lo.StartPoint); | ||
2218 | cdl.AddRow("Ends", lo.EndPoint); | ||
2219 | cdl.AddRow("AABB Min", ld.AABBMin); | 2656 | cdl.AddRow("AABB Min", ld.AABBMin); |
2220 | cdl.AddRow("AABB Max", ld.AABBMax); | 2657 | cdl.AddRow("AABB Max", ld.AABBMax); |
2221 | string ownerName; | 2658 | string ownerName; |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index a0c1b9d..3b81d6b 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -46,11 +46,20 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
46 | 46 | ||
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | private static readonly string LogHeader = "[LAND OBJECT]"; | 48 | private static readonly string LogHeader = "[LAND OBJECT]"; |
49 | <<<<<<< HEAD | ||
49 | 50 | ||
50 | private readonly int landUnit = 4; | 51 | private readonly int landUnit = 4; |
51 | 52 | ||
52 | private int m_lastSeqId = 0; | 53 | private int m_lastSeqId = 0; |
53 | 54 | ||
55 | ======= | ||
56 | |||
57 | private readonly int landUnit = 4; | ||
58 | |||
59 | private int m_lastSeqId = 0; | ||
60 | private int m_expiryCounter = 0; | ||
61 | |||
62 | >>>>>>> avn/ubitvar | ||
54 | protected Scene m_scene; | 63 | protected Scene m_scene; |
55 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); | 64 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); |
56 | protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); | 65 | protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); |
@@ -58,7 +67,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
58 | protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>(); | 67 | protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>(); |
59 | protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds | 68 | protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds |
60 | 69 | ||
70 | <<<<<<< HEAD | ||
61 | public bool[,] LandBitmap { get; set; } | 71 | public bool[,] LandBitmap { get; set; } |
72 | ======= | ||
73 | private bool[,] m_landBitmap; | ||
74 | public bool[,] LandBitmap | ||
75 | { | ||
76 | get { return m_landBitmap; } | ||
77 | set { m_landBitmap = value; } | ||
78 | } | ||
79 | >>>>>>> avn/ubitvar | ||
62 | 80 | ||
63 | #endregion | 81 | #endregion |
64 | 82 | ||
@@ -69,7 +87,17 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
69 | return free; | 87 | return free; |
70 | } | 88 | } |
71 | 89 | ||
90 | <<<<<<< HEAD | ||
72 | public LandData LandData { get; set; } | 91 | public LandData LandData { get; set; } |
92 | ======= | ||
93 | protected LandData m_landData; | ||
94 | public LandData LandData | ||
95 | { | ||
96 | get { return m_landData; } | ||
97 | |||
98 | set { m_landData = value; } | ||
99 | } | ||
100 | >>>>>>> avn/ubitvar | ||
73 | 101 | ||
74 | public IPrimCounts PrimCounts { get; set; } | 102 | public IPrimCounts PrimCounts { get; set; } |
75 | 103 | ||
@@ -141,6 +169,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
141 | else | 169 | else |
142 | LandData.GroupID = UUID.Zero; | 170 | LandData.GroupID = UUID.Zero; |
143 | LandData.IsGroupOwned = is_group_owned; | 171 | LandData.IsGroupOwned = is_group_owned; |
172 | |||
173 | m_scene.EventManager.OnFrame += OnFrame; | ||
144 | } | 174 | } |
145 | 175 | ||
146 | #endregion | 176 | #endregion |
@@ -195,10 +225,34 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
195 | else | 225 | else |
196 | { | 226 | { |
197 | // Normal Calculations | 227 | // Normal Calculations |
228 | <<<<<<< HEAD | ||
198 | int parcelMax = (int)(((float)LandData.Area / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY)) | 229 | int parcelMax = (int)(((float)LandData.Area / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY)) |
199 | * (float)m_scene.RegionInfo.ObjectCapacity | 230 | * (float)m_scene.RegionInfo.ObjectCapacity |
200 | * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); | 231 | * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); |
201 | // TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL! | 232 | // TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL! |
233 | ======= | ||
234 | int parcelMax = (int)( (long)LandData.Area | ||
235 | * (long)m_scene.RegionInfo.ObjectCapacity | ||
236 | * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus | ||
237 | / (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) ); | ||
238 | //m_log.DebugFormat("Area: {0}, Capacity {1}, Bonus {2}, Parcel {3}", LandData.Area, m_scene.RegionInfo.ObjectCapacity, m_scene.RegionInfo.RegionSettings.ObjectBonus, parcelMax); | ||
239 | return parcelMax; | ||
240 | } | ||
241 | } | ||
242 | |||
243 | private int GetParcelBasePrimCount() | ||
244 | { | ||
245 | if (overrideParcelMaxPrimCount != null) | ||
246 | { | ||
247 | return overrideParcelMaxPrimCount(this); | ||
248 | } | ||
249 | else | ||
250 | { | ||
251 | // Normal Calculations | ||
252 | int parcelMax = (int)((long)LandData.Area | ||
253 | * (long)m_scene.RegionInfo.ObjectCapacity | ||
254 | / 65536L); | ||
255 | >>>>>>> avn/ubitvar | ||
202 | return parcelMax; | 256 | return parcelMax; |
203 | } | 257 | } |
204 | } | 258 | } |
@@ -212,8 +266,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
212 | else | 266 | else |
213 | { | 267 | { |
214 | //Normal Calculations | 268 | //Normal Calculations |
269 | <<<<<<< HEAD | ||
215 | int simMax = (int)(((float)LandData.SimwideArea / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY)) | 270 | int simMax = (int)(((float)LandData.SimwideArea / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY)) |
216 | * (float)m_scene.RegionInfo.ObjectCapacity); | 271 | * (float)m_scene.RegionInfo.ObjectCapacity); |
272 | ======= | ||
273 | int simMax = (int)( (long)LandData.SimwideArea | ||
274 | * (long)m_scene.RegionInfo.ObjectCapacity | ||
275 | / (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) ); | ||
276 | // m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}", LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax); | ||
277 | >>>>>>> avn/ubitvar | ||
217 | return simMax; | 278 | return simMax; |
218 | } | 279 | } |
219 | } | 280 | } |
@@ -224,6 +285,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
224 | 285 | ||
225 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) | 286 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) |
226 | { | 287 | { |
288 | if (remote_client.SceneAgent.PresenceType == PresenceType.Npc) | ||
289 | return; | ||
290 | |||
227 | IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); | 291 | IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); |
228 | // uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome)); | 292 | // uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome)); |
229 | uint regionFlags = (uint)(RegionFlags.PublicAllowed | 293 | uint regionFlags = (uint)(RegionFlags.PublicAllowed |
@@ -248,14 +312,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
248 | remote_client.SendLandProperties(seq_id, | 312 | remote_client.SendLandProperties(seq_id, |
249 | snap_selection, request_result, this, | 313 | snap_selection, request_result, this, |
250 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, | 314 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, |
251 | GetParcelMaxPrimCount(), | 315 | GetParcelBasePrimCount(), |
252 | GetSimulatorMaxPrimCount(), regionFlags); | 316 | GetSimulatorMaxPrimCount(), regionFlags); |
253 | } | 317 | } |
254 | 318 | ||
255 | public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) | 319 | public bool UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client, out bool snap_selection, out bool needOverlay) |
256 | { | 320 | { |
257 | //Needs later group support | 321 | //Needs later group support |
258 | bool snap_selection = false; | 322 | snap_selection = false; |
323 | needOverlay = false; | ||
259 | LandData newData = LandData.Copy(); | 324 | LandData newData = LandData.Copy(); |
260 | 325 | ||
261 | uint allowedDelta = 0; | 326 | uint allowedDelta = 0; |
@@ -264,7 +329,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
264 | // ParcelFlags.ForSaleObjects | 329 | // ParcelFlags.ForSaleObjects |
265 | // ParcelFlags.LindenHome | 330 | // ParcelFlags.LindenHome |
266 | 331 | ||
267 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) | 332 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions, false)) |
268 | { | 333 | { |
269 | allowedDelta |= (uint)(ParcelFlags.AllowLandmark | | 334 | allowedDelta |= (uint)(ParcelFlags.AllowLandmark | |
270 | ParcelFlags.AllowTerraform | | 335 | ParcelFlags.AllowTerraform | |
@@ -277,9 +342,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
277 | ParcelFlags.AllowAPrimitiveEntry | | 342 | ParcelFlags.AllowAPrimitiveEntry | |
278 | ParcelFlags.AllowGroupObjectEntry | | 343 | ParcelFlags.AllowGroupObjectEntry | |
279 | ParcelFlags.AllowFly); | 344 | ParcelFlags.AllowFly); |
345 | newData.SeeAVs = args.SeeAVs; | ||
346 | newData.AnyAVSounds = args.AnyAVSounds; | ||
347 | newData.GroupAVSounds = args.GroupAVSounds; | ||
280 | } | 348 | } |
281 | 349 | ||
282 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale)) | 350 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale, true)) |
283 | { | 351 | { |
284 | if (args.AuthBuyerID != newData.AuthBuyerID || | 352 | if (args.AuthBuyerID != newData.AuthBuyerID || |
285 | args.SalePrice != newData.SalePrice) | 353 | args.SalePrice != newData.SalePrice) |
@@ -302,30 +370,30 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
302 | allowedDelta |= (uint)ParcelFlags.ForSale; | 370 | allowedDelta |= (uint)ParcelFlags.ForSale; |
303 | } | 371 | } |
304 | 372 | ||
305 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.FindPlaces)) | 373 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.FindPlaces, false)) |
306 | { | 374 | { |
307 | newData.Category = args.Category; | 375 | newData.Category = args.Category; |
308 | 376 | ||
309 | allowedDelta |= (uint)(ParcelFlags.ShowDirectory | | 377 | allowedDelta |= (uint)(ParcelFlags.ShowDirectory | |
310 | ParcelFlags.AllowPublish | | 378 | ParcelFlags.AllowPublish | |
311 | ParcelFlags.MaturePublish); | 379 | ParcelFlags.MaturePublish) | (uint)(1 << 23); |
312 | } | 380 | } |
313 | 381 | ||
314 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity)) | 382 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity, false)) |
315 | { | 383 | { |
316 | newData.Description = args.Desc; | 384 | newData.Description = args.Desc; |
317 | newData.Name = args.Name; | 385 | newData.Name = args.Name; |
318 | newData.SnapshotID = args.SnapshotID; | 386 | newData.SnapshotID = args.SnapshotID; |
319 | } | 387 | } |
320 | 388 | ||
321 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.SetLandingPoint)) | 389 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.SetLandingPoint, false)) |
322 | { | 390 | { |
323 | newData.LandingType = args.LandingType; | 391 | newData.LandingType = args.LandingType; |
324 | newData.UserLocation = args.UserLocation; | 392 | newData.UserLocation = args.UserLocation; |
325 | newData.UserLookAt = args.UserLookAt; | 393 | newData.UserLookAt = args.UserLookAt; |
326 | } | 394 | } |
327 | 395 | ||
328 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.ChangeMedia)) | 396 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.ChangeMedia, false)) |
329 | { | 397 | { |
330 | newData.MediaAutoScale = args.MediaAutoScale; | 398 | newData.MediaAutoScale = args.MediaAutoScale; |
331 | newData.MediaID = args.MediaID; | 399 | newData.MediaID = args.MediaID; |
@@ -346,7 +414,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
346 | ParcelFlags.UseEstateVoiceChan); | 414 | ParcelFlags.UseEstateVoiceChan); |
347 | } | 415 | } |
348 | 416 | ||
349 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandManagePasses)) | 417 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandManagePasses, false)) |
350 | { | 418 | { |
351 | newData.PassHours = args.PassHours; | 419 | newData.PassHours = args.PassHours; |
352 | newData.PassPrice = args.PassPrice; | 420 | newData.PassPrice = args.PassPrice; |
@@ -354,13 +422,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
354 | allowedDelta |= (uint)ParcelFlags.UsePassList; | 422 | allowedDelta |= (uint)ParcelFlags.UsePassList; |
355 | } | 423 | } |
356 | 424 | ||
357 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageAllowed)) | 425 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageAllowed, false)) |
358 | { | 426 | { |
359 | allowedDelta |= (uint)(ParcelFlags.UseAccessGroup | | 427 | allowedDelta |= (uint)(ParcelFlags.UseAccessGroup | |
360 | ParcelFlags.UseAccessList); | 428 | ParcelFlags.UseAccessList); |
361 | } | 429 | } |
362 | 430 | ||
363 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageBanned)) | 431 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageBanned, false)) |
364 | { | 432 | { |
365 | allowedDelta |= (uint)(ParcelFlags.UseBanList | | 433 | allowedDelta |= (uint)(ParcelFlags.UseBanList | |
366 | ParcelFlags.DenyAnonymous | | 434 | ParcelFlags.DenyAnonymous | |
@@ -371,10 +439,24 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
371 | { | 439 | { |
372 | uint preserve = LandData.Flags & ~allowedDelta; | 440 | uint preserve = LandData.Flags & ~allowedDelta; |
373 | newData.Flags = preserve | (args.ParcelFlags & allowedDelta); | 441 | newData.Flags = preserve | (args.ParcelFlags & allowedDelta); |
442 | <<<<<<< HEAD | ||
374 | 443 | ||
375 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); | 444 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); |
376 | SendLandUpdateToAvatarsOverMe(snap_selection); | 445 | SendLandUpdateToAvatarsOverMe(snap_selection); |
377 | } | 446 | } |
447 | ======= | ||
448 | |||
449 | uint curdelta = LandData.Flags ^ newData.Flags; | ||
450 | curdelta &= (uint)(ParcelFlags.SoundLocal); | ||
451 | |||
452 | if(curdelta != 0 || newData.SeeAVs != LandData.SeeAVs) | ||
453 | needOverlay = true; | ||
454 | |||
455 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); | ||
456 | return true; | ||
457 | } | ||
458 | return false; | ||
459 | >>>>>>> avn/ubitvar | ||
378 | } | 460 | } |
379 | 461 | ||
380 | public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) | 462 | public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) |
@@ -395,7 +477,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
395 | UUID previousOwner = LandData.OwnerID; | 477 | UUID previousOwner = LandData.OwnerID; |
396 | 478 | ||
397 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); | 479 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); |
398 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | 480 | // m_scene.EventManager.TriggerParcelPrimCountUpdate(); |
399 | SendLandUpdateToAvatarsOverMe(true); | 481 | SendLandUpdateToAvatarsOverMe(true); |
400 | 482 | ||
401 | if (sellObjects) SellLandObjects(previousOwner); | 483 | if (sellObjects) SellLandObjects(previousOwner); |
@@ -568,6 +650,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
568 | 650 | ||
569 | public void SendLandUpdateToAvatarsOverMe(bool snap_selection) | 651 | public void SendLandUpdateToAvatarsOverMe(bool snap_selection) |
570 | { | 652 | { |
653 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | ||
571 | m_scene.ForEachRootScenePresence(delegate(ScenePresence avatar) | 654 | m_scene.ForEachRootScenePresence(delegate(ScenePresence avatar) |
572 | { | 655 | { |
573 | ILandObject over = null; | 656 | ILandObject over = null; |
@@ -594,6 +677,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
594 | avatar.Invulnerable = true; | 677 | avatar.Invulnerable = true; |
595 | 678 | ||
596 | SendLandUpdateToClient(snap_selection, avatar.ControllingClient); | 679 | SendLandUpdateToClient(snap_selection, avatar.ControllingClient); |
680 | avatar.currentParcelUUID = LandData.GlobalID; | ||
597 | } | 681 | } |
598 | } | 682 | } |
599 | }); | 683 | }); |
@@ -722,10 +806,17 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
722 | /// </summary> | 806 | /// </summary> |
723 | private void UpdateAABBAndAreaValues() | 807 | private void UpdateAABBAndAreaValues() |
724 | { | 808 | { |
809 | <<<<<<< HEAD | ||
725 | int min_x = 10000; | 810 | int min_x = 10000; |
726 | int min_y = 10000; | 811 | int min_y = 10000; |
727 | int max_x = 0; | 812 | int max_x = 0; |
728 | int max_y = 0; | 813 | int max_y = 0; |
814 | ======= | ||
815 | int min_x = Int32.MaxValue; | ||
816 | int min_y = Int32.MaxValue; | ||
817 | int max_x = Int32.MinValue; | ||
818 | int max_y = Int32.MinValue; | ||
819 | >>>>>>> avn/ubitvar | ||
729 | int tempArea = 0; | 820 | int tempArea = 0; |
730 | int x, y; | 821 | int x, y; |
731 | for (x = 0; x < LandBitmap.GetLength(0); x++) | 822 | for (x = 0; x < LandBitmap.GetLength(0); x++) |
@@ -734,10 +825,21 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
734 | { | 825 | { |
735 | if (LandBitmap[x, y] == true) | 826 | if (LandBitmap[x, y] == true) |
736 | { | 827 | { |
828 | <<<<<<< HEAD | ||
737 | if (min_x > x) min_x = x; | 829 | if (min_x > x) min_x = x; |
738 | if (min_y > y) min_y = y; | 830 | if (min_y > y) min_y = y; |
739 | if (max_x < x) max_x = x; | 831 | if (max_x < x) max_x = x; |
740 | if (max_y < y) max_y = y; | 832 | if (max_y < y) max_y = y; |
833 | ======= | ||
834 | if (min_x > x) | ||
835 | min_x = x; | ||
836 | if (min_y > y) | ||
837 | min_y = y; | ||
838 | if (max_x < x) | ||
839 | max_x = x; | ||
840 | if (max_y < y) | ||
841 | max_y = y; | ||
842 | >>>>>>> avn/ubitvar | ||
741 | tempArea += landUnit * landUnit; //16sqm peice of land | 843 | tempArea += landUnit * landUnit; //16sqm peice of land |
742 | } | 844 | } |
743 | } | 845 | } |
@@ -745,6 +847,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
745 | int tx = min_x * landUnit; | 847 | int tx = min_x * landUnit; |
746 | if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1)) | 848 | if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1)) |
747 | tx = ((int)m_scene.RegionInfo.RegionSizeX - 1); | 849 | tx = ((int)m_scene.RegionInfo.RegionSizeX - 1); |
850 | <<<<<<< HEAD | ||
748 | int ty = min_y * landUnit; | 851 | int ty = min_y * landUnit; |
749 | if (ty > ((int)m_scene.RegionInfo.RegionSizeY - 1)) | 852 | if (ty > ((int)m_scene.RegionInfo.RegionSizeY - 1)) |
750 | ty = ((int)m_scene.RegionInfo.RegionSizeY - 1); | 853 | ty = ((int)m_scene.RegionInfo.RegionSizeY - 1); |
@@ -763,6 +866,45 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
763 | LandData.AABBMax | 866 | LandData.AABBMax |
764 | = new Vector3( | 867 | = new Vector3( |
765 | (float)(max_x * landUnit), (float)(max_y * landUnit), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0); | 868 | (float)(max_x * landUnit), (float)(max_y * landUnit), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0); |
869 | ======= | ||
870 | |||
871 | int htx; | ||
872 | if (tx >= ((int)m_scene.RegionInfo.RegionSizeX)) | ||
873 | htx = (int)m_scene.RegionInfo.RegionSizeX - 1; | ||
874 | else | ||
875 | htx = tx; | ||
876 | |||
877 | int ty = min_y * landUnit; | ||
878 | int hty; | ||
879 | |||
880 | if (ty >= ((int)m_scene.RegionInfo.RegionSizeY)) | ||
881 | hty = (int)m_scene.RegionInfo.RegionSizeY - 1; | ||
882 | else | ||
883 | hty = ty; | ||
884 | |||
885 | LandData.AABBMin = | ||
886 | new Vector3( | ||
887 | (float)(tx), (float)(ty), m_scene != null ? (float)m_scene.Heightmap[htx, hty] : 0); | ||
888 | |||
889 | max_x++; | ||
890 | tx = max_x * landUnit; | ||
891 | if (tx >= ((int)m_scene.RegionInfo.RegionSizeX)) | ||
892 | htx = (int)m_scene.RegionInfo.RegionSizeX - 1; | ||
893 | else | ||
894 | htx = tx; | ||
895 | |||
896 | max_y++; | ||
897 | ty = max_y * 4; | ||
898 | |||
899 | if (ty >= ((int)m_scene.RegionInfo.RegionSizeY)) | ||
900 | hty = (int)m_scene.RegionInfo.RegionSizeY - 1; | ||
901 | else | ||
902 | hty = ty; | ||
903 | |||
904 | LandData.AABBMax | ||
905 | = new Vector3( | ||
906 | (float)(tx), (float)(ty), m_scene != null ? (float)m_scene.Heightmap[htx, hty] : 0); | ||
907 | >>>>>>> avn/ubitvar | ||
766 | 908 | ||
767 | LandData.Area = tempArea; | 909 | LandData.Area = tempArea; |
768 | } | 910 | } |
@@ -778,7 +920,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
778 | public void SetLandBitmap(bool[,] bitmap) | 920 | public void SetLandBitmap(bool[,] bitmap) |
779 | { | 921 | { |
780 | LandBitmap = bitmap; | 922 | LandBitmap = bitmap; |
923 | <<<<<<< HEAD | ||
781 | // m_log.DebugFormat("{0} SetLandBitmap. BitmapSize=<{1},{2}>", LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1)); | 924 | // m_log.DebugFormat("{0} SetLandBitmap. BitmapSize=<{1},{2}>", LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1)); |
925 | ======= | ||
926 | >>>>>>> avn/ubitvar | ||
782 | ForceUpdateLandInfo(); | 927 | ForceUpdateLandInfo(); |
783 | } | 928 | } |
784 | 929 | ||
@@ -879,13 +1024,37 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
879 | private byte[] ConvertLandBitmapToBytes() | 1024 | private byte[] ConvertLandBitmapToBytes() |
880 | { | 1025 | { |
881 | byte[] tempConvertArr = new byte[LandBitmap.GetLength(0) * LandBitmap.GetLength(1) / 8]; | 1026 | byte[] tempConvertArr = new byte[LandBitmap.GetLength(0) * LandBitmap.GetLength(1) / 8]; |
1027 | <<<<<<< HEAD | ||
882 | byte tempByte = 0; | 1028 | byte tempByte = 0; |
883 | int byteNum = 0; | 1029 | int byteNum = 0; |
884 | int i = 0; | 1030 | int i = 0; |
1031 | ======= | ||
1032 | int tempByte = 0; | ||
1033 | int i, byteNum = 0; | ||
1034 | int mask = 1; | ||
1035 | i = 0; | ||
1036 | >>>>>>> avn/ubitvar | ||
885 | for (int y = 0; y < LandBitmap.GetLength(1); y++) | 1037 | for (int y = 0; y < LandBitmap.GetLength(1); y++) |
886 | { | 1038 | { |
887 | for (int x = 0; x < LandBitmap.GetLength(0); x++) | 1039 | for (int x = 0; x < LandBitmap.GetLength(0); x++) |
888 | { | 1040 | { |
1041 | if (LandBitmap[x, y]) | ||
1042 | tempByte |= mask; | ||
1043 | mask = mask << 1; | ||
1044 | if (mask == 0x100) | ||
1045 | { | ||
1046 | mask = 1; | ||
1047 | tempConvertArr[byteNum++] = (byte)tempByte; | ||
1048 | tempByte = 0; | ||
1049 | } | ||
1050 | } | ||
1051 | } | ||
1052 | |||
1053 | if(tempByte != 0 && byteNum < 512) | ||
1054 | tempConvertArr[byteNum] = (byte)tempByte; | ||
1055 | |||
1056 | |||
1057 | /* | ||
889 | tempByte = Convert.ToByte(tempByte | Convert.ToByte(LandBitmap[x, y]) << (i++ % 8)); | 1058 | tempByte = Convert.ToByte(tempByte | Convert.ToByte(LandBitmap[x, y]) << (i++ % 8)); |
890 | if (i % 8 == 0) | 1059 | if (i % 8 == 0) |
891 | { | 1060 | { |
@@ -894,10 +1063,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
894 | i = 0; | 1063 | i = 0; |
895 | byteNum++; | 1064 | byteNum++; |
896 | } | 1065 | } |
1066 | <<<<<<< HEAD | ||
897 | } | 1067 | } |
898 | } | 1068 | } |
899 | // m_log.DebugFormat("{0} ConvertLandBitmapToBytes. BitmapSize=<{1},{2}>", | 1069 | // m_log.DebugFormat("{0} ConvertLandBitmapToBytes. BitmapSize=<{1},{2}>", |
900 | // LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1)); | 1070 | // LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1)); |
1071 | ======= | ||
1072 | */ | ||
1073 | >>>>>>> avn/ubitvar | ||
901 | return tempConvertArr; | 1074 | return tempConvertArr; |
902 | } | 1075 | } |
903 | 1076 | ||
@@ -951,7 +1124,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
951 | 1124 | ||
952 | public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) | 1125 | public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) |
953 | { | 1126 | { |
954 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) | 1127 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions, true)) |
955 | { | 1128 | { |
956 | List<uint> resultLocalIDs = new List<uint>(); | 1129 | List<uint> resultLocalIDs = new List<uint>(); |
957 | try | 1130 | try |
@@ -1001,7 +1174,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1001 | /// </param> | 1174 | /// </param> |
1002 | public void SendLandObjectOwners(IClientAPI remote_client) | 1175 | public void SendLandObjectOwners(IClientAPI remote_client) |
1003 | { | 1176 | { |
1004 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions)) | 1177 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions, true)) |
1005 | { | 1178 | { |
1006 | Dictionary<UUID, int> primCount = new Dictionary<UUID, int>(); | 1179 | Dictionary<UUID, int> primCount = new Dictionary<UUID, int>(); |
1007 | List<UUID> groups = new List<UUID>(); | 1180 | List<UUID> groups = new List<UUID>(); |
@@ -1233,6 +1406,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1233 | public void SetMediaUrl(string url) | 1406 | public void SetMediaUrl(string url) |
1234 | { | 1407 | { |
1235 | LandData.MediaURL = url; | 1408 | LandData.MediaURL = url; |
1409 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, LandData); | ||
1236 | SendLandUpdateToAvatarsOverMe(); | 1410 | SendLandUpdateToAvatarsOverMe(); |
1237 | } | 1411 | } |
1238 | 1412 | ||
@@ -1243,6 +1417,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1243 | public void SetMusicUrl(string url) | 1417 | public void SetMusicUrl(string url) |
1244 | { | 1418 | { |
1245 | LandData.MusicURL = url; | 1419 | LandData.MusicURL = url; |
1420 | m_scene.LandChannel.UpdateLandObject(LandData.LocalID, LandData); | ||
1246 | SendLandUpdateToAvatarsOverMe(); | 1421 | SendLandUpdateToAvatarsOverMe(); |
1247 | } | 1422 | } |
1248 | 1423 | ||
@@ -1257,6 +1432,17 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1257 | 1432 | ||
1258 | #endregion | 1433 | #endregion |
1259 | 1434 | ||
1435 | private void OnFrame() | ||
1436 | { | ||
1437 | m_expiryCounter++; | ||
1438 | |||
1439 | if (m_expiryCounter >= 50) | ||
1440 | { | ||
1441 | ExpireAccessList(); | ||
1442 | m_expiryCounter = 0; | ||
1443 | } | ||
1444 | } | ||
1445 | |||
1260 | private void ExpireAccessList() | 1446 | private void ExpireAccessList() |
1261 | { | 1447 | { |
1262 | List<LandAccessEntry> delete = new List<LandAccessEntry>(); | 1448 | List<LandAccessEntry> delete = new List<LandAccessEntry>(); |
@@ -1267,7 +1453,22 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1267 | delete.Add(entry); | 1453 | delete.Add(entry); |
1268 | } | 1454 | } |
1269 | foreach (LandAccessEntry entry in delete) | 1455 | foreach (LandAccessEntry entry in delete) |
1456 | { | ||
1270 | LandData.ParcelAccessList.Remove(entry); | 1457 | LandData.ParcelAccessList.Remove(entry); |
1458 | ScenePresence presence; | ||
1459 | |||
1460 | if (m_scene.TryGetScenePresence(entry.AgentID, out presence) && (!presence.IsChildAgent)) | ||
1461 | { | ||
1462 | ILandObject land = m_scene.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); | ||
1463 | if (land.LandData.LocalID == LandData.LocalID) | ||
1464 | { | ||
1465 | Vector3 pos = m_scene.GetNearestAllowedPosition(presence, land); | ||
1466 | presence.TeleportWithMomentum(pos, null); | ||
1467 | presence.ControllingClient.SendAlertMessage("You have been ejected from this land"); | ||
1468 | } | ||
1469 | } | ||
1470 | m_log.DebugFormat("[LAND]: Removing entry {0} because it has expired", entry.AgentID); | ||
1471 | } | ||
1271 | 1472 | ||
1272 | if (delete.Count > 0) | 1473 | if (delete.Count > 0) |
1273 | m_scene.EventManager.TriggerLandObjectUpdated((uint)LandData.LocalID, this); | 1474 | m_scene.EventManager.TriggerLandObjectUpdated((uint)LandData.LocalID, this); |
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 9b51cc8..771fdd2 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | |||
@@ -207,7 +207,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
207 | if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) | 207 | if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) |
208 | { | 208 | { |
209 | UUID landOwner = landData.OwnerID; | 209 | UUID landOwner = landData.OwnerID; |
210 | int partCount = obj.Parts.Length; | 210 | int partCount = obj.GetPartCount(); |
211 | 211 | ||
212 | m_SimwideCounts[landOwner] += partCount; | 212 | m_SimwideCounts[landOwner] += partCount; |
213 | if (parcelCounts.Users.ContainsKey(obj.OwnerID)) | 213 | if (parcelCounts.Users.ContainsKey(obj.OwnerID)) |
@@ -597,4 +597,4 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
597 | } | 597 | } |
598 | } | 598 | } |
599 | } | 599 | } |
600 | } \ No newline at end of file | 600 | } |
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index 796a15f..a228e7a 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | |||
@@ -104,6 +104,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
104 | 104 | ||
105 | terrainRenderer.Initialise(m_scene, m_config); | 105 | terrainRenderer.Initialise(m_scene, m_config); |
106 | 106 | ||
107 | <<<<<<< HEAD | ||
107 | mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, | 108 | mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, |
108 | System.Drawing.Imaging.PixelFormat.Format24bppRgb); | 109 | System.Drawing.Imaging.PixelFormat.Format24bppRgb); |
109 | //long t = System.Environment.TickCount; | 110 | //long t = System.Environment.TickCount; |
@@ -112,6 +113,16 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
112 | //} | 113 | //} |
113 | //t = System.Environment.TickCount - t; | 114 | //t = System.Environment.TickCount - t; |
114 | //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); | 115 | //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); |
116 | ======= | ||
117 | mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, | ||
118 | System.Drawing.Imaging.PixelFormat.Format24bppRgb); | ||
119 | //long t = System.Environment.TickCount; | ||
120 | //for (int i = 0; i < 10; ++i) { | ||
121 | terrainRenderer.TerrainToBitmap(mapbmp); | ||
122 | //} | ||
123 | //t = System.Environment.TickCount - t; | ||
124 | //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); | ||
125 | >>>>>>> avn/ubitvar | ||
115 | 126 | ||
116 | if (drawPrimVolume) | 127 | if (drawPrimVolume) |
117 | { | 128 | { |
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs index 9f23141..a9cc993 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs | |||
@@ -270,8 +270,14 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
270 | 270 | ||
271 | // the heigthfield might have some jumps in values. Rendered land is smooth, though, | 271 | // the heigthfield might have some jumps in values. Rendered land is smooth, though, |
272 | // as a slope is rendered at that place. So average 4 neighbour values to emulate that. | 272 | // as a slope is rendered at that place. So average 4 neighbour values to emulate that. |
273 | <<<<<<< HEAD | ||
273 | private float getHeight(ITerrainChannel hm, int x, int y) { | 274 | private float getHeight(ITerrainChannel hm, int x, int y) { |
274 | if (x < (hm.Width - 1) && y < (hm.Height - 1)) | 275 | if (x < (hm.Width - 1) && y < (hm.Height - 1)) |
276 | ======= | ||
277 | private float getHeight(ITerrainChannel hm, int x, int y) | ||
278 | { | ||
279 | if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1)) | ||
280 | >>>>>>> avn/ubitvar | ||
275 | return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112); | 281 | return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112); |
276 | else | 282 | else |
277 | return (float)hm[x, y]; | 283 | return (float)hm[x, y]; |
@@ -291,6 +297,14 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
291 | LogHeader, mapbmp.Width, mapbmp.Height, hm.Width, hm.Height); | 297 | LogHeader, mapbmp.Width, mapbmp.Height, hm.Width, hm.Height); |
292 | } | 298 | } |
293 | 299 | ||
300 | ITerrainChannel hm = m_scene.Heightmap; | ||
301 | |||
302 | if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height) | ||
303 | { | ||
304 | m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>", | ||
305 | "[TEXTURED MAP TILE RENDERER]", mapbmp.Width, mapbmp.Height, hm.Width, hm.Height); | ||
306 | } | ||
307 | |||
294 | // These textures should be in the AssetCache anyway, as every client conneting to this | 308 | // These textures should be in the AssetCache anyway, as every client conneting to this |
295 | // region needs them. Except on start, when the map is recreated (before anyone connected), | 309 | // region needs them. Except on start, when the map is recreated (before anyone connected), |
296 | // and on change of the estate settings (textures and terrain values), when the map should | 310 | // and on change of the estate settings (textures and terrain values), when the map should |
@@ -371,8 +385,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
371 | // first, rescale h to 0.0 - 1.0 | 385 | // first, rescale h to 0.0 - 1.0 |
372 | hmod = (hmod - low) / (high - low); | 386 | hmod = (hmod - low) / (high - low); |
373 | // now we have to split: 0.00 => color1, 0.33 => color2, 0.67 => color3, 1.00 => color4 | 387 | // now we have to split: 0.00 => color1, 0.33 => color2, 0.67 => color3, 1.00 => color4 |
374 | if (hmod < 1f/3f) hsv = interpolateHSV(ref hsv1, ref hsv2, hmod * 3f); | 388 | if (hmod < 1f / 3f) hsv = interpolateHSV(ref hsv1, ref hsv2, hmod * 3f); |
375 | else if (hmod < 2f/3f) hsv = interpolateHSV(ref hsv2, ref hsv3, (hmod * 3f) - 1f); | 389 | else if (hmod < 2f / 3f) hsv = interpolateHSV(ref hsv2, ref hsv3, (hmod * 3f) - 1f); |
376 | else hsv = interpolateHSV(ref hsv3, ref hsv4, (hmod * 3f) - 2f); | 390 | else hsv = interpolateHSV(ref hsv3, ref hsv4, (hmod * 3f) - 2f); |
377 | } | 391 | } |
378 | 392 | ||
diff --git a/OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs index 0a4e83e..f13d648 100644 --- a/OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs | |||
@@ -190,6 +190,9 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
190 | 190 | ||
191 | public void SendProfileToClient(IClientAPI client, RegionLightShareData wl) | 191 | public void SendProfileToClient(IClientAPI client, RegionLightShareData wl) |
192 | { | 192 | { |
193 | if (client == null) | ||
194 | return; | ||
195 | |||
193 | if (m_enableWindlight) | 196 | if (m_enableWindlight) |
194 | { | 197 | { |
195 | if (m_scene.RegionInfo.WindlightSettings.valid) | 198 | if (m_scene.RegionInfo.WindlightSettings.valid) |
@@ -207,8 +210,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
207 | 210 | ||
208 | private void EventManager_OnMakeRootAgent(ScenePresence presence) | 211 | private void EventManager_OnMakeRootAgent(ScenePresence presence) |
209 | { | 212 | { |
210 | // m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client {0}", presence.Name); | 213 | if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) |
211 | 214 | m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client"); | |
212 | SendProfileToClient(presence.ControllingClient); | 215 | SendProfileToClient(presence.ControllingClient); |
213 | } | 216 | } |
214 | 217 | ||
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 2abc910..0e0f05f 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | |||
@@ -173,6 +173,13 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
173 | return false; | 173 | return false; |
174 | } | 174 | } |
175 | 175 | ||
176 | if ((perms & (uint)PermissionMask.Copy) == 0) | ||
177 | { | ||
178 | if (m_dialogModule != null) | ||
179 | m_dialogModule.SendAlertToUser(remoteClient, "This sale has been blocked by the permissions system"); | ||
180 | return false; | ||
181 | } | ||
182 | |||
176 | AssetBase asset = m_scene.CreateAsset( | 183 | AssetBase asset = m_scene.CreateAsset( |
177 | group.GetPartName(localID), | 184 | group.GetPartName(localID), |
178 | group.GetPartDescription(localID), | 185 | group.GetPartDescription(localID), |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 780ec69..12e8fb1 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -43,8 +43,8 @@ using PermissionMask = OpenSim.Framework.PermissionMask; | |||
43 | 43 | ||
44 | namespace OpenSim.Region.CoreModules.World.Permissions | 44 | namespace OpenSim.Region.CoreModules.World.Permissions |
45 | { | 45 | { |
46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PermissionsModule")] | 46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DefaultPermissionsModule")] |
47 | public class PermissionsModule : INonSharedRegionModule, IPermissionsModule | 47 | public class DefaultPermissionsModule : INonSharedRegionModule, IPermissionsModule |
48 | { | 48 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
@@ -349,7 +349,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
349 | 349 | ||
350 | public string Name | 350 | public string Name |
351 | { | 351 | { |
352 | get { return "PermissionsModule"; } | 352 | get { return "DefaultPermissionsModule"; } |
353 | } | 353 | } |
354 | 354 | ||
355 | public Type ReplaceableInterface | 355 | public Type ReplaceableInterface |
@@ -1052,7 +1052,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1052 | return GenericObjectPermission(editorID, objectID, false); | 1052 | return GenericObjectPermission(editorID, objectID, false); |
1053 | } | 1053 | } |
1054 | 1054 | ||
1055 | private bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, Scene scene) | 1055 | private bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, Scene scene, bool allowManager) |
1056 | { | 1056 | { |
1057 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1057 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1058 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1058 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index 75a8295..e6a0205 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs | |||
@@ -29,6 +29,8 @@ using System; | |||
29 | using System.Linq; | 29 | using System.Linq; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Timers; | 31 | using System.Timers; |
32 | using System.IO; | ||
33 | using System.Diagnostics; | ||
32 | using System.Threading; | 34 | using System.Threading; |
33 | using System.Collections.Generic; | 35 | using System.Collections.Generic; |
34 | using log4net; | 36 | using log4net; |
@@ -57,13 +59,24 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
57 | protected UUID m_Initiator; | 59 | protected UUID m_Initiator; |
58 | protected bool m_Notice = false; | 60 | protected bool m_Notice = false; |
59 | protected IDialogModule m_DialogModule = null; | 61 | protected IDialogModule m_DialogModule = null; |
62 | protected string m_MarkerPath = String.Empty; | ||
63 | private int[] m_CurrentAlerts = null; | ||
60 | 64 | ||
61 | public void Initialise(IConfigSource config) | 65 | public void Initialise(IConfigSource config) |
62 | { | 66 | { |
67 | IConfig restartConfig = config.Configs["RestartModule"]; | ||
68 | if (restartConfig != null) | ||
69 | { | ||
70 | m_MarkerPath = restartConfig.GetString("MarkerPath", String.Empty); | ||
71 | } | ||
63 | } | 72 | } |
64 | 73 | ||
65 | public void AddRegion(Scene scene) | 74 | public void AddRegion(Scene scene) |
66 | { | 75 | { |
76 | if (m_MarkerPath != String.Empty) | ||
77 | File.Delete(Path.Combine(m_MarkerPath, | ||
78 | scene.RegionInfo.RegionID.ToString())); | ||
79 | |||
67 | m_Scene = scene; | 80 | m_Scene = scene; |
68 | 81 | ||
69 | scene.RegisterModuleInterface<IRestartModule>(this); | 82 | scene.RegisterModuleInterface<IRestartModule>(this); |
@@ -118,10 +131,14 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
118 | public void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice) | 131 | public void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice) |
119 | { | 132 | { |
120 | if (m_CountdownTimer != null) | 133 | if (m_CountdownTimer != null) |
121 | return; | 134 | { |
135 | m_CountdownTimer.Stop(); | ||
136 | m_CountdownTimer = null; | ||
137 | } | ||
122 | 138 | ||
123 | if (alerts == null) | 139 | if (alerts == null) |
124 | { | 140 | { |
141 | CreateMarkerFile(); | ||
125 | m_Scene.RestartNow(); | 142 | m_Scene.RestartNow(); |
126 | return; | 143 | return; |
127 | } | 144 | } |
@@ -129,25 +146,28 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
129 | m_Message = message; | 146 | m_Message = message; |
130 | m_Initiator = initiator; | 147 | m_Initiator = initiator; |
131 | m_Notice = notice; | 148 | m_Notice = notice; |
149 | m_CurrentAlerts = alerts; | ||
132 | m_Alerts = new List<int>(alerts); | 150 | m_Alerts = new List<int>(alerts); |
133 | m_Alerts.Sort(); | 151 | m_Alerts.Sort(); |
134 | m_Alerts.Reverse(); | 152 | m_Alerts.Reverse(); |
135 | 153 | ||
136 | if (m_Alerts[0] == 0) | 154 | if (m_Alerts[0] == 0) |
137 | { | 155 | { |
156 | CreateMarkerFile(); | ||
138 | m_Scene.RestartNow(); | 157 | m_Scene.RestartNow(); |
139 | return; | 158 | return; |
140 | } | 159 | } |
141 | 160 | ||
142 | int nextInterval = DoOneNotice(); | 161 | int nextInterval = DoOneNotice(true); |
143 | 162 | ||
144 | SetTimer(nextInterval); | 163 | SetTimer(nextInterval); |
145 | } | 164 | } |
146 | 165 | ||
147 | public int DoOneNotice() | 166 | public int DoOneNotice(bool sendOut) |
148 | { | 167 | { |
149 | if (m_Alerts.Count == 0 || m_Alerts[0] == 0) | 168 | if (m_Alerts.Count == 0 || m_Alerts[0] == 0) |
150 | { | 169 | { |
170 | CreateMarkerFile(); | ||
151 | m_Scene.RestartNow(); | 171 | m_Scene.RestartNow(); |
152 | return 0; | 172 | return 0; |
153 | } | 173 | } |
@@ -168,34 +188,37 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
168 | 188 | ||
169 | m_Alerts.RemoveAt(0); | 189 | m_Alerts.RemoveAt(0); |
170 | 190 | ||
171 | int minutes = currentAlert / 60; | 191 | if (sendOut) |
172 | string currentAlertString = String.Empty; | ||
173 | if (minutes > 0) | ||
174 | { | 192 | { |
175 | if (minutes == 1) | 193 | int minutes = currentAlert / 60; |
176 | currentAlertString += "1 minute"; | 194 | string currentAlertString = String.Empty; |
177 | else | 195 | if (minutes > 0) |
178 | currentAlertString += String.Format("{0} minutes", minutes); | 196 | { |
197 | if (minutes == 1) | ||
198 | currentAlertString += "1 minute"; | ||
199 | else | ||
200 | currentAlertString += String.Format("{0} minutes", minutes); | ||
201 | if ((currentAlert % 60) != 0) | ||
202 | currentAlertString += " and "; | ||
203 | } | ||
179 | if ((currentAlert % 60) != 0) | 204 | if ((currentAlert % 60) != 0) |
180 | currentAlertString += " and "; | 205 | { |
181 | } | 206 | int seconds = currentAlert % 60; |
182 | if ((currentAlert % 60) != 0) | 207 | if (seconds == 1) |
183 | { | 208 | currentAlertString += "1 second"; |
184 | int seconds = currentAlert % 60; | 209 | else |
185 | if (seconds == 1) | 210 | currentAlertString += String.Format("{0} seconds", seconds); |
186 | currentAlertString += "1 second"; | 211 | } |
187 | else | ||
188 | currentAlertString += String.Format("{0} seconds", seconds); | ||
189 | } | ||
190 | 212 | ||
191 | string msg = String.Format(m_Message, currentAlertString); | 213 | string msg = String.Format(m_Message, currentAlertString); |
192 | 214 | ||
193 | if (m_DialogModule != null && msg != String.Empty) | 215 | if (m_DialogModule != null && msg != String.Empty) |
194 | { | 216 | { |
195 | if (m_Notice) | 217 | if (m_Notice) |
196 | m_DialogModule.SendGeneralAlert(msg); | 218 | m_DialogModule.SendGeneralAlert(msg); |
197 | else | 219 | else |
198 | m_DialogModule.SendNotificationToUsersInRegion(m_Initiator, "System", msg); | 220 | m_DialogModule.SendNotificationToUsersInRegion(m_Initiator, "System", msg); |
221 | } | ||
199 | } | 222 | } |
200 | 223 | ||
201 | return currentAlert - nextAlert; | 224 | return currentAlert - nextAlert; |
@@ -226,7 +249,27 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
226 | 249 | ||
227 | private void OnTimer(object source, ElapsedEventArgs e) | 250 | private void OnTimer(object source, ElapsedEventArgs e) |
228 | { | 251 | { |
229 | SetTimer(DoOneNotice()); | 252 | int nextInterval = DoOneNotice(true); |
253 | |||
254 | SetTimer(nextInterval); | ||
255 | } | ||
256 | |||
257 | public void DelayRestart(int seconds, string message) | ||
258 | { | ||
259 | if (m_CountdownTimer == null) | ||
260 | return; | ||
261 | |||
262 | m_CountdownTimer.Stop(); | ||
263 | m_CountdownTimer = null; | ||
264 | |||
265 | m_Alerts = new List<int>(m_CurrentAlerts); | ||
266 | m_Alerts.Add(seconds); | ||
267 | m_Alerts.Sort(); | ||
268 | m_Alerts.Reverse(); | ||
269 | |||
270 | int nextInterval = DoOneNotice(false); | ||
271 | |||
272 | SetTimer(nextInterval); | ||
230 | } | 273 | } |
231 | 274 | ||
232 | public void AbortRestart(string message) | 275 | public void AbortRestart(string message) |
@@ -236,8 +279,12 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
236 | m_CountdownTimer.Stop(); | 279 | m_CountdownTimer.Stop(); |
237 | m_CountdownTimer = null; | 280 | m_CountdownTimer = null; |
238 | if (m_DialogModule != null && message != String.Empty) | 281 | if (m_DialogModule != null && message != String.Empty) |
239 | m_DialogModule.SendGeneralAlert(message); | 282 | m_DialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message); |
283 | //m_DialogModule.SendGeneralAlert(message); | ||
240 | } | 284 | } |
285 | if (m_MarkerPath != String.Empty) | ||
286 | File.Delete(Path.Combine(m_MarkerPath, | ||
287 | m_Scene.RegionInfo.RegionID.ToString())); | ||
241 | } | 288 | } |
242 | 289 | ||
243 | private void HandleRegionRestart(string module, string[] args) | 290 | private void HandleRegionRestart(string module, string[] args) |
@@ -282,5 +329,25 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
282 | 329 | ||
283 | ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); | 330 | ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); |
284 | } | 331 | } |
332 | |||
333 | protected void CreateMarkerFile() | ||
334 | { | ||
335 | if (m_MarkerPath == String.Empty) | ||
336 | return; | ||
337 | |||
338 | string path = Path.Combine(m_MarkerPath, m_Scene.RegionInfo.RegionID.ToString()); | ||
339 | try | ||
340 | { | ||
341 | string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); | ||
342 | FileStream fs = File.Create(path); | ||
343 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
344 | Byte[] buf = enc.GetBytes(pidstring); | ||
345 | fs.Write(buf, 0, buf.Length); | ||
346 | fs.Close(); | ||
347 | } | ||
348 | catch (Exception) | ||
349 | { | ||
350 | } | ||
351 | } | ||
285 | } | 352 | } |
286 | } \ No newline at end of file | 353 | } |
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index d093224..9c99c19 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs | |||
@@ -48,6 +48,18 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
48 | 48 | ||
49 | private Scene m_scene; | 49 | private Scene m_scene; |
50 | 50 | ||
51 | public enum SoundFlags: byte | ||
52 | { | ||
53 | NONE = 0, | ||
54 | LOOP = 1 << 0, | ||
55 | SYNC_MASTER = 1<<1, | ||
56 | SYNC_SLAVE = 1<<2, | ||
57 | SYNC_PENDING = 1<<3, | ||
58 | QUEUE = 1<<4, | ||
59 | STOP = 1<<5, | ||
60 | SYNC_MASK = SYNC_MASTER | SYNC_SLAVE | SYNC_PENDING | ||
61 | } | ||
62 | |||
51 | public bool Enabled { get; private set; } | 63 | public bool Enabled { get; private set; } |
52 | 64 | ||
53 | public float MaxDistance { get; private set; } | 65 | public float MaxDistance { get; private set; } |
@@ -124,26 +136,30 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
124 | if (radius == 0) | 136 | if (radius == 0) |
125 | radius = MaxDistance; | 137 | radius = MaxDistance; |
126 | 138 | ||
127 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) | 139 | if (part.SoundQueueing) |
140 | flags |= (byte)SoundFlags.QUEUE; | ||
141 | |||
142 | if (grp.IsAttachment) | ||
128 | { | 143 | { |
129 | double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); | 144 | ScenePresence ssp = null; |
130 | if (dis > MaxDistance) // Max audio distance | 145 | if (!m_scene.TryGetScenePresence(grp.AttachedAvatar, out ssp)) |
131 | return; | 146 | return; |
132 | 147 | ||
133 | if (grp.IsAttachment) | 148 | if (!ssp.ParcelAllowThisAvatarSounds) |
134 | { | 149 | return; |
135 | if (grp.HasPrivateAttachmentPoint && sp.ControllingClient.AgentId != grp.OwnerID) | ||
136 | return; | ||
137 | 150 | ||
138 | if (sp.ControllingClient.AgentId == grp.OwnerID) | 151 | if (grp.HasPrivateAttachmentPoint) |
139 | dis = 0; | 152 | { |
153 | ssp.ControllingClient.SendPlayAttachedSound(soundID, objectID, | ||
154 | ownerID, (float)gain, flags); | ||
155 | return; | ||
140 | } | 156 | } |
157 | } | ||
141 | 158 | ||
142 | // Scale by distance | 159 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) |
143 | double thisSpGain = gain * ((radius - dis) / radius); | 160 | { |
144 | |||
145 | sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, | 161 | sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, |
146 | ownerID, (float)thisSpGain, flags); | 162 | ownerID, (float)gain, flags); |
147 | }); | 163 | }); |
148 | } | 164 | } |
149 | 165 | ||
@@ -151,20 +167,33 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
151 | UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) | 167 | UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) |
152 | { | 168 | { |
153 | SceneObjectPart part; | 169 | SceneObjectPart part; |
170 | ScenePresence ssp = null; | ||
154 | if (!m_scene.TryGetSceneObjectPart(objectID, out part)) | 171 | if (!m_scene.TryGetSceneObjectPart(objectID, out part)) |
155 | { | 172 | { |
156 | ScenePresence sp; | 173 | if (!m_scene.TryGetScenePresence(ownerID, out ssp)) |
157 | if (!m_scene.TryGetScenePresence(ownerID, out sp)) | 174 | return; |
175 | if (!ssp.ParcelAllowThisAvatarSounds) | ||
158 | return; | 176 | return; |
159 | } | 177 | } |
160 | else | 178 | else |
161 | { | 179 | { |
162 | SceneObjectGroup grp = part.ParentGroup; | 180 | SceneObjectGroup grp = part.ParentGroup; |
163 | 181 | ||
164 | if (grp.IsAttachment && grp.AttachmentPoint > 30) | 182 | if (grp.IsAttachment) |
165 | { | 183 | { |
166 | objectID = ownerID; | 184 | if (!m_scene.TryGetScenePresence(grp.AttachedAvatar, out ssp)) |
167 | parentID = ownerID; | 185 | return; |
186 | |||
187 | if (!ssp.ParcelAllowThisAvatarSounds) | ||
188 | return; | ||
189 | |||
190 | if (grp.HasPrivateAttachmentPoint) | ||
191 | { | ||
192 | ssp.ControllingClient.SendTriggeredSound(soundId, ownerID, | ||
193 | objectID, parentID, handle, position, | ||
194 | (float)gain); | ||
195 | return; | ||
196 | } | ||
168 | } | 197 | } |
169 | } | 198 | } |
170 | 199 | ||
@@ -174,16 +203,12 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
174 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) | 203 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) |
175 | { | 204 | { |
176 | double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); | 205 | double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); |
177 | 206 | if (dis > radius) // Max audio distance | |
178 | if (dis > MaxDistance) // Max audio distance | ||
179 | return; | 207 | return; |
180 | 208 | ||
181 | // Scale by distance | ||
182 | double thisSpGain = gain * ((radius - dis) / radius); | ||
183 | |||
184 | sp.ControllingClient.SendTriggeredSound(soundId, ownerID, | 209 | sp.ControllingClient.SendTriggeredSound(soundId, ownerID, |
185 | objectID, parentID, handle, position, | 210 | objectID, parentID, handle, position, |
186 | (float)thisSpGain); | 211 | (float)gain); |
187 | }); | 212 | }); |
188 | } | 213 | } |
189 | 214 | ||
@@ -198,40 +223,13 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
198 | 223 | ||
199 | private static void StopSound(SceneObjectPart m_host) | 224 | private static void StopSound(SceneObjectPart m_host) |
200 | { | 225 | { |
201 | m_host.AdjustSoundGain(0); | 226 | // m_host.AdjustSoundGain(0); |
202 | // Xantor 20080528: Clear prim data of sound instead | 227 | m_host.Sound = UUID.Zero; |
203 | if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host)) | 228 | m_host.SoundFlags = (byte)SoundFlags.STOP; |
204 | { | 229 | m_host.SoundRadius = 0; |
205 | if (m_host.ParentGroup.LoopSoundMasterPrim == m_host) | 230 | m_host.SoundGain = 0; |
206 | { | 231 | m_host.ScheduleFullUpdate(); |
207 | foreach (SceneObjectPart part in m_host.ParentGroup.LoopSoundSlavePrims) | 232 | m_host.SendFullUpdateToAllClients(); |
208 | { | ||
209 | part.Sound = UUID.Zero; | ||
210 | part.SoundFlags = 1 << 5; | ||
211 | part.SoundRadius = 0; | ||
212 | part.ScheduleFullUpdate(); | ||
213 | part.SendFullUpdateToAllClients(); | ||
214 | } | ||
215 | m_host.ParentGroup.LoopSoundMasterPrim = null; | ||
216 | m_host.ParentGroup.LoopSoundSlavePrims.Clear(); | ||
217 | } | ||
218 | else | ||
219 | { | ||
220 | m_host.Sound = UUID.Zero; | ||
221 | m_host.SoundFlags = 1 << 5; | ||
222 | m_host.SoundRadius = 0; | ||
223 | m_host.ScheduleFullUpdate(); | ||
224 | m_host.SendFullUpdateToAllClients(); | ||
225 | } | ||
226 | } | ||
227 | else | ||
228 | { | ||
229 | m_host.Sound = UUID.Zero; | ||
230 | m_host.SoundFlags = 1 << 5; | ||
231 | m_host.SoundRadius = 0; | ||
232 | m_host.ScheduleFullUpdate(); | ||
233 | m_host.SendFullUpdateToAllClients(); | ||
234 | } | ||
235 | } | 233 | } |
236 | 234 | ||
237 | public virtual void PreloadSound(UUID objectID, UUID soundID, float radius) | 235 | public virtual void PreloadSound(UUID objectID, UUID soundID, float radius) |
@@ -248,7 +246,7 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
248 | 246 | ||
249 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) | 247 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) |
250 | { | 248 | { |
251 | if (!(Util.GetDistanceTo(sp.AbsolutePosition, part.AbsolutePosition) >= MaxDistance)) | 249 | if (Util.GetDistanceTo(sp.AbsolutePosition, part.AbsolutePosition) < radius) |
252 | sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); | 250 | sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); |
253 | }); | 251 | }); |
254 | } | 252 | } |
@@ -262,21 +260,24 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
262 | // 20080530 Updated to remove code duplication | 260 | // 20080530 Updated to remove code duplication |
263 | // 20080530 Stop sound if there is one, otherwise volume only changes don't work | 261 | // 20080530 Stop sound if there is one, otherwise volume only changes don't work |
264 | public void LoopSound(UUID objectID, UUID soundID, | 262 | public void LoopSound(UUID objectID, UUID soundID, |
265 | double volume, double radius, bool isMaster) | 263 | double volume, double radius, bool isMaster, bool isSlave) |
266 | { | 264 | { |
267 | SceneObjectPart m_host; | 265 | SceneObjectPart m_host; |
268 | if (!m_scene.TryGetSceneObjectPart(objectID, out m_host)) | 266 | if (!m_scene.TryGetSceneObjectPart(objectID, out m_host)) |
269 | return; | 267 | return; |
270 | 268 | ||
269 | byte iflags = 1; // looping | ||
271 | if (isMaster) | 270 | if (isMaster) |
272 | m_host.ParentGroup.LoopSoundMasterPrim = m_host; | 271 | iflags |= (byte)SoundFlags.SYNC_MASTER; |
273 | 272 | // TODO check viewer seems to accept both | |
274 | if (m_host.Sound != UUID.Zero) | 273 | if (isSlave) |
275 | StopSound(m_host); | 274 | iflags |= (byte)SoundFlags.SYNC_SLAVE; |
275 | if (m_host.SoundQueueing) | ||
276 | iflags |= (byte)SoundFlags.QUEUE; | ||
276 | 277 | ||
277 | m_host.Sound = soundID; | 278 | m_host.Sound = soundID; |
278 | m_host.SoundGain = volume; | 279 | m_host.SoundGain = volume; |
279 | m_host.SoundFlags = 1; // looping | 280 | m_host.SoundFlags = iflags; |
280 | m_host.SoundRadius = radius; | 281 | m_host.SoundRadius = radius; |
281 | 282 | ||
282 | m_host.ScheduleFullUpdate(); | 283 | m_host.ScheduleFullUpdate(); |
@@ -301,42 +302,19 @@ namespace OpenSim.Region.CoreModules.World.Sound | |||
301 | Vector3 position = part.AbsolutePosition; // region local | 302 | Vector3 position = part.AbsolutePosition; // region local |
302 | ulong regionHandle = m_scene.RegionInfo.RegionHandle; | 303 | ulong regionHandle = m_scene.RegionInfo.RegionHandle; |
303 | 304 | ||
304 | if (useMaster) | 305 | if(triggered) |
305 | { | 306 | TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); |
306 | if (isMaster) | ||
307 | { | ||
308 | if (triggered) | ||
309 | TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); | ||
310 | else | ||
311 | PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); | ||
312 | part.ParentGroup.PlaySoundMasterPrim = part; | ||
313 | if (triggered) | ||
314 | TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); | ||
315 | else | ||
316 | PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); | ||
317 | foreach (SceneObjectPart prim in part.ParentGroup.PlaySoundSlavePrims) | ||
318 | { | ||
319 | position = prim.AbsolutePosition; // region local | ||
320 | if (triggered) | ||
321 | TriggerSound(soundID, part.OwnerID, prim.UUID, parentID, volume, position, regionHandle, radius); | ||
322 | else | ||
323 | PlayAttachedSound(soundID, part.OwnerID, prim.UUID, volume, position, flags, radius); | ||
324 | } | ||
325 | part.ParentGroup.PlaySoundSlavePrims.Clear(); | ||
326 | part.ParentGroup.PlaySoundMasterPrim = null; | ||
327 | } | ||
328 | else | ||
329 | { | ||
330 | part.ParentGroup.PlaySoundSlavePrims.Add(part); | ||
331 | } | ||
332 | } | ||
333 | else | 307 | else |
334 | { | 308 | { |
335 | if (triggered) | 309 | byte bflags = 0; |
336 | TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius); | 310 | |
337 | else | 311 | if (isMaster) |
338 | PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius); | 312 | bflags |= (byte)SoundFlags.SYNC_MASTER; |
339 | } | 313 | // TODO check viewer seems to accept both |
314 | if (useMaster) | ||
315 | bflags |= (byte)SoundFlags.SYNC_SLAVE; | ||
316 | PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, bflags, radius); | ||
317 | } | ||
340 | } | 318 | } |
341 | 319 | ||
342 | public void TriggerSoundLimited(UUID objectID, UUID sound, | 320 | public void TriggerSoundLimited(UUID objectID, UUID sound, |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Effects/ChannelDigger.cs b/OpenSim/Region/CoreModules/World/Terrain/Effects/ChannelDigger.cs index 36917e9..b456aa1 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/Effects/ChannelDigger.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/Effects/ChannelDigger.cs | |||
@@ -64,7 +64,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Effects | |||
64 | 64 | ||
65 | for (int i = 0; i < rounds; i++) | 65 | for (int i = 0; i < rounds; i++) |
66 | { | 66 | { |
67 | smoothFunction.FloodEffect(map, bitmap, 1.0); | 67 | smoothFunction.FloodEffect(map, bitmap, 1.0, 0, map.Width - 1, 0, map.Height - 1); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
@@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Effects | |||
99 | } | 99 | } |
100 | } | 100 | } |
101 | 101 | ||
102 | raiseFunction.FloodEffect(map, bitmap, height); | 102 | raiseFunction.FloodEffect(map, bitmap, height, 0, map.Width - 1, 0, map.Height - 1); |
103 | } | 103 | } |
104 | } | 104 | } |
105 | } | 105 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Effects/CookieCutter.cs b/OpenSim/Region/CoreModules/World/Terrain/Effects/CookieCutter.cs index dc76ad5..3222524 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/Effects/CookieCutter.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/Effects/CookieCutter.cs | |||
@@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Effects | |||
84 | for (y = 0; y < map.Height; y++) | 84 | for (y = 0; y < map.Height; y++) |
85 | { | 85 | { |
86 | if (cliffMask[x, y]) | 86 | if (cliffMask[x, y]) |
87 | eroder.PaintEffect(map, allowMask, x, y, -1, 4, 0.1); | 87 | eroder.PaintEffect(map, allowMask, x, y, -1, 4, 0.1,0,map.Width - 1,0,map.Height - 1); |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Effects/DefaultTerrainGenerator.cs b/OpenSim/Region/CoreModules/World/Terrain/Effects/DefaultTerrainGenerator.cs index 89087b1..80396c4 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/Effects/DefaultTerrainGenerator.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/Effects/DefaultTerrainGenerator.cs | |||
@@ -53,4 +53,4 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Effects | |||
53 | 53 | ||
54 | #endregion | 54 | #endregion |
55 | } | 55 | } |
56 | } \ No newline at end of file | 56 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/FlattenArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/FlattenArea.cs index 774e7b2..0c4171e 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/FlattenArea.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/FlattenArea.cs | |||
@@ -33,15 +33,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes | |||
33 | { | 33 | { |
34 | #region ITerrainFloodEffect Members | 34 | #region ITerrainFloodEffect Members |
35 | 35 | ||
36 | public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength) | 36 | public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength, |
37 | int startX, int endX, int startY, int endY) | ||
37 | { | 38 | { |
38 | double sum = 0.0; | 39 | double sum = 0.0; |
39 | double steps = 0.0; | 40 | double steps = 0.0; |
40 | 41 | ||
41 | int x, y; | 42 | int x, y; |
42 | for (x = 0; x < map.Width; x++) | 43 | for (x = startX; x <= endX; x++) |
43 | { | 44 | { |
44 | for (y = 0; y < map.Height; y++) | 45 | for (y = startY; y <= endY; y++) |
45 | { | 46 | { |
46 | if (fillArea[x, y]) | 47 | if (fillArea[x, y]) |
47 | { | 48 | { |
@@ -55,9 +56,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes | |||
55 | 56 | ||
56 | double str = 0.1 * strength; // == 0.2 in the default client | 57 | double str = 0.1 * strength; // == 0.2 in the default client |
57 | 58 | ||
58 | for (x = 0; x < map.Width; x++) | 59 | for (x = startX; x <= endX; x++) |
59 | { | 60 | { |
60 | for (y = 0; y < map.Height; y++) | 61 | for (y = startY; y <= endY; y++) |
61 | { | 62 | { |
62 | if (fillArea[x, y]) | 63 | if (fillArea[x, y]) |
63 | map[x, y] = (map[x, y] * (1.0 - str)) + (avg * str); | 64 | map[x, y] = (map[x, y] * (1.0 - str)) + (avg * str); |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/LowerArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/LowerArea.cs index 3e87390..a275a86 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/LowerArea.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/LowerArea.cs | |||
@@ -33,13 +33,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes | |||
33 | { | 33 | { |
34 | #region ITerrainFloodEffect Members | 34 | #region ITerrainFloodEffect Members |
35 | 35 | ||
36 | public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength) | 36 | public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength, |
37 | int startX, int endX, int startY, int endY) | ||
37 | { | 38 | { |
38 | int x; | 39 | int x,y; |
39 | for (x = 0; x < map.Width; x++) | 40 | for (x = startX; x <= endX; x++) |
40 | { | 41 | { |
41 | int y; | 42 | for (y = startY; y <= endY; y++) |
42 | for (y = 0; y < map.Height; y++) | ||
43 | { | 43 | { |
44 | if (fillArea[x, y]) | 44 | if (fillArea[x, y]) |
45 | { | 45 | { |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs index b6c635c..236584a 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs | |||
@@ -35,18 +35,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes | |||
35 | { | 35 | { |
36 | #region ITerrainFloodEffect Members | 36 | #region ITerrainFloodEffect Members |
37 | 37 | ||
38 | public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength) | 38 | public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength, |
39 | int startX, int endX, int startY, int endY) | ||
39 | { | 40 | { |
40 | int x; | 41 | int x, y; |
41 | for (x = 0; x < map.Width; x++) | 42 | for (x = startX; x <= endX; x++) |
42 | { | 43 | { |
43 | int y; | 44 | for (y = startY; y <= endY; y++) |
44 | for (y = 0; y < map.Height; y++) | ||
45 | { | 45 | { |
46 | if (fillArea[x, y]) | 46 | if (fillArea[x, y]) |
47 | { | 47 | { |
48 | double noise = TerrainUtil.PerlinNoise2D((double) x / map.Width, (double) y / map.Height, 8, 1.0); | 48 | double noise = TerrainUtil.PerlinNoise2D((double) x / map.Width, (double) y / map.Height, 8, 1.0); |
49 | <<<<<<< HEAD | ||
49 | 50 | ||
51 | ======= | ||
52 | >>>>>>> avn/ubitvar | ||
50 | map[x, y] += noise * strength; | 53 | map[x, y] += noise * strength; |
51 | } | 54 | } |
52 | } | 55 | } |
@@ -55,4 +58,4 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes | |||
55 | 58 | ||
56 | #endregion | 59 | #endregion |
57 | } | 60 | } |
58 | } \ No newline at end of file | 61 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/RaiseArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/RaiseArea.cs index 3bdc5e7..6ccd5df 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/RaiseArea.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/RaiseArea.cs | |||
@@ -33,13 +33,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes | |||
33 | { | 33 | { |
34 | #region ITerrainFloodEffect Members | 34 | #region ITerrainFloodEffect Members |
35 | 35 | ||
36 | public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength) | 36 | public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength, |
37 | int startX, int endX, int startY, int endY) | ||
37 | { | 38 | { |
38 | int x; | 39 | int x,y; |
39 | for (x = 0; x < map.Width; x++) | 40 | for (x = startX; x <= endX; x++) |
40 | { | 41 | { |
41 | int y; | 42 | for (y = startY; y <= endY; y++) |
42 | for (y = 0; y < map.Height; y++) | ||
43 | { | 43 | { |
44 | if (fillArea[x, y]) | 44 | if (fillArea[x, y]) |
45 | { | 45 | { |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/RevertArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/RevertArea.cs index c5527fa..4230133 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/RevertArea.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/RevertArea.cs | |||
@@ -46,13 +46,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes | |||
46 | /// <param name="map">the current heightmap</param> | 46 | /// <param name="map">the current heightmap</param> |
47 | /// <param name="fillArea">array indicating which sections of the map are to be reverted</param> | 47 | /// <param name="fillArea">array indicating which sections of the map are to be reverted</param> |
48 | /// <param name="strength">unused</param> | 48 | /// <param name="strength">unused</param> |
49 | public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength) | 49 | public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength, |
50 | int startX, int endX, int startY, int endY) | ||
50 | { | 51 | { |
51 | int x; | 52 | int x, y; |
52 | for (x = 0; x < map.Width; x++) | 53 | for (x = startX; x <= endX; x++) |
53 | { | 54 | { |
54 | int y; | 55 | for (y = startY; y <= endY; y++) |
55 | for (y = 0; y < map.Height; y++) | ||
56 | { | 56 | { |
57 | if (fillArea[x, y]) | 57 | if (fillArea[x, y]) |
58 | { | 58 | { |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/SmoothArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/SmoothArea.cs index 6b07747..6c0d60d 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/SmoothArea.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/SmoothArea.cs | |||
@@ -33,16 +33,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes | |||
33 | { | 33 | { |
34 | #region ITerrainFloodEffect Members | 34 | #region ITerrainFloodEffect Members |
35 | 35 | ||
36 | public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength) | 36 | public void FloodEffect(ITerrainChannel map, bool[,] fillArea, double strength, |
37 | int startX, int endX, int startY, int endY) | ||
37 | { | 38 | { |
38 | double area = strength; | 39 | double area = strength; |
39 | double step = strength / 4.0; | 40 | double step = strength / 4.0; |
40 | 41 | ||
41 | double[,] manipulate = new double[map.Width,map.Height]; | 42 | double[,] manipulate = new double[map.Width,map.Height]; |
42 | int x, y; | 43 | int x, y; |
43 | for (x = 0; x < map.Width; x++) | 44 | for (x = startX; x <= endX; x++) |
44 | { | 45 | { |
45 | for (y = 0; y < map.Height; y++) | 46 | for (y = startY; y <= endY; y++) |
46 | { | 47 | { |
47 | if (!fillArea[x, y]) | 48 | if (!fillArea[x, y]) |
48 | continue; | 49 | continue; |
@@ -64,9 +65,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes | |||
64 | manipulate[x, y] = average / avgsteps; | 65 | manipulate[x, y] = average / avgsteps; |
65 | } | 66 | } |
66 | } | 67 | } |
67 | for (x = 0; x < map.Width; x++) | 68 | for (x = startX; x <= endX; x++) |
68 | { | 69 | { |
69 | for (y = 0; y < map.Height; y++) | 70 | for (y = startY; y <= endY; y++) |
70 | { | 71 | { |
71 | if (!fillArea[x, y]) | 72 | if (!fillArea[x, y]) |
72 | continue; | 73 | continue; |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/ITerrainFloodEffect.cs b/OpenSim/Region/CoreModules/World/Terrain/ITerrainFloodEffect.cs index 3984a30..6324aca 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/ITerrainFloodEffect.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/ITerrainFloodEffect.cs | |||
@@ -32,6 +32,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
32 | { | 32 | { |
33 | public interface ITerrainFloodEffect | 33 | public interface ITerrainFloodEffect |
34 | { | 34 | { |
35 | void FloodEffect(ITerrainChannel map, Boolean[,] fillArea, double strength); | 35 | void FloodEffect(ITerrainChannel map, Boolean[,] fillArea, double strength, |
36 | int startX, int endX, int startY, int endY); | ||
36 | } | 37 | } |
37 | } \ No newline at end of file | 38 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/ITerrainPaintableEffect.cs b/OpenSim/Region/CoreModules/World/Terrain/ITerrainPaintableEffect.cs index b73defd..d0b05e4 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/ITerrainPaintableEffect.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/ITerrainPaintableEffect.cs | |||
@@ -31,6 +31,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
31 | { | 31 | { |
32 | public interface ITerrainPaintableEffect | 32 | public interface ITerrainPaintableEffect |
33 | { | 33 | { |
34 | void PaintEffect(ITerrainChannel map, bool[,] allowMask, double x, double y, double z, double strength, double duration); | 34 | void PaintEffect(ITerrainChannel map, bool[,] allowMask, double x, double y, double z, |
35 | double strength, double duration, int startX, int endX, int startY, int endY); | ||
35 | } | 36 | } |
36 | } | 37 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/ErodeSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/ErodeSphere.cs index 7a78cd8..7358ba3 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/ErodeSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/ErodeSphere.cs | |||
@@ -151,7 +151,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
151 | 151 | ||
152 | #region ITerrainPaintableEffect Members | 152 | #region ITerrainPaintableEffect Members |
153 | 153 | ||
154 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) | 154 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, |
155 | double strength, double duration, int startX, int endX, int startY, int endY) | ||
155 | { | 156 | { |
156 | strength = TerrainUtil.MetersToSphericalStrength(strength); | 157 | strength = TerrainUtil.MetersToSphericalStrength(strength); |
157 | 158 | ||
@@ -163,18 +164,23 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
163 | ITerrainChannel sediment = new TerrainChannel(map.Width, map.Height); | 164 | ITerrainChannel sediment = new TerrainChannel(map.Width, map.Height); |
164 | 165 | ||
165 | // Fill with rain | 166 | // Fill with rain |
166 | for (x = 0; x < water.Width; x++) | 167 | for (x = startX; x <= endX; x++) |
167 | for (y = 0; y < water.Height; y++) | 168 | { |
168 | water[x, y] = Math.Max(0.0, TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * rainHeight * duration); | 169 | for (y = startY; y <= endY; y++) |
170 | { | ||
171 | if (mask[x, y]) | ||
172 | water[x, y] = Math.Max(0.0, TerrainUtil.SphericalFactor(x, y, rx, ry, strength) * rainHeight * duration); | ||
173 | } | ||
174 | } | ||
169 | 175 | ||
170 | for (int i = 0; i < rounds; i++) | 176 | for (int i = 0; i < rounds; i++) |
171 | { | 177 | { |
172 | // Erode underlying terrain | 178 | // Erode underlying terrain |
173 | for (x = 0; x < water.Width; x++) | 179 | for (x = startX; x <= endX; x++) |
174 | { | 180 | { |
175 | for (y = 0; y < water.Height; y++) | 181 | for (y = startY; y <= endY; y++) |
176 | { | 182 | { |
177 | if (mask[x,y]) | 183 | if (mask[x, y]) |
178 | { | 184 | { |
179 | const double solConst = (1.0 / rounds); | 185 | const double solConst = (1.0 / rounds); |
180 | double sedDelta = water[x, y] * solConst; | 186 | double sedDelta = water[x, y] * solConst; |
@@ -185,9 +191,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
185 | } | 191 | } |
186 | 192 | ||
187 | // Move water | 193 | // Move water |
188 | for (x = 0; x < water.Width; x++) | 194 | for (x = startX; x <= endX; x++) |
189 | { | 195 | { |
190 | for (y = 0; y < water.Height; y++) | 196 | for (y = startY; y <= endY; y++) |
191 | { | 197 | { |
192 | if (water[x, y] <= 0) | 198 | if (water[x, y] <= 0) |
193 | continue; | 199 | continue; |
@@ -296,7 +302,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
296 | double sedimentDeposit = sediment[x, y] - waterCapacity; | 302 | double sedimentDeposit = sediment[x, y] - waterCapacity; |
297 | if (sedimentDeposit > 0) | 303 | if (sedimentDeposit > 0) |
298 | { | 304 | { |
299 | if (mask[x,y]) | 305 | if (mask[x, y]) |
300 | { | 306 | { |
301 | sediment[x, y] -= sedimentDeposit; | 307 | sediment[x, y] -= sedimentDeposit; |
302 | map[x, y] += sedimentDeposit; | 308 | map[x, y] += sedimentDeposit; |
@@ -309,10 +315,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
309 | // Deposit any remainder (should be minimal) | 315 | // Deposit any remainder (should be minimal) |
310 | for (x = 0; x < water.Width; x++) | 316 | for (x = 0; x < water.Width; x++) |
311 | for (y = 0; y < water.Height; y++) | 317 | for (y = 0; y < water.Height; y++) |
312 | if (mask[x,y] && sediment[x, y] > 0) | 318 | if (mask[x, y] && sediment[x, y] > 0) |
313 | map[x, y] += sediment[x, y]; | 319 | map[x, y] += sediment[x, y]; |
314 | } | 320 | } |
315 | |||
316 | #endregion | 321 | #endregion |
317 | } | 322 | } |
318 | } | 323 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs index 9aa3dff..8937f63 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/FlattenSphere.cs | |||
@@ -35,16 +35,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
35 | { | 35 | { |
36 | #region ITerrainPaintableEffect Members | 36 | #region ITerrainPaintableEffect Members |
37 | 37 | ||
38 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) | 38 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, |
39 | double strength, double duration, int startX, int endX, int startY, int endY) | ||
39 | { | 40 | { |
40 | strength = TerrainUtil.MetersToSphericalStrength(strength); | 41 | strength = TerrainUtil.MetersToSphericalStrength(strength); |
41 | 42 | ||
42 | int x, y; | 43 | int x, y; |
43 | 44 | ||
44 | // blend in map | 45 | // blend in map |
45 | for (x = 0; x < map.Width; x++) | 46 | for (x = startX; x <= endX; x++) |
46 | { | 47 | { |
47 | for (y = 0; y < map.Height; y++) | 48 | for (y = startY; y <= endY; y++) |
48 | { | 49 | { |
49 | if (!mask[x,y]) | 50 | if (!mask[x,y]) |
50 | continue; | 51 | continue; |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/LowerSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/LowerSphere.cs index 68145f2..bbf9407 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/LowerSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/LowerSphere.cs | |||
@@ -34,34 +34,18 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
34 | { | 34 | { |
35 | #region ITerrainPaintableEffect Members | 35 | #region ITerrainPaintableEffect Members |
36 | 36 | ||
37 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) | 37 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, |
38 | double strength, double duration, int startX, int endX, int startY, int endY) | ||
38 | { | 39 | { |
39 | int s = (int) (Math.Pow(2, strength) + 0.5); | 40 | int s = (int) (Math.Pow(2, strength) + 0.5); |
40 | 41 | ||
41 | int x; | 42 | int x, y; |
42 | int xFrom = (int)(rx-s+0.5); | ||
43 | int xTo = (int)(rx+s+0.5) + 1; | ||
44 | int yFrom = (int)(ry-s+0.5); | ||
45 | int yTo = (int)(ry+s+0.5) + 1; | ||
46 | 43 | ||
47 | if (xFrom < 0) | 44 | for (x = startX; x <= endX; x++) |
48 | xFrom = 0; | ||
49 | |||
50 | if (yFrom < 0) | ||
51 | yFrom = 0; | ||
52 | |||
53 | if (xTo > map.Width) | ||
54 | xTo = map.Width; | ||
55 | |||
56 | if (yTo > map.Width) | ||
57 | yTo = map.Width; | ||
58 | |||
59 | for (x = xFrom; x < xTo; x++) | ||
60 | { | 45 | { |
61 | int y; | 46 | for (y = startY; y <= endY; y++) |
62 | for (y = yFrom; y < yTo; y++) | ||
63 | { | 47 | { |
64 | if (!mask[x,y]) | 48 | if (!mask[x, y]) |
65 | continue; | 49 | continue; |
66 | 50 | ||
67 | // Calculate a cos-sphere and add it to the heighmap | 51 | // Calculate a cos-sphere and add it to the heighmap |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs index e7df3f8..46d47b4 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/NoiseSphere.cs | |||
@@ -35,17 +35,18 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
35 | { | 35 | { |
36 | #region ITerrainPaintableEffect Members | 36 | #region ITerrainPaintableEffect Members |
37 | 37 | ||
38 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) | 38 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, |
39 | double strength, double duration, int startX, int endX, int startY, int endY) | ||
39 | { | 40 | { |
40 | strength = TerrainUtil.MetersToSphericalStrength(strength); | 41 | strength = TerrainUtil.MetersToSphericalStrength(strength); |
41 | 42 | ||
42 | int x; | 43 | int x, y; |
43 | for (x = 0; x < map.Width; x++) | 44 | |
45 | for (x = startX; x <= endX; x++) | ||
44 | { | 46 | { |
45 | int y; | 47 | for (y = startY; y <= endY; y++) |
46 | for (y = 0; y < map.Height; y++) | ||
47 | { | 48 | { |
48 | if (!mask[x,y]) | 49 | if (!mask[x, y]) |
49 | continue; | 50 | continue; |
50 | 51 | ||
51 | // Calculate a sphere and add it to the heighmap | 52 | // Calculate a sphere and add it to the heighmap |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/OlsenSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/OlsenSphere.cs index b199df3..281690d 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/OlsenSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/OlsenSphere.cs | |||
@@ -152,18 +152,18 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
152 | 152 | ||
153 | #region ITerrainPaintableEffect Members | 153 | #region ITerrainPaintableEffect Members |
154 | 154 | ||
155 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) | 155 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, |
156 | double strength, double duration, int startX, int endX, int startY, int endY) | ||
156 | { | 157 | { |
157 | strength = TerrainUtil.MetersToSphericalStrength(strength); | 158 | strength = TerrainUtil.MetersToSphericalStrength(strength); |
158 | 159 | ||
159 | int x; | 160 | int x, y; |
160 | 161 | ||
161 | for (x = 0; x < map.Width; x++) | 162 | for (x = startX; x <= endX; x++) |
162 | { | 163 | { |
163 | int y; | 164 | for (y = startY; y <= endY; y++) |
164 | for (y = 0; y < map.Height; y++) | ||
165 | { | 165 | { |
166 | if (!mask[x,y]) | 166 | if (!mask[x, y]) |
167 | continue; | 167 | continue; |
168 | 168 | ||
169 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); | 169 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/RaiseSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/RaiseSphere.cs index bd9a8a0..1b704bb 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/RaiseSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/RaiseSphere.cs | |||
@@ -35,38 +35,22 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
35 | #region ITerrainPaintableEffect Members | 35 | #region ITerrainPaintableEffect Members |
36 | 36 | ||
37 | 37 | ||
38 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) | 38 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, |
39 | double strength, double duration, int startX, int endX, int startY, int endY) | ||
39 | { | 40 | { |
40 | int s = (int) (Math.Pow(2, strength) + 0.5); | 41 | int s = (int) (Math.Pow(2, strength) + 0.5); |
41 | 42 | ||
42 | int x; | 43 | int x,y; |
43 | int xFrom = (int)(rx-s+0.5); | ||
44 | int xTo = (int)(rx+s+0.5) + 1; | ||
45 | int yFrom = (int)(ry-s+0.5); | ||
46 | int yTo = (int)(ry+s+0.5) + 1; | ||
47 | 44 | ||
48 | if (xFrom < 0) | 45 | for (x = startX; x <= endX; x++) |
49 | xFrom = 0; | ||
50 | |||
51 | if (yFrom < 0) | ||
52 | yFrom = 0; | ||
53 | |||
54 | if (xTo > map.Width) | ||
55 | xTo = map.Width; | ||
56 | |||
57 | if (yTo > map.Width) | ||
58 | yTo = map.Width; | ||
59 | |||
60 | for (x = xFrom; x < xTo; x++) | ||
61 | { | 46 | { |
62 | int y; | 47 | for (y = startY; y <= endY; y++) |
63 | for (y = yFrom; y < yTo; y++) | ||
64 | { | 48 | { |
65 | if (!mask[x,y]) | 49 | if (!mask[x, y]) |
66 | continue; | 50 | continue; |
67 | 51 | ||
68 | // Calculate a cos-sphere and add it to the heighmap | 52 | // Calculate a cos-sphere and add it to the heighmap |
69 | double r = Math.Sqrt((x-rx) * (x-rx) + ((y-ry) * (y-ry))); | 53 | double r = Math.Sqrt((x - rx) * (x - rx) + ((y - ry) * (y - ry))); |
70 | double z = Math.Cos(r * Math.PI / (s * 2)); | 54 | double z = Math.Cos(r * Math.PI / (s * 2)); |
71 | if (z > 0.0) | 55 | if (z > 0.0) |
72 | map[x, y] += z * duration; | 56 | map[x, y] += z * duration; |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/RevertSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/RevertSphere.cs index 4b28275..efc5324 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/RevertSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/RevertSphere.cs | |||
@@ -41,7 +41,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
41 | 41 | ||
42 | #region ITerrainPaintableEffect Members | 42 | #region ITerrainPaintableEffect Members |
43 | 43 | ||
44 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) | 44 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, |
45 | double strength, double duration, int startX, int endX, int startY, int endY) | ||
45 | { | 46 | { |
46 | strength = TerrainUtil.MetersToSphericalStrength(strength); | 47 | strength = TerrainUtil.MetersToSphericalStrength(strength); |
47 | duration = 0.03; //MCP Should be read from ini file | 48 | duration = 0.03; //MCP Should be read from ini file |
@@ -51,13 +52,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
51 | if (duration < 0) | 52 | if (duration < 0) |
52 | return; | 53 | return; |
53 | 54 | ||
54 | int x; | 55 | int x,y; |
55 | for (x = 0; x < map.Width; x++) | 56 | for (x = startX; x <= endX; x++) |
56 | { | 57 | { |
57 | int y; | 58 | for (y = startY; y <= endY; y++) |
58 | for (y = 0; y < map.Height; y++) | ||
59 | { | 59 | { |
60 | if (!mask[x,y]) | 60 | if (!mask[x, y]) |
61 | continue; | 61 | continue; |
62 | 62 | ||
63 | // Calculate a sphere and add it to the heighmap | 63 | // Calculate a sphere and add it to the heighmap |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/SmoothSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/SmoothSphere.cs index 4834c86..65dd0a6 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/SmoothSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/SmoothSphere.cs | |||
@@ -34,7 +34,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
34 | { | 34 | { |
35 | #region ITerrainPaintableEffect Members | 35 | #region ITerrainPaintableEffect Members |
36 | 36 | ||
37 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) | 37 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, |
38 | double strength, double duration, int startX, int endX, int startY, int endY) | ||
38 | { | 39 | { |
39 | strength = TerrainUtil.MetersToSphericalStrength(strength); | 40 | strength = TerrainUtil.MetersToSphericalStrength(strength); |
40 | 41 | ||
@@ -47,10 +48,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
47 | 48 | ||
48 | 49 | ||
49 | // compute delta map | 50 | // compute delta map |
50 | for (x = 0; x < map.Width; x++) | 51 | for (x = startX; x <= endX; x++) |
51 | { | 52 | { |
52 | for (y = 0; y < map.Height; y++) | 53 | for (y = startY; y <= endY; y++) |
53 | { | 54 | { |
55 | if (!mask[x, y]) | ||
56 | continue; | ||
57 | |||
54 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); | 58 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); |
55 | 59 | ||
56 | if (z > 0) // add in non-zero amount | 60 | if (z > 0) // add in non-zero amount |
@@ -73,11 +77,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
73 | } | 77 | } |
74 | } | 78 | } |
75 | // blend in map | 79 | // blend in map |
76 | for (x = 0; x < map.Width; x++) | 80 | for (x = startX; x <= endX; x++) |
77 | { | 81 | { |
78 | for (y = 0; y < map.Height; y++) | 82 | for (y = startY; y <= endY; y++) |
79 | { | 83 | { |
80 | if (!mask[x,y]) | 84 | if (!mask[x, y]) |
81 | continue; | 85 | continue; |
82 | 86 | ||
83 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); | 87 | double z = TerrainUtil.SphericalFactor(x, y, rx, ry, strength); |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/WeatherSphere.cs b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/WeatherSphere.cs index f31c8b6..f52fe07 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/WeatherSphere.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/PaintBrushes/WeatherSphere.cs | |||
@@ -148,16 +148,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain.PaintBrushes | |||
148 | 148 | ||
149 | #region ITerrainPaintableEffect Members | 149 | #region ITerrainPaintableEffect Members |
150 | 150 | ||
151 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, double strength, double duration) | 151 | public void PaintEffect(ITerrainChannel map, bool[,] mask, double rx, double ry, double rz, |
152 | double strength, double duration, int startX, int endX, int startY, int endY) | ||
152 | { | 153 | { |
153 | strength = TerrainUtil.MetersToSphericalStrength(strength); | 154 | strength = TerrainUtil.MetersToSphericalStrength(strength); |
154 | 155 | ||
155 | int x; | 156 | int x,y; |
156 | 157 | ||
157 | for (x = 0; x < map.Width; x++) | 158 | for (x = startX; x <= endX; x++) |
158 | { | 159 | { |
159 | int y; | 160 | for (y = startY; y <= endY; y++) |
160 | for (y = 0; y < map.Height; y++) | ||
161 | { | 161 | { |
162 | if (!mask[x,y]) | 162 | if (!mask[x,y]) |
163 | continue; | 163 | continue; |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 932652c..925de2a 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -75,6 +75,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
75 | #endregion | 75 | #endregion |
76 | 76 | ||
77 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 77 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
78 | <<<<<<< HEAD | ||
79 | ======= | ||
80 | |||
81 | #pragma warning disable 414 | ||
82 | private static readonly string LogHeader = "[TERRAIN MODULE]"; | ||
83 | #pragma warning restore 414 | ||
84 | |||
85 | private readonly Commander m_commander = new Commander("terrain"); | ||
86 | >>>>>>> avn/ubitvar | ||
78 | 87 | ||
79 | #pragma warning disable 414 | 88 | #pragma warning disable 414 |
80 | private static readonly string LogHeader = "[TERRAIN MODULE]"; | 89 | private static readonly string LogHeader = "[TERRAIN MODULE]"; |
@@ -86,6 +95,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
86 | private readonly Dictionary<string, ITerrainLoader> m_loaders = new Dictionary<string, ITerrainLoader>(); | 95 | private readonly Dictionary<string, ITerrainLoader> m_loaders = new Dictionary<string, ITerrainLoader>(); |
87 | private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects = | 96 | private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects = |
88 | new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>(); | 97 | new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>(); |
98 | <<<<<<< HEAD | ||
89 | private Dictionary<string, ITerrainEffect> m_plugineffects; | 99 | private Dictionary<string, ITerrainEffect> m_plugineffects; |
90 | private Dictionary<string, ITerrainModifier> m_modifyOperations = | 100 | private Dictionary<string, ITerrainModifier> m_modifyOperations = |
91 | new Dictionary<string, ITerrainModifier>(); | 101 | new Dictionary<string, ITerrainModifier>(); |
@@ -94,6 +104,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
94 | private Scene m_scene; | 104 | private Scene m_scene; |
95 | private volatile bool m_tainted; | 105 | private volatile bool m_tainted; |
96 | private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5); | 106 | private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5); |
107 | ======= | ||
108 | |||
109 | private Dictionary<string, ITerrainEffect> m_plugineffects; | ||
110 | private ITerrainChannel m_channel; | ||
111 | private ITerrainChannel m_baked; | ||
112 | private Scene m_scene; | ||
113 | private volatile bool m_tainted; | ||
114 | |||
115 | >>>>>>> avn/ubitvar | ||
97 | private String m_InitialTerrain = "pinhead-island"; | 116 | private String m_InitialTerrain = "pinhead-island"; |
98 | 117 | ||
99 | // If true, send terrain patch updates to clients based on their view distance | 118 | // If true, send terrain patch updates to clients based on their view distance |
@@ -107,13 +126,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
107 | private bool[,] updated; // for each patch, whether it needs to be sent to this client | 126 | private bool[,] updated; // for each patch, whether it needs to be sent to this client |
108 | private int updateCount; // number of patches that need to be sent | 127 | private int updateCount; // number of patches that need to be sent |
109 | public ScenePresence Presence; // a reference to the client to send to | 128 | public ScenePresence Presence; // a reference to the client to send to |
129 | <<<<<<< HEAD | ||
110 | public TerrainData Terrain; // reference to the underlying terrain | 130 | public TerrainData Terrain; // reference to the underlying terrain |
131 | ======= | ||
132 | >>>>>>> avn/ubitvar | ||
111 | public PatchUpdates(TerrainData terrData, ScenePresence pPresence) | 133 | public PatchUpdates(TerrainData terrData, ScenePresence pPresence) |
112 | { | 134 | { |
113 | updated = new bool[terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize]; | 135 | updated = new bool[terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize]; |
114 | updateCount = 0; | 136 | updateCount = 0; |
115 | Presence = pPresence; | 137 | Presence = pPresence; |
138 | <<<<<<< HEAD | ||
116 | Terrain = terrData; | 139 | Terrain = terrData; |
140 | ======= | ||
141 | >>>>>>> avn/ubitvar | ||
117 | // Initially, send all patches to the client | 142 | // Initially, send all patches to the client |
118 | SetAll(true); | 143 | SetAll(true); |
119 | } | 144 | } |
@@ -122,17 +147,26 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
122 | { | 147 | { |
123 | return (updateCount > 0); | 148 | return (updateCount > 0); |
124 | } | 149 | } |
150 | <<<<<<< HEAD | ||
125 | 151 | ||
152 | ======= | ||
153 | >>>>>>> avn/ubitvar | ||
126 | public void SetByXY(int x, int y, bool state) | 154 | public void SetByXY(int x, int y, bool state) |
127 | { | 155 | { |
128 | this.SetByPatch(x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, state); | 156 | this.SetByPatch(x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, state); |
129 | } | 157 | } |
158 | <<<<<<< HEAD | ||
130 | 159 | ||
160 | ======= | ||
161 | >>>>>>> avn/ubitvar | ||
131 | public bool GetByPatch(int patchX, int patchY) | 162 | public bool GetByPatch(int patchX, int patchY) |
132 | { | 163 | { |
133 | return updated[patchX, patchY]; | 164 | return updated[patchX, patchY]; |
134 | } | 165 | } |
166 | <<<<<<< HEAD | ||
135 | 167 | ||
168 | ======= | ||
169 | >>>>>>> avn/ubitvar | ||
136 | public void SetByPatch(int patchX, int patchY, bool state) | 170 | public void SetByPatch(int patchX, int patchY, bool state) |
137 | { | 171 | { |
138 | bool prevState = updated[patchX, patchY]; | 172 | bool prevState = updated[patchX, patchY]; |
@@ -142,12 +176,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
142 | updateCount--; | 176 | updateCount--; |
143 | updated[patchX, patchY] = state; | 177 | updated[patchX, patchY] = state; |
144 | } | 178 | } |
179 | <<<<<<< HEAD | ||
145 | 180 | ||
146 | public void SetAll(bool state) | 181 | public void SetAll(bool state) |
147 | { | 182 | { |
148 | updateCount = 0; | 183 | updateCount = 0; |
149 | for(int xx = 0; xx < updated.GetLength(0); xx++) | 184 | for(int xx = 0; xx < updated.GetLength(0); xx++) |
150 | for(int yy = 0; yy < updated.GetLength(1); yy++) | 185 | for(int yy = 0; yy < updated.GetLength(1); yy++) |
186 | ======= | ||
187 | public void SetAll(bool state) | ||
188 | { | ||
189 | updateCount = 0; | ||
190 | for (int xx = 0; xx < updated.GetLength(0); xx++) | ||
191 | for (int yy = 0; yy < updated.GetLength(1); yy++) | ||
192 | >>>>>>> avn/ubitvar | ||
151 | updated[xx, yy] = state; | 193 | updated[xx, yy] = state; |
152 | if (state) | 194 | if (state) |
153 | updateCount = updated.GetLength(0) * updated.GetLength(1); | 195 | updateCount = updated.GetLength(0) * updated.GetLength(1); |
@@ -164,9 +206,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
164 | terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize) | 206 | terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize) |
165 | ); | 207 | ); |
166 | } | 208 | } |
209 | <<<<<<< HEAD | ||
167 | for(int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize) | 210 | for(int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize) |
168 | { | 211 | { |
169 | for(int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize) | 212 | for(int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize) |
213 | ======= | ||
214 | for (int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize) | ||
215 | { | ||
216 | for (int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize) | ||
217 | >>>>>>> avn/ubitvar | ||
170 | { | 218 | { |
171 | // Only set tainted. The patch bit may be set if the patch was to be sent later. | 219 | // Only set tainted. The patch bit may be set if the patch was to be sent later. |
172 | if (terrData.IsTaintedAt(xx, yy, false)) | 220 | if (terrData.IsTaintedAt(xx, yy, false)) |
@@ -227,12 +275,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
227 | (int)m_scene.RegionInfo.RegionSizeY, | 275 | (int)m_scene.RegionInfo.RegionSizeY, |
228 | (int)m_scene.RegionInfo.RegionSizeZ); | 276 | (int)m_scene.RegionInfo.RegionSizeZ); |
229 | m_scene.Heightmap = m_channel; | 277 | m_scene.Heightmap = m_channel; |
278 | <<<<<<< HEAD | ||
230 | UpdateRevertMap(); | 279 | UpdateRevertMap(); |
280 | ======= | ||
281 | UpdateBakedMap(); | ||
282 | >>>>>>> avn/ubitvar | ||
231 | } | 283 | } |
232 | else | 284 | else |
233 | { | 285 | { |
234 | m_channel = m_scene.Heightmap; | 286 | m_channel = m_scene.Heightmap; |
287 | <<<<<<< HEAD | ||
235 | UpdateRevertMap(); | 288 | UpdateRevertMap(); |
289 | ======= | ||
290 | UpdateBakedMap(); | ||
291 | >>>>>>> avn/ubitvar | ||
236 | } | 292 | } |
237 | 293 | ||
238 | m_scene.RegisterModuleInterface<ITerrainModule>(this); | 294 | m_scene.RegisterModuleInterface<ITerrainModule>(this); |
@@ -240,7 +296,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
240 | m_scene.EventManager.OnClientClosed += EventManager_OnClientClosed; | 296 | m_scene.EventManager.OnClientClosed += EventManager_OnClientClosed; |
241 | m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; | 297 | m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; |
242 | m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick; | 298 | m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick; |
299 | <<<<<<< HEAD | ||
243 | m_scene.EventManager.OnFrame += EventManager_OnFrame; | 300 | m_scene.EventManager.OnFrame += EventManager_OnFrame; |
301 | ======= | ||
302 | m_scene.EventManager.OnTerrainCheckUpdates += EventManager_TerrainCheckUpdates; | ||
303 | >>>>>>> avn/ubitvar | ||
244 | } | 304 | } |
245 | 305 | ||
246 | InstallDefaultEffects(); | 306 | InstallDefaultEffects(); |
@@ -279,7 +339,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
279 | // remove the commands | 339 | // remove the commands |
280 | m_scene.UnregisterModuleCommander(m_commander.Name); | 340 | m_scene.UnregisterModuleCommander(m_commander.Name); |
281 | // remove the event-handlers | 341 | // remove the event-handlers |
342 | <<<<<<< HEAD | ||
282 | m_scene.EventManager.OnFrame -= EventManager_OnFrame; | 343 | m_scene.EventManager.OnFrame -= EventManager_OnFrame; |
344 | ======= | ||
345 | m_scene.EventManager.OnTerrainCheckUpdates -= EventManager_TerrainCheckUpdates; | ||
346 | >>>>>>> avn/ubitvar | ||
283 | m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick; | 347 | m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick; |
284 | m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; | 348 | m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; |
285 | m_scene.EventManager.OnClientClosed -= EventManager_OnClientClosed; | 349 | m_scene.EventManager.OnClientClosed -= EventManager_OnClientClosed; |
@@ -334,7 +398,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
334 | m_log.DebugFormat("[TERRAIN]: Loaded terrain, wd/ht: {0}/{1}", channel.Width, channel.Height); | 398 | m_log.DebugFormat("[TERRAIN]: Loaded terrain, wd/ht: {0}/{1}", channel.Width, channel.Height); |
335 | m_scene.Heightmap = channel; | 399 | m_scene.Heightmap = channel; |
336 | m_channel = channel; | 400 | m_channel = channel; |
337 | UpdateRevertMap(); | 401 | UpdateBakedMap(); |
338 | } | 402 | } |
339 | catch(NotImplementedException) | 403 | catch(NotImplementedException) |
340 | { | 404 | { |
@@ -426,7 +490,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
426 | { | 490 | { |
427 | ITerrainChannel channel = loader.Value.LoadStream(stream); | 491 | ITerrainChannel channel = loader.Value.LoadStream(stream); |
428 | m_channel.Merge(channel, displacement, radianRotation, rotationDisplacement); | 492 | m_channel.Merge(channel, displacement, radianRotation, rotationDisplacement); |
493 | <<<<<<< HEAD | ||
429 | UpdateRevertMap(); | 494 | UpdateRevertMap(); |
495 | ======= | ||
496 | UpdateBakedMap(); | ||
497 | >>>>>>> avn/ubitvar | ||
430 | } | 498 | } |
431 | catch(NotImplementedException) | 499 | catch(NotImplementedException) |
432 | { | 500 | { |
@@ -506,16 +574,48 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
506 | 574 | ||
507 | // Someone diddled terrain outside the normal code paths. Set the taintedness for all clients. | 575 | // Someone diddled terrain outside the normal code paths. Set the taintedness for all clients. |
508 | // ITerrainModule.TaintTerrain() | 576 | // ITerrainModule.TaintTerrain() |
577 | <<<<<<< HEAD | ||
509 | public void TaintTerrain() | 578 | public void TaintTerrain() |
510 | { | 579 | { |
511 | lock(m_perClientPatchUpdates) | 580 | lock(m_perClientPatchUpdates) |
512 | { | 581 | { |
513 | // Set the flags for all clients so the tainted patches will be sent out | 582 | // Set the flags for all clients so the tainted patches will be sent out |
514 | foreach(PatchUpdates pups in m_perClientPatchUpdates.Values) | 583 | foreach(PatchUpdates pups in m_perClientPatchUpdates.Values) |
584 | ======= | ||
585 | public void TaintTerrain () | ||
586 | { | ||
587 | lock (m_perClientPatchUpdates) | ||
588 | { | ||
589 | // Set the flags for all clients so the tainted patches will be sent out | ||
590 | foreach (PatchUpdates pups in m_perClientPatchUpdates.Values) | ||
591 | >>>>>>> avn/ubitvar | ||
515 | { | 592 | { |
516 | pups.SetAll(m_scene.Heightmap.GetTerrainData()); | 593 | pups.SetAll(m_scene.Heightmap.GetTerrainData()); |
517 | } | 594 | } |
518 | } | 595 | } |
596 | <<<<<<< HEAD | ||
597 | ======= | ||
598 | } | ||
599 | |||
600 | // ITerrainModule.PushTerrain() | ||
601 | public void PushTerrain(IClientAPI pClient) | ||
602 | { | ||
603 | ScenePresence presence = m_scene.GetScenePresence(pClient.AgentId); | ||
604 | if (presence != null) | ||
605 | { | ||
606 | lock (m_perClientPatchUpdates) | ||
607 | { | ||
608 | PatchUpdates pups; | ||
609 | if (!m_perClientPatchUpdates.TryGetValue(pClient.AgentId, out pups)) | ||
610 | { | ||
611 | // There is a ScenePresence without a send patch map. Create one. | ||
612 | pups = new PatchUpdates(m_scene.Heightmap.GetTerrainData(), presence); | ||
613 | m_perClientPatchUpdates.Add(presence.UUID, pups); | ||
614 | } | ||
615 | pups.SetAll(true); | ||
616 | } | ||
617 | } | ||
618 | >>>>>>> avn/ubitvar | ||
519 | } | 619 | } |
520 | 620 | ||
521 | // ITerrainModule.PushTerrain() | 621 | // ITerrainModule.PushTerrain() |
@@ -636,7 +736,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
636 | m_painteffects[StandardTerrainEffects.Smooth] = new SmoothSphere(); | 736 | m_painteffects[StandardTerrainEffects.Smooth] = new SmoothSphere(); |
637 | m_painteffects[StandardTerrainEffects.Noise] = new NoiseSphere(); | 737 | m_painteffects[StandardTerrainEffects.Noise] = new NoiseSphere(); |
638 | m_painteffects[StandardTerrainEffects.Flatten] = new FlattenSphere(); | 738 | m_painteffects[StandardTerrainEffects.Flatten] = new FlattenSphere(); |
639 | m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_revert); | 739 | m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked); |
640 | m_painteffects[StandardTerrainEffects.Erode] = new ErodeSphere(); | 740 | m_painteffects[StandardTerrainEffects.Erode] = new ErodeSphere(); |
641 | m_painteffects[StandardTerrainEffects.Weather] = new WeatherSphere(); | 741 | m_painteffects[StandardTerrainEffects.Weather] = new WeatherSphere(); |
642 | m_painteffects[StandardTerrainEffects.Olsen] = new OlsenSphere(); | 742 | m_painteffects[StandardTerrainEffects.Olsen] = new OlsenSphere(); |
@@ -647,7 +747,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
647 | m_floodeffects[StandardTerrainEffects.Smooth] = new SmoothArea(); | 747 | m_floodeffects[StandardTerrainEffects.Smooth] = new SmoothArea(); |
648 | m_floodeffects[StandardTerrainEffects.Noise] = new NoiseArea(); | 748 | m_floodeffects[StandardTerrainEffects.Noise] = new NoiseArea(); |
649 | m_floodeffects[StandardTerrainEffects.Flatten] = new FlattenArea(); | 749 | m_floodeffects[StandardTerrainEffects.Flatten] = new FlattenArea(); |
650 | m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_revert); | 750 | m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked); |
651 | 751 | ||
652 | // Terrain Modifier operations | 752 | // Terrain Modifier operations |
653 | m_modifyOperations["min"] = new MinModifier(this); | 753 | m_modifyOperations["min"] = new MinModifier(this); |
@@ -673,10 +773,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
673 | } | 773 | } |
674 | 774 | ||
675 | /// <summary> | 775 | /// <summary> |
676 | /// Saves the current state of the region into the revert map buffer. | 776 | /// Saves the current state of the region into the baked map buffer. |
777 | |||
677 | /// </summary> | 778 | /// </summary> |
678 | public void UpdateRevertMap() | 779 | public void UpdateBakedMap() |
679 | { | 780 | { |
781 | <<<<<<< HEAD | ||
680 | /* | 782 | /* |
681 | int x; | 783 | int x; |
682 | for (x = 0; x < m_channel.Width; x++) | 784 | for (x = 0; x < m_channel.Width; x++) |
@@ -689,6 +791,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
689 | } | 791 | } |
690 | */ | 792 | */ |
691 | m_revert = m_channel.MakeCopy(); | 793 | m_revert = m_channel.MakeCopy(); |
794 | ======= | ||
795 | m_baked = m_channel.MakeCopy(); | ||
796 | m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked); | ||
797 | m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked); | ||
798 | >>>>>>> avn/ubitvar | ||
692 | } | 799 | } |
693 | 800 | ||
694 | /// <summary> | 801 | /// <summary> |
@@ -715,11 +822,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
715 | { | 822 | { |
716 | ITerrainChannel channel = loader.Value.LoadFile(filename, offsetX, offsetY, | 823 | ITerrainChannel channel = loader.Value.LoadFile(filename, offsetX, offsetY, |
717 | fileWidth, fileHeight, | 824 | fileWidth, fileHeight, |
825 | <<<<<<< HEAD | ||
718 | (int)m_scene.RegionInfo.RegionSizeX, | 826 | (int)m_scene.RegionInfo.RegionSizeX, |
719 | (int)m_scene.RegionInfo.RegionSizeY); | 827 | (int)m_scene.RegionInfo.RegionSizeY); |
828 | ======= | ||
829 | (int) m_scene.RegionInfo.RegionSizeX, | ||
830 | (int) m_scene.RegionInfo.RegionSizeY); | ||
831 | >>>>>>> avn/ubitvar | ||
720 | m_scene.Heightmap = channel; | 832 | m_scene.Heightmap = channel; |
721 | m_channel = channel; | 833 | m_channel = channel; |
722 | UpdateRevertMap(); | 834 | UpdateBakedMap(); |
723 | } | 835 | } |
724 | 836 | ||
725 | return; | 837 | return; |
@@ -782,12 +894,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
782 | } | 894 | } |
783 | 895 | ||
784 | /// <summary> | 896 | /// <summary> |
897 | <<<<<<< HEAD | ||
785 | /// Called before processing of every simulation frame. | 898 | /// Called before processing of every simulation frame. |
899 | ======= | ||
900 | >>>>>>> avn/ubitvar | ||
786 | /// This is used to check to see of any of the terrain is tainted and, if so, schedule | 901 | /// This is used to check to see of any of the terrain is tainted and, if so, schedule |
787 | /// updates for all the presences. | 902 | /// updates for all the presences. |
788 | /// This also checks to see if there are updates that need to be sent for each presence. | 903 | /// This also checks to see if there are updates that need to be sent for each presence. |
789 | /// This is where the logic is to send terrain updates to clients. | 904 | /// This is where the logic is to send terrain updates to clients. |
790 | /// </summary> | 905 | /// </summary> |
906 | <<<<<<< HEAD | ||
791 | private void EventManager_OnFrame() | 907 | private void EventManager_OnFrame() |
792 | { | 908 | { |
793 | TerrainData terrData = m_channel.GetTerrainData(); | 909 | TerrainData terrData = m_channel.GetTerrainData(); |
@@ -798,6 +914,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
798 | for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) | 914 | for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) |
799 | { | 915 | { |
800 | if (terrData.IsTaintedAt(x, y)) | 916 | if (terrData.IsTaintedAt(x, y)) |
917 | ======= | ||
918 | private void EventManager_TerrainCheckUpdates() | ||
919 | { | ||
920 | // this needs fixing | ||
921 | TerrainData terrData = m_channel.GetTerrainData(); | ||
922 | |||
923 | bool shouldTaint = false; | ||
924 | for (int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize) | ||
925 | { | ||
926 | for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) | ||
927 | { | ||
928 | if (terrData.IsTaintedAt(x, y,true)) | ||
929 | >>>>>>> avn/ubitvar | ||
801 | { | 930 | { |
802 | // Found a patch that was modified. Push this flag into the clients. | 931 | // Found a patch that was modified. Push this flag into the clients. |
803 | SendToClients(terrData, x, y); | 932 | SendToClients(terrData, x, y); |
@@ -815,6 +944,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
815 | m_scene.EventManager.TriggerTerrainTainted(); | 944 | m_scene.EventManager.TriggerTerrainTainted(); |
816 | m_tainted = true; | 945 | m_tainted = true; |
817 | } | 946 | } |
947 | <<<<<<< HEAD | ||
948 | ======= | ||
949 | |||
950 | >>>>>>> avn/ubitvar | ||
818 | } | 951 | } |
819 | 952 | ||
820 | /// <summary> | 953 | /// <summary> |
@@ -883,11 +1016,18 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
883 | presence.ControllingClient.OnLandUndo -= client_OnLandUndo; | 1016 | presence.ControllingClient.OnLandUndo -= client_OnLandUndo; |
884 | presence.ControllingClient.OnUnackedTerrain -= client_OnUnackedTerrain; | 1017 | presence.ControllingClient.OnUnackedTerrain -= client_OnUnackedTerrain; |
885 | } | 1018 | } |
1019 | <<<<<<< HEAD | ||
886 | 1020 | ||
887 | lock(m_perClientPatchUpdates) | 1021 | lock(m_perClientPatchUpdates) |
888 | m_perClientPatchUpdates.Remove(client); | 1022 | m_perClientPatchUpdates.Remove(client); |
889 | } | 1023 | } |
1024 | ======= | ||
1025 | >>>>>>> avn/ubitvar | ||
890 | 1026 | ||
1027 | lock (m_perClientPatchUpdates) | ||
1028 | m_perClientPatchUpdates.Remove(client); | ||
1029 | } | ||
1030 | |||
891 | /// <summary> | 1031 | /// <summary> |
892 | /// Scan over changes in the terrain and limit height changes. This enforces the | 1032 | /// Scan over changes in the terrain and limit height changes. This enforces the |
893 | /// non-estate owner limits on rate of terrain editting. | 1033 | /// non-estate owner limits on rate of terrain editting. |
@@ -898,12 +1038,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
898 | TerrainData terrData = m_channel.GetTerrainData(); | 1038 | TerrainData terrData = m_channel.GetTerrainData(); |
899 | 1039 | ||
900 | bool wasLimited = false; | 1040 | bool wasLimited = false; |
1041 | <<<<<<< HEAD | ||
901 | for(int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize) | 1042 | for(int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize) |
902 | { | 1043 | { |
903 | for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) | 1044 | for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) |
904 | { | 1045 | { |
905 | if (terrData.IsTaintedAt(x, y, false /* clearOnTest */)) | 1046 | if (terrData.IsTaintedAt(x, y, false /* clearOnTest */)) |
906 | { | 1047 | { |
1048 | ======= | ||
1049 | for (int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize) | ||
1050 | { | ||
1051 | for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) | ||
1052 | { | ||
1053 | if (terrData.IsTaintedAt(x, y, false /* clearOnTest */)) | ||
1054 | { | ||
1055 | >>>>>>> avn/ubitvar | ||
907 | // If we should respect the estate settings then | 1056 | // If we should respect the estate settings then |
908 | // fixup and height deltas that don't respect them. | 1057 | // fixup and height deltas that don't respect them. |
909 | // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values. | 1058 | // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values. |
@@ -926,13 +1075,22 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
926 | float maxDelta = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; | 1075 | float maxDelta = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; |
927 | 1076 | ||
928 | // loop through the height map for this patch and compare it against | 1077 | // loop through the height map for this patch and compare it against |
1078 | <<<<<<< HEAD | ||
929 | // the revert map | 1079 | // the revert map |
930 | for(int x = xStart; x < xStart + Constants.TerrainPatchSize; x++) | 1080 | for(int x = xStart; x < xStart + Constants.TerrainPatchSize; x++) |
1081 | ======= | ||
1082 | // the baked map | ||
1083 | for (int x = xStart; x < xStart + Constants.TerrainPatchSize; x++) | ||
1084 | >>>>>>> avn/ubitvar | ||
931 | { | 1085 | { |
932 | for(int y = yStart; y < yStart + Constants.TerrainPatchSize; y++) | 1086 | for(int y = yStart; y < yStart + Constants.TerrainPatchSize; y++) |
933 | { | 1087 | { |
934 | float requestedHeight = terrData[x, y]; | 1088 | float requestedHeight = terrData[x, y]; |
1089 | <<<<<<< HEAD | ||
935 | float bakedHeight = (float)m_revert[x, y]; | 1090 | float bakedHeight = (float)m_revert[x, y]; |
1091 | ======= | ||
1092 | float bakedHeight = (float)m_baked[x, y]; | ||
1093 | >>>>>>> avn/ubitvar | ||
936 | float requestedDelta = requestedHeight - bakedHeight; | 1094 | float requestedDelta = requestedHeight - bakedHeight; |
937 | 1095 | ||
938 | if (requestedDelta > maxDelta) | 1096 | if (requestedDelta > maxDelta) |
@@ -953,6 +1111,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
953 | 1111 | ||
954 | private void client_OnLandUndo(IClientAPI client) | 1112 | private void client_OnLandUndo(IClientAPI client) |
955 | { | 1113 | { |
1114 | <<<<<<< HEAD | ||
956 | lock(m_undo) | 1115 | lock(m_undo) |
957 | { | 1116 | { |
958 | if (m_undo.Count > 0) | 1117 | if (m_undo.Count > 0) |
@@ -962,6 +1121,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
962 | goback.PlaybackState(); | 1121 | goback.PlaybackState(); |
963 | } | 1122 | } |
964 | } | 1123 | } |
1124 | ======= | ||
1125 | |||
1126 | >>>>>>> avn/ubitvar | ||
965 | } | 1127 | } |
966 | 1128 | ||
967 | /// <summary> | 1129 | /// <summary> |
@@ -971,6 +1133,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
971 | /// <param name="x">The patch corner to send</param> | 1133 | /// <param name="x">The patch corner to send</param> |
972 | /// <param name="y">The patch corner to send</param> | 1134 | /// <param name="y">The patch corner to send</param> |
973 | private void SendToClients(TerrainData terrData, int x, int y) | 1135 | private void SendToClients(TerrainData terrData, int x, int y) |
1136 | <<<<<<< HEAD | ||
974 | { | 1137 | { |
975 | if (m_sendTerrainUpdatesByViewDistance) | 1138 | if (m_sendTerrainUpdatesByViewDistance) |
976 | { | 1139 | { |
@@ -1138,6 +1301,181 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1138 | ret.Add(new PatchesToSend(x, y, dist)); | 1301 | ret.Add(new PatchesToSend(x, y, dist)); |
1139 | } | 1302 | } |
1140 | } | 1303 | } |
1304 | ======= | ||
1305 | { | ||
1306 | // Add that this patch needs to be sent to the accounting for each client. | ||
1307 | lock (m_perClientPatchUpdates) | ||
1308 | { | ||
1309 | m_scene.ForEachScenePresence(presence => | ||
1310 | { | ||
1311 | PatchUpdates thisClientUpdates; | ||
1312 | if (!m_perClientPatchUpdates.TryGetValue(presence.UUID, out thisClientUpdates)) | ||
1313 | { | ||
1314 | // There is a ScenePresence without a send patch map. Create one. | ||
1315 | thisClientUpdates = new PatchUpdates(terrData, presence); | ||
1316 | m_perClientPatchUpdates.Add(presence.UUID, thisClientUpdates); | ||
1317 | } | ||
1318 | thisClientUpdates.SetByXY(x, y, true); | ||
1319 | } | ||
1320 | ); | ||
1321 | } | ||
1322 | } | ||
1323 | |||
1324 | private class PatchesToSend : IComparable<PatchesToSend> | ||
1325 | { | ||
1326 | public int PatchX; | ||
1327 | public int PatchY; | ||
1328 | public float Dist; | ||
1329 | public PatchesToSend(int pX, int pY, float pDist) | ||
1330 | { | ||
1331 | PatchX = pX; | ||
1332 | PatchY = pY; | ||
1333 | Dist = pDist; | ||
1334 | } | ||
1335 | public int CompareTo(PatchesToSend other) | ||
1336 | { | ||
1337 | return Dist.CompareTo(other.Dist); | ||
1338 | } | ||
1339 | } | ||
1340 | |||
1341 | // Called each frame time to see if there are any patches to send to any of the | ||
1342 | // ScenePresences. | ||
1343 | // Loop through all the per-client info and send any patches necessary. | ||
1344 | private void CheckSendingPatchesToClients() | ||
1345 | { | ||
1346 | lock (m_perClientPatchUpdates) | ||
1347 | { | ||
1348 | foreach (PatchUpdates pups in m_perClientPatchUpdates.Values) | ||
1349 | { | ||
1350 | // throught acording to land queue free to send bytes | ||
1351 | if (!pups.Presence.ControllingClient.CanSendLayerData()) | ||
1352 | continue; | ||
1353 | |||
1354 | if (pups.HasUpdates()) | ||
1355 | { | ||
1356 | // There is something that could be sent to this client. | ||
1357 | List<PatchesToSend> toSend = GetModifiedPatchesInViewDistance(pups); | ||
1358 | if (toSend.Count > 0) | ||
1359 | { | ||
1360 | // m_log.DebugFormat("{0} CheckSendingPatchesToClient: sending {1} patches to {2} in region {3}", | ||
1361 | // LogHeader, toSend.Count, pups.Presence.Name, m_scene.RegionInfo.RegionName); | ||
1362 | // Sort the patches to send by the distance from the presence | ||
1363 | toSend.Sort(); | ||
1364 | /* | ||
1365 | foreach (PatchesToSend pts in toSend) | ||
1366 | { | ||
1367 | pups.Presence.ControllingClient.SendLayerData(pts.PatchX, pts.PatchY, null); | ||
1368 | // presence.ControllingClient.SendLayerData(xs.ToArray(), ys.ToArray(), null, TerrainPatch.LayerType.Land); | ||
1369 | } | ||
1370 | */ | ||
1371 | |||
1372 | int[] xPieces = new int[toSend.Count]; | ||
1373 | int[] yPieces = new int[toSend.Count]; | ||
1374 | float[] patchPieces = new float[toSend.Count * 2]; | ||
1375 | int pieceIndex = 0; | ||
1376 | foreach (PatchesToSend pts in toSend) | ||
1377 | { | ||
1378 | patchPieces[pieceIndex++] = pts.PatchX; | ||
1379 | patchPieces[pieceIndex++] = pts.PatchY; | ||
1380 | } | ||
1381 | pups.Presence.ControllingClient.SendLayerData(-toSend.Count, 0, patchPieces); | ||
1382 | } | ||
1383 | } | ||
1384 | } | ||
1385 | } | ||
1386 | } | ||
1387 | |||
1388 | private List<PatchesToSend> GetModifiedPatchesInViewDistance(PatchUpdates pups) | ||
1389 | { | ||
1390 | List<PatchesToSend> ret = new List<PatchesToSend>(); | ||
1391 | |||
1392 | int npatchs = 0; | ||
1393 | |||
1394 | ScenePresence presence = pups.Presence; | ||
1395 | if (presence == null) | ||
1396 | return ret; | ||
1397 | |||
1398 | float minz = presence.AbsolutePosition.Z; | ||
1399 | if (presence.CameraPosition.Z < minz) | ||
1400 | minz = presence.CameraPosition.Z; | ||
1401 | |||
1402 | // this limit should be max terrainheight + max draw | ||
1403 | if (minz > 1500f) | ||
1404 | return ret; | ||
1405 | |||
1406 | int DrawDistance = (int)presence.DrawDistance; | ||
1407 | |||
1408 | DrawDistance = DrawDistance / Constants.TerrainPatchSize; | ||
1409 | |||
1410 | int testposX; | ||
1411 | int testposY; | ||
1412 | |||
1413 | if (Math.Abs(presence.AbsolutePosition.X - presence.CameraPosition.X) > 30 | ||
1414 | || Math.Abs(presence.AbsolutePosition.Y - presence.CameraPosition.Y) > 30) | ||
1415 | { | ||
1416 | testposX = (int)presence.CameraPosition.X / Constants.TerrainPatchSize; | ||
1417 | testposY = (int)presence.CameraPosition.Y / Constants.TerrainPatchSize; | ||
1418 | } | ||
1419 | else | ||
1420 | { | ||
1421 | testposX = (int)presence.AbsolutePosition.X / Constants.TerrainPatchSize; | ||
1422 | testposY = (int)presence.AbsolutePosition.Y / Constants.TerrainPatchSize; | ||
1423 | } | ||
1424 | int limitX = (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize; | ||
1425 | int limitY = (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize; | ||
1426 | |||
1427 | // Compute the area of patches within our draw distance | ||
1428 | int startX = testposX - DrawDistance; | ||
1429 | if (startX < 0) | ||
1430 | startX = 0; | ||
1431 | else if (startX > limitX) | ||
1432 | startX = limitX; | ||
1433 | |||
1434 | int startY = testposY - DrawDistance; | ||
1435 | if (startY < 0) | ||
1436 | startY = 0; | ||
1437 | else if (startY > limitY) | ||
1438 | startY = limitY; | ||
1439 | |||
1440 | int endX = testposX + DrawDistance; | ||
1441 | if (endX < 0) | ||
1442 | endX = 0; | ||
1443 | else if (endX > limitX) | ||
1444 | endX = limitX; | ||
1445 | |||
1446 | int endY = testposY + DrawDistance; | ||
1447 | if (endY < 0) | ||
1448 | endY = 0; | ||
1449 | else if (endY > limitY) | ||
1450 | endY = limitY; | ||
1451 | |||
1452 | int distx; | ||
1453 | int disty; | ||
1454 | int distsq; | ||
1455 | |||
1456 | DrawDistance *= DrawDistance; | ||
1457 | |||
1458 | for (int x = startX; x < endX; x++) | ||
1459 | { | ||
1460 | for (int y = startY; y < endY; y++) | ||
1461 | { | ||
1462 | if (pups.GetByPatch(x, y)) | ||
1463 | { | ||
1464 | distx = x - testposX; | ||
1465 | disty = y - testposY; | ||
1466 | distsq = distx * distx + disty * disty; | ||
1467 | if (distsq < DrawDistance) | ||
1468 | { | ||
1469 | pups.SetByPatch(x, y, false); | ||
1470 | ret.Add(new PatchesToSend(x, y, (float)distsq)); | ||
1471 | if (npatchs++ > 65536) | ||
1472 | { | ||
1473 | y = endY; | ||
1474 | x = endX; | ||
1475 | } | ||
1476 | } | ||
1477 | } | ||
1478 | >>>>>>> avn/ubitvar | ||
1141 | } | 1479 | } |
1142 | } | 1480 | } |
1143 | return ret; | 1481 | return ret; |
@@ -1161,6 +1499,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1161 | int zx = (int)(west + 0.5); | 1499 | int zx = (int)(west + 0.5); |
1162 | int zy = (int)(north + 0.5); | 1500 | int zy = (int)(north + 0.5); |
1163 | 1501 | ||
1502 | <<<<<<< HEAD | ||
1164 | int dx; | 1503 | int dx; |
1165 | for(dx=-n; dx<=n; dx++) | 1504 | for(dx=-n; dx<=n; dx++) |
1166 | { | 1505 | { |
@@ -1176,16 +1515,52 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1176 | allowMask[x, y] = true; | 1515 | allowMask[x, y] = true; |
1177 | allowed = true; | 1516 | allowed = true; |
1178 | } | 1517 | } |
1518 | ======= | ||
1519 | |||
1520 | int startX = zx - n; | ||
1521 | if (startX < 0) | ||
1522 | startX = 0; | ||
1523 | |||
1524 | int startY = zy - n; | ||
1525 | if (startY < 0) | ||
1526 | startY = 0; | ||
1527 | |||
1528 | int endX = zx + n; | ||
1529 | if (endX >= m_channel.Width) | ||
1530 | endX = m_channel.Width - 1; | ||
1531 | int endY = zy + n; | ||
1532 | if (endY >= m_channel.Height) | ||
1533 | endY = m_channel.Height - 1; | ||
1534 | |||
1535 | int x, y; | ||
1536 | |||
1537 | for (x = startX; x <= endX; x++) | ||
1538 | { | ||
1539 | for (y = startY; y <= endY; y++) | ||
1540 | { | ||
1541 | if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x, y, 0))) | ||
1542 | { | ||
1543 | allowMask[x, y] = true; | ||
1544 | allowed = true; | ||
1545 | >>>>>>> avn/ubitvar | ||
1179 | } | 1546 | } |
1180 | } | 1547 | } |
1181 | } | 1548 | } |
1182 | if (allowed) | 1549 | if (allowed) |
1183 | { | 1550 | { |
1184 | StoreUndoState(); | 1551 | StoreUndoState(); |
1552 | <<<<<<< HEAD | ||
1185 | m_painteffects[(StandardTerrainEffects)action].PaintEffect( | 1553 | m_painteffects[(StandardTerrainEffects)action].PaintEffect( |
1186 | m_channel, allowMask, west, south, height, size, seconds); | 1554 | m_channel, allowMask, west, south, height, size, seconds); |
1187 | 1555 | ||
1188 | //revert changes outside estate limits | 1556 | //revert changes outside estate limits |
1557 | ======= | ||
1558 | m_painteffects[(StandardTerrainEffects) action].PaintEffect( | ||
1559 | m_channel, allowMask, west, south, height, size, seconds, | ||
1560 | startX, endX, startY, endY); | ||
1561 | |||
1562 | //block changes outside estate limits | ||
1563 | >>>>>>> avn/ubitvar | ||
1189 | if (!god) | 1564 | if (!god) |
1190 | EnforceEstateLimits(); | 1565 | EnforceEstateLimits(); |
1191 | } | 1566 | } |
@@ -1225,9 +1600,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1225 | if (allowed) | 1600 | if (allowed) |
1226 | { | 1601 | { |
1227 | StoreUndoState(); | 1602 | StoreUndoState(); |
1603 | <<<<<<< HEAD | ||
1228 | m_floodeffects[(StandardTerrainEffects)action].FloodEffect(m_channel, fillArea, size); | 1604 | m_floodeffects[(StandardTerrainEffects)action].FloodEffect(m_channel, fillArea, size); |
1229 | 1605 | ||
1230 | //revert changes outside estate limits | 1606 | //revert changes outside estate limits |
1607 | ======= | ||
1608 | m_floodeffects[(StandardTerrainEffects) action].FloodEffect(m_channel, fillArea, size); | ||
1609 | |||
1610 | //block changes outside estate limits | ||
1611 | >>>>>>> avn/ubitvar | ||
1231 | if (!god) | 1612 | if (!god) |
1232 | EnforceEstateLimits(); | 1613 | EnforceEstateLimits(); |
1233 | } | 1614 | } |
@@ -1260,6 +1641,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1260 | 1641 | ||
1261 | private void StoreUndoState() | 1642 | private void StoreUndoState() |
1262 | { | 1643 | { |
1644 | <<<<<<< HEAD | ||
1263 | lock(m_undo) | 1645 | lock(m_undo) |
1264 | { | 1646 | { |
1265 | if (m_undo.Count > 0) | 1647 | if (m_undo.Count > 0) |
@@ -1275,22 +1657,36 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1275 | LandUndoState nUndo = new LandUndoState(this, m_channel); | 1657 | LandUndoState nUndo = new LandUndoState(this, m_channel); |
1276 | m_undo.Push(nUndo); | 1658 | m_undo.Push(nUndo); |
1277 | } | 1659 | } |
1660 | ======= | ||
1661 | >>>>>>> avn/ubitvar | ||
1278 | } | 1662 | } |
1279 | 1663 | ||
1280 | #region Console Commands | 1664 | #region Console Commands |
1281 | 1665 | ||
1282 | private void InterfaceLoadFile(Object[] args) | 1666 | private void InterfaceLoadFile(Object[] args) |
1283 | { | 1667 | { |
1668 | <<<<<<< HEAD | ||
1284 | LoadFromFile((string)args[0]); | 1669 | LoadFromFile((string)args[0]); |
1670 | ======= | ||
1671 | LoadFromFile((string) args[0]); | ||
1672 | >>>>>>> avn/ubitvar | ||
1285 | } | 1673 | } |
1286 | 1674 | ||
1287 | private void InterfaceLoadTileFile(Object[] args) | 1675 | private void InterfaceLoadTileFile(Object[] args) |
1288 | { | 1676 | { |
1677 | <<<<<<< HEAD | ||
1289 | LoadFromFile((string)args[0], | 1678 | LoadFromFile((string)args[0], |
1290 | (int)args[1], | 1679 | (int)args[1], |
1291 | (int)args[2], | 1680 | (int)args[2], |
1292 | (int)args[3], | 1681 | (int)args[3], |
1293 | (int)args[4]); | 1682 | (int)args[4]); |
1683 | ======= | ||
1684 | LoadFromFile((string) args[0], | ||
1685 | (int) args[1], | ||
1686 | (int) args[2], | ||
1687 | (int) args[3], | ||
1688 | (int) args[4]); | ||
1689 | >>>>>>> avn/ubitvar | ||
1294 | } | 1690 | } |
1295 | 1691 | ||
1296 | private void InterfaceSaveFile(Object[] args) | 1692 | private void InterfaceSaveFile(Object[] args) |
@@ -1309,15 +1705,21 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1309 | 1705 | ||
1310 | private void InterfaceBakeTerrain(Object[] args) | 1706 | private void InterfaceBakeTerrain(Object[] args) |
1311 | { | 1707 | { |
1312 | UpdateRevertMap(); | 1708 | UpdateBakedMap(); |
1313 | } | 1709 | } |
1314 | 1710 | ||
1315 | private void InterfaceRevertTerrain(Object[] args) | 1711 | private void InterfaceRevertTerrain(Object[] args) |
1316 | { | 1712 | { |
1317 | int x, y; | 1713 | int x, y; |
1714 | <<<<<<< HEAD | ||
1318 | for(x = 0; x < m_channel.Width; x++) | 1715 | for(x = 0; x < m_channel.Width; x++) |
1319 | for(y = 0; y < m_channel.Height; y++) | 1716 | for(y = 0; y < m_channel.Height; y++) |
1320 | m_channel[x, y] = m_revert[x, y]; | 1717 | m_channel[x, y] = m_revert[x, y]; |
1718 | ======= | ||
1719 | for (x = 0; x < m_channel.Width; x++) | ||
1720 | for (y = 0; y < m_channel.Height; y++) | ||
1721 | m_channel[x, y] = m_baked[x, y]; | ||
1722 | >>>>>>> avn/ubitvar | ||
1321 | 1723 | ||
1322 | } | 1724 | } |
1323 | 1725 | ||
@@ -1327,9 +1729,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1327 | 1729 | ||
1328 | if (direction.ToLower().StartsWith("y")) | 1730 | if (direction.ToLower().StartsWith("y")) |
1329 | { | 1731 | { |
1732 | <<<<<<< HEAD | ||
1330 | for(int x = 0; x < m_channel.Width; x++) | 1733 | for(int x = 0; x < m_channel.Width; x++) |
1331 | { | 1734 | { |
1332 | for(int y = 0; y < m_channel.Height / 2; y++) | 1735 | for(int y = 0; y < m_channel.Height / 2; y++) |
1736 | ======= | ||
1737 | for (int x = 0; x < m_channel.Width; x++) | ||
1738 | { | ||
1739 | for (int y = 0; y < m_channel.Height / 2; y++) | ||
1740 | >>>>>>> avn/ubitvar | ||
1333 | { | 1741 | { |
1334 | double height = m_channel[x, y]; | 1742 | double height = m_channel[x, y]; |
1335 | double flippedHeight = m_channel[x, (int)m_channel.Height - 1 - y]; | 1743 | double flippedHeight = m_channel[x, (int)m_channel.Height - 1 - y]; |
@@ -1341,9 +1749,15 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1341 | } | 1749 | } |
1342 | else if (direction.ToLower().StartsWith("x")) | 1750 | else if (direction.ToLower().StartsWith("x")) |
1343 | { | 1751 | { |
1752 | <<<<<<< HEAD | ||
1344 | for(int y = 0; y < m_channel.Height; y++) | 1753 | for(int y = 0; y < m_channel.Height; y++) |
1345 | { | 1754 | { |
1346 | for(int x = 0; x < m_channel.Width / 2; x++) | 1755 | for(int x = 0; x < m_channel.Width / 2; x++) |
1756 | ======= | ||
1757 | for (int y = 0; y < m_channel.Height; y++) | ||
1758 | { | ||
1759 | for (int x = 0; x < m_channel.Width / 2; x++) | ||
1760 | >>>>>>> avn/ubitvar | ||
1347 | { | 1761 | { |
1348 | double height = m_channel[x, y]; | 1762 | double height = m_channel[x, y]; |
1349 | double flippedHeight = m_channel[(int)m_channel.Width - 1 - x, y]; | 1763 | double flippedHeight = m_channel[(int)m_channel.Width - 1 - x, y]; |
@@ -1420,45 +1834,81 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1420 | 1834 | ||
1421 | private void InterfaceElevateTerrain(Object[] args) | 1835 | private void InterfaceElevateTerrain(Object[] args) |
1422 | { | 1836 | { |
1837 | double val = (double)args[0]; | ||
1838 | |||
1423 | int x, y; | 1839 | int x, y; |
1840 | <<<<<<< HEAD | ||
1424 | for(x = 0; x < m_channel.Width; x++) | 1841 | for(x = 0; x < m_channel.Width; x++) |
1425 | for(y = 0; y < m_channel.Height; y++) | 1842 | for(y = 0; y < m_channel.Height; y++) |
1426 | m_channel[x, y] += (double)args[0]; | 1843 | m_channel[x, y] += (double)args[0]; |
1844 | ======= | ||
1845 | for (x = 0; x < m_channel.Width; x++) | ||
1846 | for (y = 0; y < m_channel.Height; y++) | ||
1847 | m_channel[x, y] += val; | ||
1848 | >>>>>>> avn/ubitvar | ||
1427 | } | 1849 | } |
1428 | 1850 | ||
1429 | private void InterfaceMultiplyTerrain(Object[] args) | 1851 | private void InterfaceMultiplyTerrain(Object[] args) |
1430 | { | 1852 | { |
1431 | int x, y; | 1853 | int x, y; |
1854 | <<<<<<< HEAD | ||
1432 | for(x = 0; x < m_channel.Width; x++) | 1855 | for(x = 0; x < m_channel.Width; x++) |
1433 | for(y = 0; y < m_channel.Height; y++) | 1856 | for(y = 0; y < m_channel.Height; y++) |
1434 | m_channel[x, y] *= (double)args[0]; | 1857 | m_channel[x, y] *= (double)args[0]; |
1858 | ======= | ||
1859 | double val = (double)args[0]; | ||
1860 | |||
1861 | for (x = 0; x < m_channel.Width; x++) | ||
1862 | for (y = 0; y < m_channel.Height; y++) | ||
1863 | m_channel[x, y] *= val; | ||
1864 | >>>>>>> avn/ubitvar | ||
1435 | } | 1865 | } |
1436 | 1866 | ||
1437 | private void InterfaceLowerTerrain(Object[] args) | 1867 | private void InterfaceLowerTerrain(Object[] args) |
1438 | { | 1868 | { |
1439 | int x, y; | 1869 | int x, y; |
1870 | <<<<<<< HEAD | ||
1440 | for(x = 0; x < m_channel.Width; x++) | 1871 | for(x = 0; x < m_channel.Width; x++) |
1441 | for(y = 0; y < m_channel.Height; y++) | 1872 | for(y = 0; y < m_channel.Height; y++) |
1442 | m_channel[x, y] -= (double)args[0]; | 1873 | m_channel[x, y] -= (double)args[0]; |
1874 | ======= | ||
1875 | double val = (double)args[0]; | ||
1876 | |||
1877 | for (x = 0; x < m_channel.Width; x++) | ||
1878 | for (y = 0; y < m_channel.Height; y++) | ||
1879 | m_channel[x, y] -= val; | ||
1880 | >>>>>>> avn/ubitvar | ||
1443 | } | 1881 | } |
1444 | 1882 | ||
1445 | public void InterfaceFillTerrain(Object[] args) | 1883 | public void InterfaceFillTerrain(Object[] args) |
1446 | { | 1884 | { |
1447 | int x, y; | 1885 | int x, y; |
1886 | double val = (double)args[0]; | ||
1448 | 1887 | ||
1888 | <<<<<<< HEAD | ||
1449 | for(x = 0; x < m_channel.Width; x++) | 1889 | for(x = 0; x < m_channel.Width; x++) |
1450 | for(y = 0; y < m_channel.Height; y++) | 1890 | for(y = 0; y < m_channel.Height; y++) |
1451 | m_channel[x, y] = (double)args[0]; | 1891 | m_channel[x, y] = (double)args[0]; |
1892 | ======= | ||
1893 | for (x = 0; x < m_channel.Width; x++) | ||
1894 | for (y = 0; y < m_channel.Height; y++) | ||
1895 | m_channel[x, y] = val; | ||
1896 | >>>>>>> avn/ubitvar | ||
1452 | } | 1897 | } |
1453 | 1898 | ||
1454 | private void InterfaceMinTerrain(Object[] args) | 1899 | private void InterfaceMinTerrain(Object[] args) |
1455 | { | 1900 | { |
1456 | int x, y; | 1901 | int x, y; |
1902 | <<<<<<< HEAD | ||
1457 | for(x = 0; x < m_channel.Width; x++) | 1903 | for(x = 0; x < m_channel.Width; x++) |
1904 | ======= | ||
1905 | double val = (double)args[0]; | ||
1906 | for (x = 0; x < m_channel.Width; x++) | ||
1907 | >>>>>>> avn/ubitvar | ||
1458 | { | 1908 | { |
1459 | for(y = 0; y < m_channel.Height; y++) | 1909 | for(y = 0; y < m_channel.Height; y++) |
1460 | { | 1910 | { |
1461 | m_channel[x, y] = Math.Max((double)args[0], m_channel[x, y]); | 1911 | m_channel[x, y] = Math.Max(val, m_channel[x, y]); |
1462 | } | 1912 | } |
1463 | } | 1913 | } |
1464 | } | 1914 | } |
@@ -1466,13 +1916,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1466 | private void InterfaceMaxTerrain(Object[] args) | 1916 | private void InterfaceMaxTerrain(Object[] args) |
1467 | { | 1917 | { |
1468 | int x, y; | 1918 | int x, y; |
1919 | <<<<<<< HEAD | ||
1469 | for(x = 0; x < m_channel.Width; x++) | 1920 | for(x = 0; x < m_channel.Width; x++) |
1921 | ======= | ||
1922 | double val = (double)args[0]; | ||
1923 | for (x = 0; x < m_channel.Width; x++) | ||
1924 | >>>>>>> avn/ubitvar | ||
1470 | { | 1925 | { |
1471 | for(y = 0; y < m_channel.Height; y++) | 1926 | for(y = 0; y < m_channel.Height; y++) |
1472 | { | 1927 | { |
1473 | m_channel[x, y] = Math.Min((double)args[0], m_channel[x, y]); | 1928 | m_channel[x, y] = Math.Min(val, m_channel[x, y]); |
1474 | } | 1929 | } |
1475 | } | 1930 | } |
1931 | <<<<<<< HEAD | ||
1476 | } | 1932 | } |
1477 | 1933 | ||
1478 | private void InterfaceShow(Object[] args) | 1934 | private void InterfaceShow(Object[] args) |
@@ -1488,6 +1944,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1488 | double height = m_channel[(int)point.X, (int)point.Y]; | 1944 | double height = m_channel[(int)point.X, (int)point.Y]; |
1489 | 1945 | ||
1490 | Console.WriteLine("Terrain height at {0} is {1}", point, height); | 1946 | Console.WriteLine("Terrain height at {0} is {1}", point, height); |
1947 | ======= | ||
1948 | >>>>>>> avn/ubitvar | ||
1491 | } | 1949 | } |
1492 | 1950 | ||
1493 | private void InterfaceShowDebugStats(Object[] args) | 1951 | private void InterfaceShowDebugStats(Object[] args) |
@@ -1620,9 +2078,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
1620 | multiplyCommand.AddArgument("value", "The value to multiply the heightmap by.", "Double"); | 2078 | multiplyCommand.AddArgument("value", "The value to multiply the heightmap by.", "Double"); |
1621 | 2079 | ||
1622 | Command bakeRegionCommand = | 2080 | Command bakeRegionCommand = |
1623 | new Command("bake", CommandIntentions.COMMAND_HAZARDOUS, InterfaceBakeTerrain, "Saves the current terrain into the regions revert map."); | 2081 | new Command("bake", CommandIntentions.COMMAND_HAZARDOUS, InterfaceBakeTerrain, "Saves the current terrain into the regions baked map."); |
1624 | Command revertRegionCommand = | 2082 | Command revertRegionCommand = |
1625 | new Command("revert", CommandIntentions.COMMAND_HAZARDOUS, InterfaceRevertTerrain, "Loads the revert map terrain into the regions heightmap."); | 2083 | new Command("revert", CommandIntentions.COMMAND_HAZARDOUS, InterfaceRevertTerrain, "Loads the baked map terrain into the regions heightmap."); |
1626 | 2084 | ||
1627 | Command flipCommand = | 2085 | Command flipCommand = |
1628 | new Command("flip", CommandIntentions.COMMAND_HAZARDOUS, InterfaceFlipTerrain, "Flips the current terrain about the X or Y axis"); | 2086 | new Command("flip", CommandIntentions.COMMAND_HAZARDOUS, InterfaceFlipTerrain, "Flips the current terrain about the X or Y axis"); |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs index 29e80ef..40db370 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs | |||
@@ -60,7 +60,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests | |||
60 | TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize); | 60 | TerrainChannel map = new TerrainChannel((int)Constants.RegionSize, (int)Constants.RegionSize); |
61 | ITerrainPaintableEffect effect = new RaiseSphere(); | 61 | ITerrainPaintableEffect effect = new RaiseSphere(); |
62 | 62 | ||
63 | <<<<<<< HEAD | ||
63 | effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0); | 64 | effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0); |
65 | ======= | ||
66 | effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0, | ||
67 | 0, midRegion - 1,0, (int)Constants.RegionSize -1); | ||
68 | >>>>>>> avn/ubitvar | ||
64 | Assert.That(map[127, midRegion] > 0.0, "Raise brush should raising value at this point (127,128)."); | 69 | Assert.That(map[127, midRegion] > 0.0, "Raise brush should raising value at this point (127,128)."); |
65 | Assert.That(map[125, midRegion] > 0.0, "Raise brush should raising value at this point (124,128)."); | 70 | Assert.That(map[125, midRegion] > 0.0, "Raise brush should raising value at this point (124,128)."); |
66 | Assert.That(map[120, midRegion] == 0.0, "Raise brush should not change value at this point (120,128)."); | 71 | Assert.That(map[120, midRegion] == 0.0, "Raise brush should not change value at this point (120,128)."); |
@@ -79,7 +84,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests | |||
79 | } | 84 | } |
80 | effect = new LowerSphere(); | 85 | effect = new LowerSphere(); |
81 | 86 | ||
87 | <<<<<<< HEAD | ||
82 | effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0); | 88 | effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0); |
89 | ======= | ||
90 | effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0, | ||
91 | 0, (int)Constants.RegionSize -1,0, (int)Constants.RegionSize -1); | ||
92 | >>>>>>> avn/ubitvar | ||
83 | Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); | 93 | Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); |
84 | Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); | 94 | Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128)."); |
85 | Assert.That(map[125, midRegion] < 1.0, "Lower brush should lowering value at this point (124,128)."); | 95 | Assert.That(map[125, midRegion] < 1.0, "Lower brush should lowering value at this point (124,128)."); |
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs index 9534ad3..77c10b8 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs | |||
@@ -79,9 +79,13 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
79 | /// <remarks>Based on the algorithm described at http://opensimulator.org/wiki/Terrain_Splatting | 79 | /// <remarks>Based on the algorithm described at http://opensimulator.org/wiki/Terrain_Splatting |
80 | /// Note we create a 256x256 dimension texture even if the actual terrain is larger. | 80 | /// Note we create a 256x256 dimension texture even if the actual terrain is larger. |
81 | /// </remarks> | 81 | /// </remarks> |
82 | <<<<<<< HEAD | ||
82 | public static Bitmap Splat(ITerrainChannel terrain, | 83 | public static Bitmap Splat(ITerrainChannel terrain, |
83 | UUID[] textureIDs, float[] startHeights, float[] heightRanges, | 84 | UUID[] textureIDs, float[] startHeights, float[] heightRanges, |
84 | Vector3d regionPosition, IAssetService assetService, bool textureTerrain) | 85 | Vector3d regionPosition, IAssetService assetService, bool textureTerrain) |
86 | ======= | ||
87 | public static Bitmap Splat(ITerrainChannel terrain, UUID[] textureIDs, float[] startHeights, float[] heightRanges, Vector3d regionPosition, IAssetService assetService, bool textureTerrain) | ||
88 | >>>>>>> avn/ubitvar | ||
85 | { | 89 | { |
86 | Debug.Assert(textureIDs.Length == 4); | 90 | Debug.Assert(textureIDs.Length == 4); |
87 | Debug.Assert(startHeights.Length == 4); | 91 | Debug.Assert(startHeights.Length == 4); |
@@ -195,12 +199,74 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
195 | using (SolidBrush brush = new SolidBrush(DEFAULT_TERRAIN_COLOR[i])) | 199 | using (SolidBrush brush = new SolidBrush(DEFAULT_TERRAIN_COLOR[i])) |
196 | gfx.FillRectangle(brush, 0, 0, 256, 256); | 200 | gfx.FillRectangle(brush, 0, 0, 256, 256); |
197 | } | 201 | } |
202 | else | ||
203 | { | ||
204 | if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256) | ||
205 | { | ||
206 | detailTexture[i] = ResizeBitmap(detailTexture[i], 256, 256); | ||
207 | } | ||
208 | } | ||
198 | } | 209 | } |
210 | <<<<<<< HEAD | ||
199 | else | 211 | else |
212 | ======= | ||
213 | |||
214 | #region Layer Map | ||
215 | |||
216 | float[,] layermap = new float[256 , 256]; | ||
217 | |||
218 | int xFactor = terrain.Width / 256; | ||
219 | int yFactor = terrain.Height / 256; | ||
220 | |||
221 | for (int y = 0; y < 256; y++) | ||
222 | >>>>>>> avn/ubitvar | ||
200 | { | 223 | { |
201 | if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256) | 224 | if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256) |
202 | { | 225 | { |
226 | <<<<<<< HEAD | ||
203 | detailTexture[i] = ResizeBitmap(detailTexture[i], 256, 256); | 227 | detailTexture[i] = ResizeBitmap(detailTexture[i], 256, 256); |
228 | ======= | ||
229 | float height = (float)terrain[x * xFactor, y * yFactor]; | ||
230 | |||
231 | float pctX = (float)x / 255f; | ||
232 | float pctY = (float)y / 255f; | ||
233 | |||
234 | // Use bilinear interpolation between the four corners of start height and | ||
235 | // height range to select the current values at this position | ||
236 | float startHeight = ImageUtils.Bilinear( | ||
237 | startHeights[0], | ||
238 | startHeights[2], | ||
239 | startHeights[1], | ||
240 | startHeights[3], | ||
241 | pctX, pctY); | ||
242 | startHeight = Utils.Clamp(startHeight, 0f, 255f); | ||
243 | |||
244 | float heightRange = ImageUtils.Bilinear( | ||
245 | heightRanges[0], | ||
246 | heightRanges[2], | ||
247 | heightRanges[1], | ||
248 | heightRanges[3], | ||
249 | pctX, pctY); | ||
250 | heightRange = Utils.Clamp(heightRange, 0f, 255f); | ||
251 | |||
252 | // Generate two frequencies of perlin noise based on our global position | ||
253 | // The magic values were taken from http://opensimulator.org/wiki/Terrain_Splatting | ||
254 | Vector3 vec = new Vector3 | ||
255 | ( | ||
256 | ((float)regionPosition.X + (x * xFactor)) * 0.20319f, | ||
257 | ((float)regionPosition.Y + (y * yFactor)) * 0.20319f, | ||
258 | height * 0.25f | ||
259 | ); | ||
260 | |||
261 | float lowFreq = Perlin.noise2(vec.X * 0.222222f, vec.Y * 0.222222f) * 6.5f; | ||
262 | float highFreq = Perlin.turbulence2(vec.X, vec.Y, 2f) * 2.25f; | ||
263 | float noise = (lowFreq + highFreq) * 2f; | ||
264 | |||
265 | // Combine the current height, generated noise, start height, and height range parameters, then scale all of it | ||
266 | float layer = ((height + noise - startHeight) / heightRange) * 4f; | ||
267 | if (Single.IsNaN(layer)) layer = 0f; | ||
268 | layermap[x,y] = Utils.Clamp(layer, 0f, 3f); | ||
269 | >>>>>>> avn/ubitvar | ||
204 | } | 270 | } |
205 | } | 271 | } |
206 | } | 272 | } |
@@ -220,6 +286,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
220 | { | 286 | { |
221 | for (int x = 0; x < 256; x++) | 287 | for (int x = 0; x < 256; x++) |
222 | { | 288 | { |
289 | <<<<<<< HEAD | ||
223 | float height = (float)terrain[x * xFactor, y * yFactor]; | 290 | float height = (float)terrain[x * xFactor, y * yFactor]; |
224 | 291 | ||
225 | float pctX = (float)x / 255f; | 292 | float pctX = (float)x / 255f; |
@@ -261,6 +328,58 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
261 | if (Single.IsNaN(layer)) | 328 | if (Single.IsNaN(layer)) |
262 | layer = 0f; | 329 | layer = 0f; |
263 | layermap[x, y] = Utils.Clamp(layer, 0f, 3f); | 330 | layermap[x, y] = Utils.Clamp(layer, 0f, 3f); |
331 | ======= | ||
332 | // Get handles to all of the texture data arrays | ||
333 | BitmapData[] datas = new BitmapData[] | ||
334 | { | ||
335 | detailTexture[0].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[0].PixelFormat), | ||
336 | detailTexture[1].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[1].PixelFormat), | ||
337 | detailTexture[2].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[2].PixelFormat), | ||
338 | detailTexture[3].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[3].PixelFormat) | ||
339 | }; | ||
340 | |||
341 | int[] comps = new int[] | ||
342 | { | ||
343 | (datas[0].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3, | ||
344 | (datas[1].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3, | ||
345 | (datas[2].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3, | ||
346 | (datas[3].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3 | ||
347 | }; | ||
348 | |||
349 | for (int y = 0; y < 256; y++) | ||
350 | { | ||
351 | for (int x = 0; x < 256; x++) | ||
352 | { | ||
353 | float layer = layermap[x, y]; | ||
354 | |||
355 | // Select two textures | ||
356 | int l0 = (int)Math.Floor(layer); | ||
357 | int l1 = Math.Min(l0 + 1, 3); | ||
358 | |||
359 | byte* ptrA = (byte*)datas[l0].Scan0 + y * datas[l0].Stride + x * comps[l0]; | ||
360 | byte* ptrB = (byte*)datas[l1].Scan0 + y * datas[l1].Stride + x * comps[l1]; | ||
361 | byte* ptrO = (byte*)outputData.Scan0 + y * outputData.Stride + x * 3; | ||
362 | |||
363 | float aB = *(ptrA + 0); | ||
364 | float aG = *(ptrA + 1); | ||
365 | float aR = *(ptrA + 2); | ||
366 | |||
367 | float bB = *(ptrB + 0); | ||
368 | float bG = *(ptrB + 1); | ||
369 | float bR = *(ptrB + 2); | ||
370 | |||
371 | float layerDiff = layer - l0; | ||
372 | |||
373 | // Interpolate between the two selected textures | ||
374 | *(ptrO + 0) = (byte)Math.Floor(aB + layerDiff * (bB - aB)); | ||
375 | *(ptrO + 1) = (byte)Math.Floor(aG + layerDiff * (bG - aG)); | ||
376 | *(ptrO + 2) = (byte)Math.Floor(aR + layerDiff * (bR - aR)); | ||
377 | } | ||
378 | } | ||
379 | |||
380 | for (int i = 0; i < 4; i++) | ||
381 | detailTexture[i].UnlockBits(datas[i]); | ||
382 | >>>>>>> avn/ubitvar | ||
264 | } | 383 | } |
265 | } | 384 | } |
266 | 385 | ||
@@ -352,7 +471,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
352 | b.Dispose(); | 471 | b.Dispose(); |
353 | return result; | 472 | return result; |
354 | } | 473 | } |
474 | <<<<<<< HEAD | ||
355 | 475 | ||
476 | ======= | ||
477 | >>>>>>> avn/ubitvar | ||
356 | public static Bitmap SplatSimple(float[] heightmap) | 478 | public static Bitmap SplatSimple(float[] heightmap) |
357 | { | 479 | { |
358 | const float BASE_HSV_H = 93f / 360f; | 480 | const float BASE_HSV_H = 93f / 360f; |
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index dd91951..d8420d9 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs | |||
@@ -80,6 +80,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
80 | 80 | ||
81 | private bool m_Enabled = false; | 81 | private bool m_Enabled = false; |
82 | 82 | ||
83 | private Bitmap lastImage = null; | ||
84 | private DateTime lastImageTime = DateTime.MinValue; | ||
85 | |||
83 | #region Region Module interface | 86 | #region Region Module interface |
84 | 87 | ||
85 | public void Initialise(IConfigSource source) | 88 | public void Initialise(IConfigSource source) |
@@ -118,14 +121,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
118 | 121 | ||
119 | List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); | 122 | List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); |
120 | if (renderers.Count > 0) | 123 | if (renderers.Count > 0) |
121 | { | 124 | m_log.Info("[MAPTILE]: Loaded prim mesher " + renderers[0]); |
122 | m_primMesher = RenderingLoader.LoadRenderer(renderers[0]); | ||
123 | m_log.DebugFormat("[WARP 3D IMAGE MODULE]: Loaded prim mesher {0}", m_primMesher); | ||
124 | } | ||
125 | else | 125 | else |
126 | { | 126 | m_log.Info("[MAPTILE]: No prim mesher loaded, prim rendering will be disabled"); |
127 | m_log.Debug("[WARP 3D IMAGE MODULE]: No prim mesher loaded, prim rendering will be disabled"); | ||
128 | } | ||
129 | 127 | ||
130 | m_scene.RegisterModuleInterface<IMapImageGenerator>(this); | 128 | m_scene.RegisterModuleInterface<IMapImageGenerator>(this); |
131 | } | 129 | } |
@@ -158,18 +156,50 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
158 | 156 | ||
159 | public Bitmap CreateMapTile() | 157 | public Bitmap CreateMapTile() |
160 | { | 158 | { |
159 | <<<<<<< HEAD | ||
161 | // Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f); | 160 | // Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f); |
162 | // Camera above the middle of the region | 161 | // Camera above the middle of the region |
163 | Vector3 camPos = new Vector3( | 162 | Vector3 camPos = new Vector3( |
164 | m_scene.RegionInfo.RegionSizeX/2 - 0.5f, | 163 | m_scene.RegionInfo.RegionSizeX/2 - 0.5f, |
165 | m_scene.RegionInfo.RegionSizeY/2 - 0.5f, | 164 | m_scene.RegionInfo.RegionSizeY/2 - 0.5f, |
165 | ======= | ||
166 | /* this must be on all map, not just its image | ||
167 | if ((DateTime.Now - lastImageTime).TotalSeconds < 3600) | ||
168 | { | ||
169 | return (Bitmap)lastImage.Clone(); | ||
170 | } | ||
171 | */ | ||
172 | |||
173 | List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); | ||
174 | if (renderers.Count > 0) | ||
175 | { | ||
176 | m_primMesher = RenderingLoader.LoadRenderer(renderers[0]); | ||
177 | } | ||
178 | |||
179 | Vector3 camPos = new Vector3( | ||
180 | m_scene.RegionInfo.RegionSizeX / 2 - 0.5f, | ||
181 | m_scene.RegionInfo.RegionSizeY / 2 - 0.5f, | ||
182 | >>>>>>> avn/ubitvar | ||
166 | 221.7025033688163f); | 183 | 221.7025033688163f); |
167 | // Viewport viewing down onto the region | 184 | // Viewport viewing down onto the region |
168 | Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, | 185 | Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, |
169 | (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY, | 186 | (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY, |
187 | <<<<<<< HEAD | ||
170 | (float)m_scene.RegionInfo.RegionSizeX, (float)m_scene.RegionInfo.RegionSizeY ); | 188 | (float)m_scene.RegionInfo.RegionSizeX, (float)m_scene.RegionInfo.RegionSizeY ); |
171 | // Fill the viewport and return the image | 189 | // Fill the viewport and return the image |
172 | return CreateMapTile(viewport, false); | 190 | return CreateMapTile(viewport, false); |
191 | ======= | ||
192 | (float)m_scene.RegionInfo.RegionSizeX, (float)m_scene.RegionInfo.RegionSizeY); | ||
193 | |||
194 | Bitmap tile = CreateMapTile(viewport, false); | ||
195 | m_primMesher = null; | ||
196 | return tile; | ||
197 | /* | ||
198 | lastImage = tile; | ||
199 | lastImageTime = DateTime.Now; | ||
200 | return (Bitmap)lastImage.Clone(); | ||
201 | */ | ||
202 | >>>>>>> avn/ubitvar | ||
173 | } | 203 | } |
174 | 204 | ||
175 | public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures) | 205 | public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures) |
@@ -285,9 +315,15 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
285 | float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; | 315 | float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; |
286 | 316 | ||
287 | renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f); | 317 | renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f); |
318 | <<<<<<< HEAD | ||
288 | renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX/2 - 0.5f, | 319 | renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX/2 - 0.5f, |
289 | waterHeight, | 320 | waterHeight, |
290 | m_scene.RegionInfo.RegionSizeY/2 - 0.5f ); | 321 | m_scene.RegionInfo.RegionSizeY/2 - 0.5f ); |
322 | ======= | ||
323 | renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX / 2 - 0.5f, | ||
324 | waterHeight, | ||
325 | m_scene.RegionInfo.RegionSizeY / 2 - 0.5f); | ||
326 | >>>>>>> avn/ubitvar | ||
291 | 327 | ||
292 | warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR)); | 328 | warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR)); |
293 | waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif | 329 | waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif |
@@ -316,7 +352,11 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
316 | warp_Vector pos = ConvertVector(x, y, (float)terrain[(int)x, (int)y]); | 352 | warp_Vector pos = ConvertVector(x, y, (float)terrain[(int)x, (int)y]); |
317 | obj.addVertex(new warp_Vertex(pos, | 353 | obj.addVertex(new warp_Vertex(pos, |
318 | x / (float)m_scene.RegionInfo.RegionSizeX, | 354 | x / (float)m_scene.RegionInfo.RegionSizeX, |
355 | <<<<<<< HEAD | ||
319 | (((float)m_scene.RegionInfo.RegionSizeY) - y) / m_scene.RegionInfo.RegionSizeY) ); | 356 | (((float)m_scene.RegionInfo.RegionSizeY) - y) / m_scene.RegionInfo.RegionSizeY) ); |
357 | ======= | ||
358 | (((float)m_scene.RegionInfo.RegionSizeY) - y) / m_scene.RegionInfo.RegionSizeY)); | ||
359 | >>>>>>> avn/ubitvar | ||
320 | } | 360 | } |
321 | } | 361 | } |
322 | 362 | ||
@@ -384,7 +424,12 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
384 | warp_Texture texture; | 424 | warp_Texture texture; |
385 | using ( | 425 | using ( |
386 | Bitmap image | 426 | Bitmap image |
427 | <<<<<<< HEAD | ||
387 | = TerrainSplat.Splat(terrain, textureIDs, startHeights, heightRanges, | 428 | = TerrainSplat.Splat(terrain, textureIDs, startHeights, heightRanges, |
429 | ======= | ||
430 | = TerrainSplat.Splat( | ||
431 | terrain, textureIDs, startHeights, heightRanges, | ||
432 | >>>>>>> avn/ubitvar | ||
388 | new Vector3d(globalX, globalY, 0.0), m_scene.AssetService, textureTerrain)) | 433 | new Vector3d(globalX, globalY, 0.0), m_scene.AssetService, textureTerrain)) |
389 | { | 434 | { |
390 | texture = new warp_Texture(image); | 435 | texture = new warp_Texture(image); |
@@ -660,6 +705,11 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
660 | #endregion Rendering Methods | 705 | #endregion Rendering Methods |
661 | 706 | ||
662 | #region Static Helpers | 707 | #region Static Helpers |
708 | // Note: axis change. | ||
709 | private static warp_Vector ConvertVector(float x, float y, float z) | ||
710 | { | ||
711 | return new warp_Vector(x, z, y); | ||
712 | } | ||
663 | 713 | ||
664 | // Note: axis change. | 714 | // Note: axis change. |
665 | private static warp_Vector ConvertVector(float x, float y, float z) | 715 | private static warp_Vector ConvertVector(float x, float y, float z) |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index d862f18..553d057 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -141,20 +141,98 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
141 | 141 | ||
142 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) | 142 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) |
143 | { | 143 | { |
144 | <<<<<<< HEAD | ||
144 | List<MapBlockData> blocks = new List<MapBlockData>(); | 145 | List<MapBlockData> blocks = new List<MapBlockData>(); |
145 | if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) | 146 | if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) |
147 | ======= | ||
148 | Util.FireAndForget(x => | ||
149 | >>>>>>> avn/ubitvar | ||
146 | { | 150 | { |
151 | List<MapBlockData> blocks = new List<MapBlockData>(); | ||
152 | if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) | ||
153 | { | ||
154 | // final block, closing the search result | ||
155 | AddFinalBlock(blocks); | ||
156 | |||
157 | // flags are agent flags sent from the viewer. | ||
158 | // they have different values depending on different viewers, apparently | ||
159 | remoteClient.SendMapBlock(blocks, flags); | ||
160 | remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); | ||
161 | return; | ||
162 | } | ||
163 | |||
164 | //m_log.DebugFormat("MAP NAME=({0})", mapName); | ||
165 | |||
166 | // Hack to get around the fact that ll V3 now drops the port from the | ||
167 | // map name. See https://jira.secondlife.com/browse/VWR-28570 | ||
168 | // | ||
169 | // Caller, use this magic form instead: | ||
170 | // secondlife://http|!!mygrid.com|8002|Region+Name/128/128 | ||
171 | // or url encode if possible. | ||
172 | // the hacks we do with this viewer... | ||
173 | // | ||
174 | string mapNameOrig = mapName; | ||
175 | if (mapName.Contains("|")) | ||
176 | mapName = mapName.Replace('|', ':'); | ||
177 | if (mapName.Contains("+")) | ||
178 | mapName = mapName.Replace('+', ' '); | ||
179 | if (mapName.Contains("!")) | ||
180 | mapName = mapName.Replace('!', '/'); | ||
181 | |||
182 | // try to fetch from GridServer | ||
183 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); | ||
184 | // if (regionInfos.Count == 0) | ||
185 | // remoteClient.SendAlertMessage("Hyperlink could not be established."); | ||
186 | |||
187 | //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); | ||
188 | |||
189 | MapBlockData data; | ||
190 | if (regionInfos.Count > 0) | ||
191 | { | ||
192 | foreach (GridRegion info in regionInfos) | ||
193 | { | ||
194 | data = new MapBlockData(); | ||
195 | data.Agents = 0; | ||
196 | data.Access = info.Access; | ||
197 | if (flags == 2) // V2 sends this | ||
198 | { | ||
199 | List<MapBlockData> datas = WorldMap.Map2BlockFromGridRegion(info, flags); | ||
200 | // ugh! V2-3 is very sensitive about the result being | ||
201 | // exactly the same as the requested name | ||
202 | |||
203 | if (regionInfos.Count == 1 && (mapName != mapNameOrig)) | ||
204 | datas.ForEach(d => d.Name = mapNameOrig); | ||
205 | |||
206 | blocks.AddRange(datas); | ||
207 | } | ||
208 | else | ||
209 | { | ||
210 | MapBlockData block = new MapBlockData(); | ||
211 | WorldMap.MapBlockFromGridRegion(block,info, flags); | ||
212 | blocks.Add(block); | ||
213 | } | ||
214 | // ugh! V2-3 is very sensitive about the result being | ||
215 | // exactly the same as the requested name | ||
216 | if (regionInfos.Count == 1 && mapNameOrig.Contains("|") || mapNameOrig.Contains("+")) | ||
217 | data.Name = mapNameOrig; | ||
218 | else | ||
219 | data.Name = info.RegionName; | ||
220 | data.RegionFlags = 0; // TODO not used? | ||
221 | data.WaterHeight = 0; // not used | ||
222 | data.X = (ushort)(info.RegionLocX / Constants.RegionSize); | ||
223 | data.Y = (ushort)(info.RegionLocY / Constants.RegionSize); | ||
224 | blocks.Add(data); | ||
225 | } | ||
226 | } | ||
227 | |||
147 | // final block, closing the search result | 228 | // final block, closing the search result |
148 | AddFinalBlock(blocks); | 229 | AddFinalBlock(blocks); |
149 | 230 | ||
150 | // flags are agent flags sent from the viewer. | 231 | // flags are agent flags sent from the viewer. |
151 | // they have different values depending on different viewers, apparently | 232 | // they have different values depending on different viewers, apparently |
152 | remoteClient.SendMapBlock(blocks, flags); | 233 | remoteClient.SendMapBlock(blocks, flags); |
153 | remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); | ||
154 | return; | ||
155 | } | ||
156 | |||
157 | 234 | ||
235 | <<<<<<< HEAD | ||
158 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); | 236 | List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); |
159 | 237 | ||
160 | string mapNameOrig = mapName; | 238 | string mapNameOrig = mapName; |
@@ -221,6 +299,19 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
221 | //else if (regionInfos.Count == 1) | 299 | //else if (regionInfos.Count == 1) |
222 | // remoteClient.SendAlertMessage("Region found!"); | 300 | // remoteClient.SendAlertMessage("Region found!"); |
223 | } | 301 | } |
302 | ======= | ||
303 | // send extra user messages for V3 | ||
304 | // because the UI is very confusing | ||
305 | // while we don't fix the hard-coded urls | ||
306 | if (flags == 2) | ||
307 | { | ||
308 | if (regionInfos.Count == 0) | ||
309 | remoteClient.SendAgentAlertMessage("No regions found with that name.", true); | ||
310 | // else if (regionInfos.Count == 1) | ||
311 | // remoteClient.SendAgentAlertMessage("Region found!", false); | ||
312 | } | ||
313 | }); | ||
314 | >>>>>>> avn/ubitvar | ||
224 | } | 315 | } |
225 | 316 | ||
226 | private void AddFinalBlock(List<MapBlockData> blocks) | 317 | private void AddFinalBlock(List<MapBlockData> blocks) |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index db1187e..2fbd017 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -68,10 +68,21 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
68 | private static readonly UUID STOP_UUID = UUID.Random(); | 68 | private static readonly UUID STOP_UUID = UUID.Random(); |
69 | private static readonly string m_mapLayerPath = "0001/"; | 69 | private static readonly string m_mapLayerPath = "0001/"; |
70 | 70 | ||
71 | <<<<<<< HEAD | ||
71 | private IMapImageGenerator m_mapImageGenerator; | 72 | private IMapImageGenerator m_mapImageGenerator; |
72 | private IMapImageUploadModule m_mapImageServiceModule; | 73 | private IMapImageUploadModule m_mapImageServiceModule; |
73 | 74 | ||
74 | private OpenSim.Framework.BlockingQueue<MapRequestState> requests = new OpenSim.Framework.BlockingQueue<MapRequestState>(); | 75 | private OpenSim.Framework.BlockingQueue<MapRequestState> requests = new OpenSim.Framework.BlockingQueue<MapRequestState>(); |
76 | ======= | ||
77 | private ManualResetEvent queueEvent = new ManualResetEvent(false); | ||
78 | private Queue<MapRequestState> requests = new Queue<MapRequestState>(); | ||
79 | |||
80 | private ManualResetEvent m_mapBlockRequestEvent = new ManualResetEvent(false); | ||
81 | private Dictionary<UUID, Queue<MapBlockRequestData>> m_mapBlockRequests = new Dictionary<UUID, Queue<MapBlockRequestData>>(); | ||
82 | |||
83 | private IMapImageGenerator m_mapImageGenerator; | ||
84 | private IMapImageUploadModule m_mapImageServiceModule; | ||
85 | >>>>>>> avn/ubitvar | ||
75 | 86 | ||
76 | protected Scene m_scene; | 87 | protected Scene m_scene; |
77 | private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>(); | 88 | private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>(); |
@@ -79,15 +90,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
79 | private int blacklistTimeout = 10*60*1000; // 10 minutes | 90 | private int blacklistTimeout = 10*60*1000; // 10 minutes |
80 | private byte[] myMapImageJPEG; | 91 | private byte[] myMapImageJPEG; |
81 | protected volatile bool m_Enabled = false; | 92 | protected volatile bool m_Enabled = false; |
82 | private Dictionary<UUID, MapRequestState> m_openRequests = new Dictionary<UUID, MapRequestState>(); | ||
83 | private Dictionary<string, int> m_blacklistedurls = new Dictionary<string, int>(); | 93 | private Dictionary<string, int> m_blacklistedurls = new Dictionary<string, int>(); |
84 | private Dictionary<ulong, int> m_blacklistedregions = new Dictionary<ulong, int>(); | 94 | private Dictionary<ulong, int> m_blacklistedregions = new Dictionary<ulong, int>(); |
85 | private Dictionary<ulong, string> m_cachedRegionMapItemsAddress = new Dictionary<ulong, string>(); | 95 | private Dictionary<ulong, string> m_cachedRegionMapItemsAddress = new Dictionary<ulong, string>(); |
86 | private List<UUID> m_rootAgents = new List<UUID>(); | 96 | private List<UUID> m_rootAgents = new List<UUID>(); |
87 | private volatile bool threadrunning = false; | 97 | private volatile bool threadrunning = false; |
88 | 98 | ||
89 | private IServiceThrottleModule m_ServiceThrottle; | ||
90 | |||
91 | //private int CacheRegionsDistance = 256; | 99 | //private int CacheRegionsDistance = 256; |
92 | 100 | ||
93 | #region INonSharedRegionModule Members | 101 | #region INonSharedRegionModule Members |
@@ -98,7 +106,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
98 | if (Util.GetConfigVarFromSections<string>( | 106 | if (Util.GetConfigVarFromSections<string>( |
99 | config, "WorldMapModule", configSections, "WorldMap") == "WorldMap") | 107 | config, "WorldMapModule", configSections, "WorldMap") == "WorldMap") |
100 | m_Enabled = true; | 108 | m_Enabled = true; |
101 | 109 | ||
102 | blacklistTimeout | 110 | blacklistTimeout |
103 | = Util.GetConfigVarFromSections<int>(config, "BlacklistTimeout", configSections, 10 * 60) * 1000; | 111 | = Util.GetConfigVarFromSections<int>(config, "BlacklistTimeout", configSections, 10 * 60) * 1000; |
104 | } | 112 | } |
@@ -146,7 +154,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
146 | if (!m_Enabled) | 154 | if (!m_Enabled) |
147 | return; | 155 | return; |
148 | 156 | ||
157 | <<<<<<< HEAD | ||
149 | m_ServiceThrottle = scene.RequestModuleInterface<IServiceThrottleModule>(); | 158 | m_ServiceThrottle = scene.RequestModuleInterface<IServiceThrottleModule>(); |
159 | ======= | ||
160 | m_mapImageGenerator = m_scene.RequestModuleInterface<IMapImageGenerator>(); | ||
161 | m_mapImageServiceModule = m_scene.RequestModuleInterface<IMapImageUploadModule>(); | ||
162 | } | ||
163 | >>>>>>> avn/ubitvar | ||
150 | 164 | ||
151 | m_mapImageGenerator = m_scene.RequestModuleInterface<IMapImageGenerator>(); | 165 | m_mapImageGenerator = m_scene.RequestModuleInterface<IMapImageGenerator>(); |
152 | m_mapImageServiceModule = m_scene.RequestModuleInterface<IMapImageUploadModule>(); | 166 | m_mapImageServiceModule = m_scene.RequestModuleInterface<IMapImageUploadModule>(); |
@@ -197,13 +211,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
197 | m_scene.EventManager.OnMakeRootAgent += MakeRootAgent; | 211 | m_scene.EventManager.OnMakeRootAgent += MakeRootAgent; |
198 | m_scene.EventManager.OnRegionUp += OnRegionUp; | 212 | m_scene.EventManager.OnRegionUp += OnRegionUp; |
199 | 213 | ||
200 | // StartThread(new object()); | 214 | StartThread(new object()); |
201 | } | 215 | } |
202 | 216 | ||
203 | // this has to be called with a lock on m_scene | 217 | // this has to be called with a lock on m_scene |
204 | protected virtual void RemoveHandlers() | 218 | protected virtual void RemoveHandlers() |
205 | { | 219 | { |
206 | // StopThread(); | 220 | StopThread(); |
207 | 221 | ||
208 | m_scene.EventManager.OnRegionUp -= OnRegionUp; | 222 | m_scene.EventManager.OnRegionUp -= OnRegionUp; |
209 | m_scene.EventManager.OnMakeRootAgent -= MakeRootAgent; | 223 | m_scene.EventManager.OnMakeRootAgent -= MakeRootAgent; |
@@ -261,6 +275,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
261 | // 6/8/2011 -- I'm adding an explicit 2048 check, so that we never forget that there is | 275 | // 6/8/2011 -- I'm adding an explicit 2048 check, so that we never forget that there is |
262 | // a hack here, and so that regions below 4096 don't get spammed with unnecessary map blocks. | 276 | // a hack here, and so that regions below 4096 don't get spammed with unnecessary map blocks. |
263 | 277 | ||
278 | <<<<<<< HEAD | ||
264 | if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048) | 279 | if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048) |
265 | { | 280 | { |
266 | ScenePresence avatarPresence = null; | 281 | ScenePresence avatarPresence = null; |
@@ -309,6 +324,56 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
309 | } | 324 | } |
310 | } | 325 | } |
311 | } | 326 | } |
327 | ======= | ||
328 | //if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048) | ||
329 | //{ | ||
330 | // ScenePresence avatarPresence = null; | ||
331 | |||
332 | // m_scene.TryGetScenePresence(agentID, out avatarPresence); | ||
333 | |||
334 | // if (avatarPresence != null) | ||
335 | // { | ||
336 | // bool lookup = false; | ||
337 | |||
338 | // lock (cachedMapBlocks) | ||
339 | // { | ||
340 | // if (cachedMapBlocks.Count > 0 && ((cachedTime + 1800) > Util.UnixTimeSinceEpoch())) | ||
341 | // { | ||
342 | // List<MapBlockData> mapBlocks; | ||
343 | |||
344 | // mapBlocks = cachedMapBlocks; | ||
345 | // avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0); | ||
346 | // } | ||
347 | // else | ||
348 | // { | ||
349 | // lookup = true; | ||
350 | // } | ||
351 | // } | ||
352 | // if (lookup) | ||
353 | // { | ||
354 | // List<MapBlockData> mapBlocks = new List<MapBlockData>(); ; | ||
355 | |||
356 | // List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, | ||
357 | // (int)(m_scene.RegionInfo.RegionLocX - 8) * (int)Constants.RegionSize, | ||
358 | // (int)(m_scene.RegionInfo.RegionLocX + 8) * (int)Constants.RegionSize, | ||
359 | // (int)(m_scene.RegionInfo.RegionLocY - 8) * (int)Constants.RegionSize, | ||
360 | // (int)(m_scene.RegionInfo.RegionLocY + 8) * (int)Constants.RegionSize); | ||
361 | // foreach (GridRegion r in regions) | ||
362 | // { | ||
363 | // MapBlockData block = new MapBlockData(); | ||
364 | // MapBlockFromGridRegion(block, r, 0); | ||
365 | // mapBlocks.Add(block); | ||
366 | // } | ||
367 | // avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0); | ||
368 | |||
369 | // lock (cachedMapBlocks) | ||
370 | // cachedMapBlocks = mapBlocks; | ||
371 | |||
372 | // cachedTime = Util.UnixTimeSinceEpoch(); | ||
373 | // } | ||
374 | // } | ||
375 | //} | ||
376 | >>>>>>> avn/ubitvar | ||
312 | 377 | ||
313 | LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); | 378 | LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); |
314 | mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse()); | 379 | mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse()); |
@@ -335,7 +400,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
335 | protected static OSDMapLayer GetOSDMapLayerResponse() | 400 | protected static OSDMapLayer GetOSDMapLayerResponse() |
336 | { | 401 | { |
337 | OSDMapLayer mapLayer = new OSDMapLayer(); | 402 | OSDMapLayer mapLayer = new OSDMapLayer(); |
403 | // mapLayer.Right = 2048; | ||
338 | mapLayer.Right = 5000; | 404 | mapLayer.Right = 5000; |
405 | // mapLayer.Top = 2048; | ||
339 | mapLayer.Top = 5000; | 406 | mapLayer.Top = 5000; |
340 | mapLayer.ImageID = new UUID("00000000-0000-1111-9999-000000000006"); | 407 | mapLayer.ImageID = new UUID("00000000-0000-1111-9999-000000000006"); |
341 | 408 | ||
@@ -365,6 +432,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
365 | { | 432 | { |
366 | m_rootAgents.Remove(AgentId); | 433 | m_rootAgents.Remove(AgentId); |
367 | } | 434 | } |
435 | lock (m_mapBlockRequestEvent) | ||
436 | { | ||
437 | if (m_mapBlockRequests.ContainsKey(AgentId)) | ||
438 | m_mapBlockRequests.Remove(AgentId); | ||
439 | } | ||
368 | } | 440 | } |
369 | #endregion | 441 | #endregion |
370 | 442 | ||
@@ -387,6 +459,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
387 | ThreadPriority.BelowNormal, | 459 | ThreadPriority.BelowNormal, |
388 | true, | 460 | true, |
389 | true); | 461 | true); |
462 | Watchdog.StartThread( | ||
463 | MapBlockSendThread, | ||
464 | string.Format("MapBlockSendThread ({0})", m_scene.RegionInfo.RegionName), | ||
465 | ThreadPriority.BelowNormal, | ||
466 | true, | ||
467 | true); | ||
390 | } | 468 | } |
391 | 469 | ||
392 | /// <summary> | 470 | /// <summary> |
@@ -402,7 +480,27 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
402 | st.itemtype=0; | 480 | st.itemtype=0; |
403 | st.regionhandle=0; | 481 | st.regionhandle=0; |
404 | 482 | ||
405 | requests.Enqueue(st); | 483 | lock (requests) |
484 | { | ||
485 | queueEvent.Set(); | ||
486 | requests.Enqueue(st); | ||
487 | } | ||
488 | |||
489 | MapBlockRequestData req = new MapBlockRequestData(); | ||
490 | |||
491 | req.client = null; | ||
492 | req.minX = 0; | ||
493 | req.maxX = 0; | ||
494 | req.minY = 0; | ||
495 | req.maxY = 0; | ||
496 | req.flags = 0; | ||
497 | |||
498 | lock (m_mapBlockRequestEvent) | ||
499 | { | ||
500 | m_mapBlockRequests[UUID.Zero] = new Queue<MapBlockRequestData>(); | ||
501 | m_mapBlockRequests[UUID.Zero].Enqueue(req); | ||
502 | m_mapBlockRequestEvent.Set(); | ||
503 | } | ||
406 | } | 504 | } |
407 | 505 | ||
408 | public virtual void HandleMapItemRequest(IClientAPI remoteClient, uint flags, | 506 | public virtual void HandleMapItemRequest(IClientAPI remoteClient, uint flags, |
@@ -418,7 +516,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
418 | uint xstart = 0; | 516 | uint xstart = 0; |
419 | uint ystart = 0; | 517 | uint ystart = 0; |
420 | Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); | 518 | Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); |
519 | <<<<<<< HEAD | ||
421 | if (itemtype == (int)GridItemType.AgentLocations) | 520 | if (itemtype == (int)GridItemType.AgentLocations) |
521 | ======= | ||
522 | |||
523 | if (itemtype == 6) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots) | ||
524 | >>>>>>> avn/ubitvar | ||
422 | { | 525 | { |
423 | if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) | 526 | if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) |
424 | { | 527 | { |
@@ -428,12 +531,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
428 | mapItemReply mapitem = new mapItemReply(); | 531 | mapItemReply mapitem = new mapItemReply(); |
429 | if (m_scene.GetRootAgentCount() <= 1) | 532 | if (m_scene.GetRootAgentCount() <= 1) |
430 | { | 533 | { |
534 | <<<<<<< HEAD | ||
431 | mapitem = new mapItemReply( | 535 | mapitem = new mapItemReply( |
432 | xstart + 1, | 536 | xstart + 1, |
433 | ystart + 1, | 537 | ystart + 1, |
434 | UUID.Zero, | 538 | UUID.Zero, |
435 | Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()), | 539 | Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()), |
436 | 0, 0); | 540 | 0, 0); |
541 | ======= | ||
542 | mapitem = new mapItemReply(); | ||
543 | mapitem.x = xstart + 1; | ||
544 | mapitem.y = ystart + 1; | ||
545 | mapitem.id = UUID.Zero; | ||
546 | mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); | ||
547 | mapitem.Extra = 0; | ||
548 | mapitem.Extra2 = 0; | ||
549 | >>>>>>> avn/ubitvar | ||
437 | mapitems.Add(mapitem); | 550 | mapitems.Add(mapitem); |
438 | } | 551 | } |
439 | else | 552 | else |
@@ -443,12 +556,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
443 | // Don't send a green dot for yourself | 556 | // Don't send a green dot for yourself |
444 | if (sp.UUID != remoteClient.AgentId) | 557 | if (sp.UUID != remoteClient.AgentId) |
445 | { | 558 | { |
559 | <<<<<<< HEAD | ||
446 | mapitem = new mapItemReply( | 560 | mapitem = new mapItemReply( |
447 | xstart + (uint)sp.AbsolutePosition.X, | 561 | xstart + (uint)sp.AbsolutePosition.X, |
448 | ystart + (uint)sp.AbsolutePosition.Y, | 562 | ystart + (uint)sp.AbsolutePosition.Y, |
449 | UUID.Zero, | 563 | UUID.Zero, |
450 | Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()), | 564 | Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()), |
451 | 1, 0); | 565 | 1, 0); |
566 | ======= | ||
567 | mapitem = new mapItemReply(); | ||
568 | mapitem.x = xstart + (uint)sp.AbsolutePosition.X; | ||
569 | mapitem.y = ystart + (uint)sp.AbsolutePosition.Y; | ||
570 | mapitem.id = UUID.Zero; | ||
571 | mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()); | ||
572 | mapitem.Extra = 1; | ||
573 | mapitem.Extra2 = 0; | ||
574 | >>>>>>> avn/ubitvar | ||
452 | mapitems.Add(mapitem); | 575 | mapitems.Add(mapitem); |
453 | } | 576 | } |
454 | }); | 577 | }); |
@@ -493,6 +616,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
493 | float x = (min.X+max.X)/2; | 616 | float x = (min.X+max.X)/2; |
494 | float y = (min.Y+max.Y)/2; | 617 | float y = (min.Y+max.Y)/2; |
495 | 618 | ||
619 | <<<<<<< HEAD | ||
496 | mapitem = new mapItemReply( | 620 | mapitem = new mapItemReply( |
497 | xstart + (uint)x, | 621 | xstart + (uint)x, |
498 | ystart + (uint)y, | 622 | ystart + (uint)y, |
@@ -501,6 +625,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
501 | parcel.Area, | 625 | parcel.Area, |
502 | parcel.SalePrice | 626 | parcel.SalePrice |
503 | ); | 627 | ); |
628 | ======= | ||
629 | mapitem = new mapItemReply(); | ||
630 | mapitem.x = xstart + (uint)x; | ||
631 | mapitem.y = ystart +(uint)y; | ||
632 | // mapitem.z = (uint)m_scene.GetGroundHeight(x,y); | ||
633 | mapitem.id = parcel.GlobalID; | ||
634 | mapitem.name = parcel.Name; | ||
635 | mapitem.Extra = parcel.Area; | ||
636 | mapitem.Extra2 = parcel.SalePrice; | ||
637 | >>>>>>> avn/ubitvar | ||
504 | mapitems.Add(mapitem); | 638 | mapitems.Add(mapitem); |
505 | } | 639 | } |
506 | } | 640 | } |
@@ -525,6 +659,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
525 | SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); | 659 | SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); |
526 | if (sog != null) | 660 | if (sog != null) |
527 | { | 661 | { |
662 | <<<<<<< HEAD | ||
528 | mapitem = new mapItemReply( | 663 | mapitem = new mapItemReply( |
529 | xstart + (uint)sog.AbsolutePosition.X, | 664 | xstart + (uint)sog.AbsolutePosition.X, |
530 | ystart + (uint)sog.AbsolutePosition.Y, | 665 | ystart + (uint)sog.AbsolutePosition.Y, |
@@ -533,6 +668,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
533 | 0, // color (not used) | 668 | 0, // color (not used) |
534 | 0 // 0 = telehub / 1 = infohub | 669 | 0 // 0 = telehub / 1 = infohub |
535 | ); | 670 | ); |
671 | ======= | ||
672 | mapitem = new mapItemReply(); | ||
673 | mapitem.x = xstart + (uint)sog.AbsolutePosition.X; | ||
674 | mapitem.y = ystart + (uint)sog.AbsolutePosition.Y; | ||
675 | mapitem.id = UUID.Zero; | ||
676 | mapitem.name = sog.Name; | ||
677 | mapitem.Extra = 0; // color (not used) | ||
678 | mapitem.Extra2 = 0; // 0 = telehub / 1 = infohub | ||
679 | >>>>>>> avn/ubitvar | ||
536 | mapitems.Add(mapitem); | 680 | mapitems.Add(mapitem); |
537 | 681 | ||
538 | remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); | 682 | remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); |
@@ -552,12 +696,26 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
552 | /// </summary> | 696 | /// </summary> |
553 | public void process() | 697 | public void process() |
554 | { | 698 | { |
555 | //const int MAX_ASYNC_REQUESTS = 20; | 699 | const int MAX_ASYNC_REQUESTS = 20; |
556 | try | 700 | try |
557 | { | 701 | { |
558 | while (true) | 702 | while (true) |
559 | { | 703 | { |
560 | MapRequestState st = requests.Dequeue(1000); | 704 | MapRequestState st = new MapRequestState(); |
705 | bool valid = false; | ||
706 | queueEvent.WaitOne(); | ||
707 | lock (requests) | ||
708 | { | ||
709 | if (requests.Count > 0) | ||
710 | { | ||
711 | st = requests.Dequeue(); | ||
712 | valid = true; | ||
713 | } | ||
714 | if (requests.Count == 0) | ||
715 | queueEvent.Reset(); | ||
716 | } | ||
717 | if (!valid) | ||
718 | continue; | ||
561 | 719 | ||
562 | // end gracefully | 720 | // end gracefully |
563 | if (st.agentID == STOP_UUID) | 721 | if (st.agentID == STOP_UUID) |
@@ -575,13 +733,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
575 | if (dorequest && !m_blacklistedregions.ContainsKey(st.regionhandle)) | 733 | if (dorequest && !m_blacklistedregions.ContainsKey(st.regionhandle)) |
576 | { | 734 | { |
577 | while (nAsyncRequests >= MAX_ASYNC_REQUESTS) // hit the break | 735 | while (nAsyncRequests >= MAX_ASYNC_REQUESTS) // hit the break |
578 | Thread.Sleep(80); | 736 | Thread.Sleep(100); |
579 | 737 | ||
580 | RequestMapItemsDelegate d = RequestMapItemsAsync; | ||
581 | d.BeginInvoke(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle, RequestMapItemsCompleted, null); | ||
582 | //OSDMap response = RequestMapItemsAsync(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); | ||
583 | //RequestMapItemsCompleted(response); | ||
584 | Interlocked.Increment(ref nAsyncRequests); | 738 | Interlocked.Increment(ref nAsyncRequests); |
739 | Util.FireAndForget(x => | ||
740 | { | ||
741 | RequestMapItemsAsync(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); | ||
742 | }); | ||
585 | } | 743 | } |
586 | } | 744 | } |
587 | 745 | ||
@@ -597,17 +755,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
597 | Watchdog.RemoveThread(); | 755 | Watchdog.RemoveThread(); |
598 | } | 756 | } |
599 | 757 | ||
600 | const int MAX_ASYNC_REQUESTS = 20; | ||
601 | |||
602 | /// <summary> | 758 | /// <summary> |
603 | /// Enqueues the map item request into the services throttle processing thread | 759 | /// Enqueues the map item request into the processing thread |
604 | /// </summary> | 760 | /// </summary> |
605 | /// <param name="state"></param> | 761 | /// <param name="state"></param> |
606 | public void EnqueueMapItemRequest(MapRequestState st) | 762 | public void EnqueueMapItemRequest(MapRequestState state) |
607 | { | 763 | { |
608 | 764 | lock (requests) | |
609 | m_ServiceThrottle.Enqueue("map-item", st.regionhandle.ToString() + st.agentID.ToString(), delegate | ||
610 | { | 765 | { |
766 | <<<<<<< HEAD | ||
611 | if (st.agentID != UUID.Zero) | 767 | if (st.agentID != UUID.Zero) |
612 | { | 768 | { |
613 | bool dorequest = true; | 769 | bool dorequest = true; |
@@ -723,6 +879,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
723 | } | 879 | } |
724 | } | 880 | } |
725 | } | 881 | } |
882 | ======= | ||
883 | queueEvent.Set(); | ||
884 | requests.Enqueue(state); | ||
885 | >>>>>>> avn/ubitvar | ||
726 | } | 886 | } |
727 | } | 887 | } |
728 | 888 | ||
@@ -749,8 +909,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
749 | EnqueueMapItemRequest(st); | 909 | EnqueueMapItemRequest(st); |
750 | } | 910 | } |
751 | 911 | ||
752 | private delegate OSDMap RequestMapItemsDelegate(UUID id, uint flags, | ||
753 | uint EstateID, bool godlike, uint itemtype, ulong regionhandle); | ||
754 | /// <summary> | 912 | /// <summary> |
755 | /// Does the actual remote mapitem request | 913 | /// Does the actual remote mapitem request |
756 | /// This should be called from an asynchronous thread | 914 | /// This should be called from an asynchronous thread |
@@ -765,7 +923,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
765 | /// <param name="itemtype">passed in from packet</param> | 923 | /// <param name="itemtype">passed in from packet</param> |
766 | /// <param name="regionhandle">Region we're looking up</param> | 924 | /// <param name="regionhandle">Region we're looking up</param> |
767 | /// <returns></returns> | 925 | /// <returns></returns> |
768 | private OSDMap RequestMapItemsAsync(UUID id, uint flags, | 926 | private void RequestMapItemsAsync(UUID id, uint flags, |
769 | uint EstateID, bool godlike, uint itemtype, ulong regionhandle) | 927 | uint EstateID, bool godlike, uint itemtype, ulong regionhandle) |
770 | { | 928 | { |
771 | // m_log.DebugFormat("[WORLDMAP]: RequestMapItemsAsync; region handle: {0} {1}", regionhandle, itemtype); | 929 | // m_log.DebugFormat("[WORLDMAP]: RequestMapItemsAsync; region handle: {0} {1}", regionhandle, itemtype); |
@@ -788,7 +946,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
788 | } | 946 | } |
789 | 947 | ||
790 | if (blacklisted) | 948 | if (blacklisted) |
791 | return new OSDMap(); | 949 | { |
950 | Interlocked.Decrement(ref nAsyncRequests); | ||
951 | return; | ||
952 | } | ||
792 | 953 | ||
793 | UUID requestID = UUID.Random(); | 954 | UUID requestID = UUID.Random(); |
794 | lock (m_cachedRegionMapItemsAddress) | 955 | lock (m_cachedRegionMapItemsAddress) |
@@ -796,6 +957,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
796 | if (m_cachedRegionMapItemsAddress.ContainsKey(regionhandle)) | 957 | if (m_cachedRegionMapItemsAddress.ContainsKey(regionhandle)) |
797 | httpserver = m_cachedRegionMapItemsAddress[regionhandle]; | 958 | httpserver = m_cachedRegionMapItemsAddress[regionhandle]; |
798 | } | 959 | } |
960 | |||
799 | if (httpserver.Length == 0) | 961 | if (httpserver.Length == 0) |
800 | { | 962 | { |
801 | uint x = 0, y = 0; | 963 | uint x = 0, y = 0; |
@@ -840,18 +1002,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
840 | 1002 | ||
841 | // Can't find the http server | 1003 | // Can't find the http server |
842 | if (httpserver.Length == 0 || blacklisted) | 1004 | if (httpserver.Length == 0 || blacklisted) |
843 | return new OSDMap(); | 1005 | { |
844 | 1006 | Interlocked.Decrement(ref nAsyncRequests); | |
845 | MapRequestState mrs = new MapRequestState(); | 1007 | return; |
846 | mrs.agentID = id; | 1008 | } |
847 | mrs.EstateID = EstateID; | ||
848 | mrs.flags = flags; | ||
849 | mrs.godlike = godlike; | ||
850 | mrs.itemtype=itemtype; | ||
851 | mrs.regionhandle = regionhandle; | ||
852 | |||
853 | lock (m_openRequests) | ||
854 | m_openRequests.Add(requestID, mrs); | ||
855 | 1009 | ||
856 | WebRequest mapitemsrequest = null; | 1010 | WebRequest mapitemsrequest = null; |
857 | try | 1011 | try |
@@ -861,7 +1015,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
861 | catch (Exception e) | 1015 | catch (Exception e) |
862 | { | 1016 | { |
863 | m_log.DebugFormat("[WORLD MAP]: Access to {0} failed with {1}", httpserver, e); | 1017 | m_log.DebugFormat("[WORLD MAP]: Access to {0} failed with {1}", httpserver, e); |
864 | return new OSDMap(); | 1018 | Interlocked.Decrement(ref nAsyncRequests); |
1019 | return; | ||
865 | } | 1020 | } |
866 | 1021 | ||
867 | mapitemsrequest.Method = "POST"; | 1022 | mapitemsrequest.Method = "POST"; |
@@ -895,13 +1050,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
895 | 1050 | ||
896 | m_log.WarnFormat("[WORLD MAP]: Blacklisted {0}", httpserver); | 1051 | m_log.WarnFormat("[WORLD MAP]: Blacklisted {0}", httpserver); |
897 | 1052 | ||
898 | return responseMap; | 1053 | Interlocked.Decrement(ref nAsyncRequests); |
1054 | return; | ||
899 | } | 1055 | } |
900 | catch | 1056 | catch |
901 | { | 1057 | { |
902 | m_log.DebugFormat("[WORLD MAP]: RequestMapItems failed for {0}", httpserver); | 1058 | m_log.DebugFormat("[WORLD MAP]: RequestMapItems failed for {0}", httpserver); |
903 | responseMap["connect"] = OSD.FromBoolean(false); | 1059 | Interlocked.Decrement(ref nAsyncRequests); |
904 | return responseMap; | 1060 | return; |
905 | } | 1061 | } |
906 | finally | 1062 | finally |
907 | { | 1063 | { |
@@ -910,26 +1066,24 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
910 | } | 1066 | } |
911 | 1067 | ||
912 | string response_mapItems_reply = null; | 1068 | string response_mapItems_reply = null; |
913 | { | 1069 | { // get the response |
1070 | StreamReader sr = null; | ||
914 | try | 1071 | try |
915 | { | 1072 | { |
916 | using (WebResponse webResponse = mapitemsrequest.GetResponse()) | 1073 | WebResponse webResponse = mapitemsrequest.GetResponse(); |
1074 | if (webResponse != null) | ||
917 | { | 1075 | { |
918 | if (webResponse != null) | 1076 | sr = new StreamReader(webResponse.GetResponseStream()); |
919 | { | 1077 | response_mapItems_reply = sr.ReadToEnd().Trim(); |
920 | using (Stream s = webResponse.GetResponseStream()) | 1078 | } |
921 | using (StreamReader sr = new StreamReader(s)) | 1079 | else |
922 | response_mapItems_reply = sr.ReadToEnd().Trim(); | 1080 | { |
923 | } | 1081 | Interlocked.Decrement(ref nAsyncRequests); |
924 | else | 1082 | return; |
925 | { | 1083 | } |
926 | return new OSDMap(); | ||
927 | } | ||
928 | } | ||
929 | } | 1084 | } |
930 | catch (WebException) | 1085 | catch (WebException) |
931 | { | 1086 | { |
932 | responseMap["connect"] = OSD.FromBoolean(false); | ||
933 | lock (m_blacklistedurls) | 1087 | lock (m_blacklistedurls) |
934 | { | 1088 | { |
935 | if (!m_blacklistedurls.ContainsKey(httpserver)) | 1089 | if (!m_blacklistedurls.ContainsKey(httpserver)) |
@@ -938,19 +1092,25 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
938 | 1092 | ||
939 | m_log.WarnFormat("[WORLD MAP]: Blacklisted {0}", httpserver); | 1093 | m_log.WarnFormat("[WORLD MAP]: Blacklisted {0}", httpserver); |
940 | 1094 | ||
941 | return responseMap; | 1095 | Interlocked.Decrement(ref nAsyncRequests); |
1096 | return; | ||
942 | } | 1097 | } |
943 | catch | 1098 | catch |
944 | { | 1099 | { |
945 | m_log.DebugFormat("[WORLD MAP]: RequestMapItems failed for {0}", httpserver); | 1100 | m_log.DebugFormat("[WORLD MAP]: RequestMapItems failed for {0}", httpserver); |
946 | responseMap["connect"] = OSD.FromBoolean(false); | ||
947 | lock (m_blacklistedregions) | 1101 | lock (m_blacklistedregions) |
948 | { | 1102 | { |
949 | if (!m_blacklistedregions.ContainsKey(regionhandle)) | 1103 | if (!m_blacklistedregions.ContainsKey(regionhandle)) |
950 | m_blacklistedregions.Add(regionhandle, Environment.TickCount); | 1104 | m_blacklistedregions.Add(regionhandle, Environment.TickCount); |
951 | } | 1105 | } |
952 | 1106 | ||
953 | return responseMap; | 1107 | Interlocked.Decrement(ref nAsyncRequests); |
1108 | return; | ||
1109 | } | ||
1110 | finally | ||
1111 | { | ||
1112 | if (sr != null) | ||
1113 | sr.Close(); | ||
954 | } | 1114 | } |
955 | 1115 | ||
956 | OSD rezResponse = null; | 1116 | OSD rezResponse = null; |
@@ -964,15 +1124,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
964 | catch (Exception ex) | 1124 | catch (Exception ex) |
965 | { | 1125 | { |
966 | m_log.InfoFormat("[WORLD MAP]: exception on parse of RequestMapItems reply from {0}: {1}", httpserver, ex.Message); | 1126 | m_log.InfoFormat("[WORLD MAP]: exception on parse of RequestMapItems reply from {0}: {1}", httpserver, ex.Message); |
967 | responseMap["connect"] = OSD.FromBoolean(false); | ||
968 | |||
969 | lock (m_blacklistedregions) | 1127 | lock (m_blacklistedregions) |
970 | { | 1128 | { |
971 | if (!m_blacklistedregions.ContainsKey(regionhandle)) | 1129 | if (!m_blacklistedregions.ContainsKey(regionhandle)) |
972 | m_blacklistedregions.Add(regionhandle, Environment.TickCount); | 1130 | m_blacklistedregions.Add(regionhandle, Environment.TickCount); |
973 | } | 1131 | } |
974 | 1132 | ||
975 | return responseMap; | 1133 | Interlocked.Decrement(ref nAsyncRequests); |
1134 | return; | ||
976 | } | 1135 | } |
977 | } | 1136 | } |
978 | 1137 | ||
@@ -986,7 +1145,78 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
986 | } | 1145 | } |
987 | } | 1146 | } |
988 | 1147 | ||
989 | return responseMap; | 1148 | Interlocked.Decrement(ref nAsyncRequests); |
1149 | |||
1150 | if (id != UUID.Zero) | ||
1151 | { | ||
1152 | ScenePresence av = null; | ||
1153 | m_scene.TryGetScenePresence(id, out av); | ||
1154 | if (av != null) | ||
1155 | { | ||
1156 | if (responseMap.ContainsKey(itemtype.ToString())) | ||
1157 | { | ||
1158 | List<mapItemReply> returnitems = new List<mapItemReply>(); | ||
1159 | OSDArray itemarray = (OSDArray)responseMap[itemtype.ToString()]; | ||
1160 | for (int i = 0; i < itemarray.Count; i++) | ||
1161 | { | ||
1162 | OSDMap mapitem = (OSDMap)itemarray[i]; | ||
1163 | mapItemReply mi = new mapItemReply(); | ||
1164 | mi.x = (uint)mapitem["X"].AsInteger(); | ||
1165 | mi.y = (uint)mapitem["Y"].AsInteger(); | ||
1166 | mi.id = mapitem["ID"].AsUUID(); | ||
1167 | mi.Extra = mapitem["Extra"].AsInteger(); | ||
1168 | mi.Extra2 = mapitem["Extra2"].AsInteger(); | ||
1169 | mi.name = mapitem["Name"].AsString(); | ||
1170 | returnitems.Add(mi); | ||
1171 | } | ||
1172 | av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, flags); | ||
1173 | } | ||
1174 | |||
1175 | // Service 7 (MAP_ITEM_LAND_FOR_SALE) | ||
1176 | itemtype = 7; | ||
1177 | |||
1178 | if (responseMap.ContainsKey(itemtype.ToString())) | ||
1179 | { | ||
1180 | List<mapItemReply> returnitems = new List<mapItemReply>(); | ||
1181 | OSDArray itemarray = (OSDArray)responseMap[itemtype.ToString()]; | ||
1182 | for (int i = 0; i < itemarray.Count; i++) | ||
1183 | { | ||
1184 | OSDMap mapitem = (OSDMap)itemarray[i]; | ||
1185 | mapItemReply mi = new mapItemReply(); | ||
1186 | mi.x = (uint)mapitem["X"].AsInteger(); | ||
1187 | mi.y = (uint)mapitem["Y"].AsInteger(); | ||
1188 | mi.id = mapitem["ID"].AsUUID(); | ||
1189 | mi.Extra = mapitem["Extra"].AsInteger(); | ||
1190 | mi.Extra2 = mapitem["Extra2"].AsInteger(); | ||
1191 | mi.name = mapitem["Name"].AsString(); | ||
1192 | returnitems.Add(mi); | ||
1193 | } | ||
1194 | av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, flags); | ||
1195 | } | ||
1196 | |||
1197 | // Service 1 (MAP_ITEM_TELEHUB) | ||
1198 | itemtype = 1; | ||
1199 | |||
1200 | if (responseMap.ContainsKey(itemtype.ToString())) | ||
1201 | { | ||
1202 | List<mapItemReply> returnitems = new List<mapItemReply>(); | ||
1203 | OSDArray itemarray = (OSDArray)responseMap[itemtype.ToString()]; | ||
1204 | for (int i = 0; i < itemarray.Count; i++) | ||
1205 | { | ||
1206 | OSDMap mapitem = (OSDMap)itemarray[i]; | ||
1207 | mapItemReply mi = new mapItemReply(); | ||
1208 | mi.x = (uint)mapitem["X"].AsInteger(); | ||
1209 | mi.y = (uint)mapitem["Y"].AsInteger(); | ||
1210 | mi.id = mapitem["ID"].AsUUID(); | ||
1211 | mi.Extra = mapitem["Extra"].AsInteger(); | ||
1212 | mi.Extra2 = mapitem["Extra2"].AsInteger(); | ||
1213 | mi.name = mapitem["Name"].AsString(); | ||
1214 | returnitems.Add(mi); | ||
1215 | } | ||
1216 | av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, flags); | ||
1217 | } | ||
1218 | } | ||
1219 | } | ||
990 | } | 1220 | } |
991 | 1221 | ||
992 | /// <summary> | 1222 | /// <summary> |
@@ -996,8 +1226,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
996 | /// <param name="minY"></param> | 1226 | /// <param name="minY"></param> |
997 | /// <param name="maxX"></param> | 1227 | /// <param name="maxX"></param> |
998 | /// <param name="maxY"></param> | 1228 | /// <param name="maxY"></param> |
999 | public virtual void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) | 1229 | public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) |
1000 | { | 1230 | { |
1231 | <<<<<<< HEAD | ||
1232 | ======= | ||
1233 | m_log.DebugFormat("[WoldMapModule] RequestMapBlocks {0}={1}={2}={3} {4}", minX, minY, maxX, maxY, flag); | ||
1234 | /* this flag does not seem to mean what his says | ||
1235 | >>>>>>> avn/ubitvar | ||
1001 | if ((flag & 0x10000) != 0) // user clicked on qthe map a tile that isn't visible | 1236 | if ((flag & 0x10000) != 0) // user clicked on qthe map a tile that isn't visible |
1002 | { | 1237 | { |
1003 | List<MapBlockData> response = new List<MapBlockData>(); | 1238 | List<MapBlockData> response = new List<MapBlockData>(); |
@@ -1006,15 +1241,24 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1006 | // on an unloaded square. | 1241 | // on an unloaded square. |
1007 | // But make sure: Look whether the one we requested is in there | 1242 | // But make sure: Look whether the one we requested is in there |
1008 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, | 1243 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, |
1244 | <<<<<<< HEAD | ||
1009 | (int)Util.RegionToWorldLoc((uint)minX), (int)Util.RegionToWorldLoc((uint)maxX), | 1245 | (int)Util.RegionToWorldLoc((uint)minX), (int)Util.RegionToWorldLoc((uint)maxX), |
1010 | (int)Util.RegionToWorldLoc((uint)minY), (int)Util.RegionToWorldLoc((uint)maxY) ); | 1246 | (int)Util.RegionToWorldLoc((uint)minY), (int)Util.RegionToWorldLoc((uint)maxY) ); |
1011 | 1247 | ||
1012 | m_log.DebugFormat("[WORLD MAP MODULE] RequestMapBlocks min=<{0},{1}>, max=<{2},{3}>, flag={4}, cntFound={5}", | 1248 | m_log.DebugFormat("[WORLD MAP MODULE] RequestMapBlocks min=<{0},{1}>, max=<{2},{3}>, flag={4}, cntFound={5}", |
1013 | minX, minY, maxX, maxY, flag.ToString("X"), regions.Count); | 1249 | minX, minY, maxX, maxY, flag.ToString("X"), regions.Count); |
1250 | ======= | ||
1251 | (int)Util.RegionToWorldLoc((uint)minX), | ||
1252 | (int)Util.RegionToWorldLoc((uint)maxX), | ||
1253 | (int)Util.RegionToWorldLoc((uint)minY), | ||
1254 | (int)Util.RegionToWorldLoc((uint)maxY) ); | ||
1255 | |||
1256 | >>>>>>> avn/ubitvar | ||
1014 | if (regions != null) | 1257 | if (regions != null) |
1015 | { | 1258 | { |
1016 | foreach (GridRegion r in regions) | 1259 | foreach (GridRegion r in regions) |
1017 | { | 1260 | { |
1261 | <<<<<<< HEAD | ||
1018 | if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX) | 1262 | if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX) |
1019 | && r.RegionLocY == Util.RegionToWorldLoc((uint)minY) ) | 1263 | && r.RegionLocY == Util.RegionToWorldLoc((uint)minY) ) |
1020 | { | 1264 | { |
@@ -1024,6 +1268,20 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1024 | response.AddRange(Map2BlockFromGridRegion(r, flag)); | 1268 | response.AddRange(Map2BlockFromGridRegion(r, flag)); |
1025 | else | 1269 | else |
1026 | response.Add(MapBlockFromGridRegion(r, flag)); | 1270 | response.Add(MapBlockFromGridRegion(r, flag)); |
1271 | ======= | ||
1272 | if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX) && | ||
1273 | r.RegionLocY == Util.RegionToWorldLoc((uint)minY)) | ||
1274 | { | ||
1275 | // found it => add it to response | ||
1276 | MapBlockData block = new MapBlockData(); | ||
1277 | if ((flag & 2) == 2) | ||
1278 | response.AddRange(Map2BlockFromGridRegion(r, flag)); | ||
1279 | else | ||
1280 | { | ||
1281 | MapBlockFromGridRegion(block, r, flag); | ||
1282 | response.Add(block); | ||
1283 | } | ||
1284 | >>>>>>> avn/ubitvar | ||
1027 | break; | 1285 | break; |
1028 | } | 1286 | } |
1029 | } | 1287 | } |
@@ -1036,7 +1294,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1036 | block.X = (ushort)minX; | 1294 | block.X = (ushort)minX; |
1037 | block.Y = (ushort)minY; | 1295 | block.Y = (ushort)minY; |
1038 | block.Access = (byte)SimAccess.Down; // means 'simulator is offline' | 1296 | block.Access = (byte)SimAccess.Down; // means 'simulator is offline' |
1297 | <<<<<<< HEAD | ||
1039 | // block.Access = (byte)SimAccess.NonExistent; | 1298 | // block.Access = (byte)SimAccess.NonExistent; |
1299 | ======= | ||
1300 | >>>>>>> avn/ubitvar | ||
1040 | response.Add(block); | 1301 | response.Add(block); |
1041 | } | 1302 | } |
1042 | // The lower 16 bits are an unsigned int16 | 1303 | // The lower 16 bits are an unsigned int16 |
@@ -1045,14 +1306,74 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1045 | else | 1306 | else |
1046 | { | 1307 | { |
1047 | // normal mapblock request. Use the provided values | 1308 | // normal mapblock request. Use the provided values |
1309 | */ | ||
1048 | GetAndSendBlocks(remoteClient, minX, minY, maxX, maxY, flag); | 1310 | GetAndSendBlocks(remoteClient, minX, minY, maxX, maxY, flag); |
1049 | } | 1311 | // } |
1050 | } | 1312 | } |
1051 | 1313 | ||
1052 | protected virtual List<MapBlockData> GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) | 1314 | protected virtual List<MapBlockData> GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) |
1053 | { | 1315 | { |
1316 | MapBlockRequestData req = new MapBlockRequestData(); | ||
1317 | |||
1318 | req.client = remoteClient; | ||
1319 | req.minX = minX; | ||
1320 | req.maxX = maxX; | ||
1321 | req.minY = minY; | ||
1322 | req.maxY = maxY; | ||
1323 | req.flags = flag; | ||
1324 | |||
1325 | lock (m_mapBlockRequestEvent) | ||
1326 | { | ||
1327 | if (!m_mapBlockRequests.ContainsKey(remoteClient.AgentId)) | ||
1328 | m_mapBlockRequests[remoteClient.AgentId] = new Queue<MapBlockRequestData>(); | ||
1329 | m_mapBlockRequests[remoteClient.AgentId].Enqueue(req); | ||
1330 | m_mapBlockRequestEvent.Set(); | ||
1331 | } | ||
1332 | |||
1333 | return new List<MapBlockData>(); | ||
1334 | } | ||
1335 | |||
1336 | protected void MapBlockSendThread() | ||
1337 | { | ||
1338 | while (true) | ||
1339 | { | ||
1340 | List<MapBlockRequestData> thisRunData = new List<MapBlockRequestData>(); | ||
1341 | |||
1342 | m_mapBlockRequestEvent.WaitOne(); | ||
1343 | lock (m_mapBlockRequestEvent) | ||
1344 | { | ||
1345 | int total = 0; | ||
1346 | foreach (Queue<MapBlockRequestData> q in m_mapBlockRequests.Values) | ||
1347 | { | ||
1348 | if (q.Count > 0) | ||
1349 | thisRunData.Add(q.Dequeue()); | ||
1350 | |||
1351 | total += q.Count; | ||
1352 | } | ||
1353 | |||
1354 | if (total == 0) | ||
1355 | m_mapBlockRequestEvent.Reset(); | ||
1356 | } | ||
1357 | |||
1358 | foreach (MapBlockRequestData req in thisRunData) | ||
1359 | { | ||
1360 | // Null client stops thread | ||
1361 | if (req.client == null) | ||
1362 | return; | ||
1363 | |||
1364 | GetAndSendBlocksInternal(req.client, req.minX, req.minY, req.maxX, req.maxY, req.flags); | ||
1365 | } | ||
1366 | |||
1367 | Thread.Sleep(50); | ||
1368 | } | ||
1369 | } | ||
1370 | |||
1371 | protected virtual List<MapBlockData> GetAndSendBlocksInternal(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) | ||
1372 | { | ||
1373 | List<MapBlockData> allBlocks = new List<MapBlockData>(); | ||
1054 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); | 1374 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); |
1055 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, | 1375 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, |
1376 | <<<<<<< HEAD | ||
1056 | (int)Util.RegionToWorldLoc((uint)(minX - 4)), (int)Util.RegionToWorldLoc((uint)(maxX + 4)), | 1377 | (int)Util.RegionToWorldLoc((uint)(minX - 4)), (int)Util.RegionToWorldLoc((uint)(maxX + 4)), |
1057 | (int)Util.RegionToWorldLoc((uint)(minY - 4)), (int)Util.RegionToWorldLoc((uint)(maxY + 4)) ); | 1378 | (int)Util.RegionToWorldLoc((uint)(minY - 4)), (int)Util.RegionToWorldLoc((uint)(maxY + 4)) ); |
1058 | //m_log.DebugFormat("{0} GetAndSendBlocks. min=<{1},{2}>, max=<{3},{4}>, cntFound={5}", | 1379 | //m_log.DebugFormat("{0} GetAndSendBlocks. min=<{1},{2}>, max=<{3},{4}>, cntFound={5}", |
@@ -1064,14 +1385,65 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1064 | mapBlocks.AddRange(Map2BlockFromGridRegion(r, flag)); | 1385 | mapBlocks.AddRange(Map2BlockFromGridRegion(r, flag)); |
1065 | else | 1386 | else |
1066 | mapBlocks.Add(MapBlockFromGridRegion(r, flag)); | 1387 | mapBlocks.Add(MapBlockFromGridRegion(r, flag)); |
1388 | ======= | ||
1389 | minX * (int)Constants.RegionSize, | ||
1390 | maxX * (int)Constants.RegionSize, | ||
1391 | minY * (int)Constants.RegionSize, | ||
1392 | maxY * (int)Constants.RegionSize); | ||
1393 | // (minX - 4) * (int)Constants.RegionSize, | ||
1394 | // (maxX + 4) * (int)Constants.RegionSize, | ||
1395 | // (minY - 4) * (int)Constants.RegionSize, | ||
1396 | // (maxY + 4) * (int)Constants.RegionSize); | ||
1397 | |||
1398 | //mb it means this | ||
1399 | if(regions.Count == 0 && (flag & 0x10000) != 0) | ||
1400 | { | ||
1401 | MapBlockData block = new MapBlockData(); | ||
1402 | block.X = (ushort)minX; | ||
1403 | block.Y = (ushort)minY; | ||
1404 | block.MapImageId = UUID.Zero; | ||
1405 | block.Access = (byte)SimAccess.NonExistent; | ||
1406 | allBlocks.Add(block); | ||
1407 | mapBlocks.Add(block); | ||
1408 | remoteClient.SendMapBlock(mapBlocks, flag & 0xffff); | ||
1409 | return allBlocks; | ||
1410 | >>>>>>> avn/ubitvar | ||
1067 | } | 1411 | } |
1068 | remoteClient.SendMapBlock(mapBlocks, flag & 0xffff); | ||
1069 | 1412 | ||
1070 | return mapBlocks; | 1413 | foreach (GridRegion r in regions) |
1414 | { | ||
1415 | MapBlockData block = new MapBlockData(); | ||
1416 | if ((flag & 2) == 2) | ||
1417 | { | ||
1418 | List<MapBlockData> blocks = Map2BlockFromGridRegion(r, flag); | ||
1419 | mapBlocks.AddRange(blocks); | ||
1420 | allBlocks.AddRange(blocks); | ||
1421 | } | ||
1422 | else | ||
1423 | { | ||
1424 | MapBlockFromGridRegion(block, r, flag); | ||
1425 | mapBlocks.Add(block); | ||
1426 | allBlocks.Add(block); | ||
1427 | } | ||
1428 | if (mapBlocks.Count >= 10) | ||
1429 | { | ||
1430 | remoteClient.SendMapBlock(mapBlocks, flag & 0xffff); | ||
1431 | mapBlocks.Clear(); | ||
1432 | Thread.Sleep(50); | ||
1433 | } | ||
1434 | } | ||
1435 | if (mapBlocks.Count > 0) | ||
1436 | remoteClient.SendMapBlock(mapBlocks, flag & 0xffff); | ||
1437 | |||
1438 | return allBlocks; | ||
1071 | } | 1439 | } |
1072 | 1440 | ||
1441 | <<<<<<< HEAD | ||
1073 | // Fill a passed MapBlockData from a GridRegion | 1442 | // Fill a passed MapBlockData from a GridRegion |
1074 | public MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag) | 1443 | public MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag) |
1444 | ======= | ||
1445 | public void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag) | ||
1446 | >>>>>>> avn/ubitvar | ||
1075 | { | 1447 | { |
1076 | MapBlockData block = new MapBlockData(); | 1448 | MapBlockData block = new MapBlockData(); |
1077 | 1449 | ||
@@ -1089,12 +1461,54 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1089 | break; | 1461 | break; |
1090 | } | 1462 | } |
1091 | block.Name = r.RegionName; | 1463 | block.Name = r.RegionName; |
1464 | <<<<<<< HEAD | ||
1092 | block.X = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocX); | 1465 | block.X = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocX); |
1093 | block.Y = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocY); | 1466 | block.Y = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocY); |
1094 | block.SizeX = (ushort) r.RegionSizeX; | 1467 | block.SizeX = (ushort) r.RegionSizeX; |
1095 | block.SizeY = (ushort) r.RegionSizeY; | 1468 | block.SizeY = (ushort) r.RegionSizeY; |
1096 | 1469 | ||
1097 | return block; | 1470 | return block; |
1471 | ======= | ||
1472 | block.X = (ushort)(r.RegionLocX / Constants.RegionSize); | ||
1473 | block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); | ||
1474 | block.SizeX = (ushort)r.RegionSizeX; | ||
1475 | block.SizeY = (ushort)r.RegionSizeY; | ||
1476 | } | ||
1477 | |||
1478 | public List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag) | ||
1479 | { | ||
1480 | List<MapBlockData> blocks = new List<MapBlockData>(); | ||
1481 | MapBlockData block = new MapBlockData(); | ||
1482 | if (r == null) | ||
1483 | { | ||
1484 | block.Access = (byte)SimAccess.Down; | ||
1485 | block.MapImageId = UUID.Zero; | ||
1486 | blocks.Add(block); | ||
1487 | } | ||
1488 | else | ||
1489 | { | ||
1490 | block.Access = r.Access; | ||
1491 | switch (flag & 0xffff) | ||
1492 | { | ||
1493 | case 0: | ||
1494 | block.MapImageId = r.TerrainImage; | ||
1495 | break; | ||
1496 | case 2: | ||
1497 | block.MapImageId = r.ParcelImage; | ||
1498 | break; | ||
1499 | default: | ||
1500 | block.MapImageId = UUID.Zero; | ||
1501 | break; | ||
1502 | } | ||
1503 | block.Name = r.RegionName; | ||
1504 | block.X = (ushort)(r.RegionLocX / Constants.RegionSize); | ||
1505 | block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); | ||
1506 | block.SizeX = (ushort)r.RegionSizeX; | ||
1507 | block.SizeY = (ushort)r.RegionSizeY; | ||
1508 | blocks.Add(block); | ||
1509 | } | ||
1510 | return blocks; | ||
1511 | >>>>>>> avn/ubitvar | ||
1098 | } | 1512 | } |
1099 | 1513 | ||
1100 | public List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag) | 1514 | public List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag) |
@@ -1338,9 +1752,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1338 | uint xstart = 0; | 1752 | uint xstart = 0; |
1339 | uint ystart = 0; | 1753 | uint ystart = 0; |
1340 | 1754 | ||
1755 | <<<<<<< HEAD | ||
1341 | Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle,out xstart,out ystart); | 1756 | Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle,out xstart,out ystart); |
1342 | // m_log.DebugFormat("{0} HandleRemoteMapItemRequest. loc=<{1},{2}>", | 1757 | // m_log.DebugFormat("{0} HandleRemoteMapItemRequest. loc=<{1},{2}>", |
1343 | // LogHeader, Util.WorldToRegionLoc(xstart), Util.WorldToRegionLoc(ystart)); | 1758 | // LogHeader, Util.WorldToRegionLoc(xstart), Util.WorldToRegionLoc(ystart)); |
1759 | ======= | ||
1760 | Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); | ||
1761 | >>>>>>> avn/ubitvar | ||
1344 | 1762 | ||
1345 | // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots) | 1763 | // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots) |
1346 | 1764 | ||
@@ -1362,7 +1780,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1362 | } | 1780 | } |
1363 | else | 1781 | else |
1364 | { | 1782 | { |
1365 | OSDArray responsearr = new OSDArray(m_scene.GetRootAgentCount()); | 1783 | OSDArray responsearr = new OSDArray(); // Don't preallocate. MT (m_scene.GetRootAgentCount()); |
1366 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) | 1784 | m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) |
1367 | { | 1785 | { |
1368 | OSDMap responsemapdata = new OSDMap(); | 1786 | OSDMap responsemapdata = new OSDMap(); |
@@ -1460,6 +1878,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1460 | return; | 1878 | return; |
1461 | 1879 | ||
1462 | m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.Name); | 1880 | m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.Name); |
1881 | <<<<<<< HEAD | ||
1463 | 1882 | ||
1464 | using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile()) | 1883 | using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile()) |
1465 | { | 1884 | { |
@@ -1475,6 +1894,23 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1475 | { | 1894 | { |
1476 | byte[] data; | 1895 | byte[] data; |
1477 | 1896 | ||
1897 | ======= | ||
1898 | |||
1899 | using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile()) | ||
1900 | { | ||
1901 | // V1 (This Module) | ||
1902 | GenerateMaptile(mapbmp); | ||
1903 | |||
1904 | // v2/3 (MapImageServiceModule) | ||
1905 | m_mapImageServiceModule.UploadMapTile(m_scene, mapbmp); | ||
1906 | } | ||
1907 | } | ||
1908 | |||
1909 | private void GenerateMaptile(Bitmap mapbmp) | ||
1910 | { | ||
1911 | byte[] data; | ||
1912 | |||
1913 | >>>>>>> avn/ubitvar | ||
1478 | try | 1914 | try |
1479 | { | 1915 | { |
1480 | data = OpenJPEG.EncodeFromImage(mapbmp, true); | 1916 | data = OpenJPEG.EncodeFromImage(mapbmp, true); |
@@ -1553,6 +1989,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1553 | { | 1989 | { |
1554 | m_rootAgents.Remove(avatar.UUID); | 1990 | m_rootAgents.Remove(avatar.UUID); |
1555 | } | 1991 | } |
1992 | |||
1993 | lock (m_mapBlockRequestEvent) | ||
1994 | { | ||
1995 | if (m_mapBlockRequests.ContainsKey(avatar.UUID)) | ||
1996 | m_mapBlockRequests.Remove(avatar.UUID); | ||
1997 | } | ||
1556 | } | 1998 | } |
1557 | 1999 | ||
1558 | public void OnRegionUp(GridRegion otherRegion) | 2000 | public void OnRegionUp(GridRegion otherRegion) |
@@ -1585,7 +2027,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1585 | int regionSizeX = (int)m_scene.RegionInfo.RegionSizeX; | 2027 | int regionSizeX = (int)m_scene.RegionInfo.RegionSizeX; |
1586 | int regionSizeY = (int)m_scene.RegionInfo.RegionSizeY; | 2028 | int regionSizeY = (int)m_scene.RegionInfo.RegionSizeY; |
1587 | 2029 | ||
2030 | <<<<<<< HEAD | ||
1588 | int landTileSize = LandManagementModule.LandUnit; | 2031 | int landTileSize = LandManagementModule.LandUnit; |
2032 | ======= | ||
2033 | int landTileSize = LandManagementModule.landUnit; | ||
2034 | >>>>>>> avn/ubitvar | ||
1589 | int regionLandTilesX = regionSizeX / landTileSize; | 2035 | int regionLandTilesX = regionSizeX / landTileSize; |
1590 | int regionLandTilesY = regionSizeY / landTileSize; | 2036 | int regionLandTilesY = regionSizeY / landTileSize; |
1591 | 2037 | ||
@@ -1608,6 +2054,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1608 | { | 2054 | { |
1609 | using (SolidBrush transparent = new SolidBrush(background)) | 2055 | using (SolidBrush transparent = new SolidBrush(background)) |
1610 | g.FillRectangle(transparent, 0, 0, regionSizeX, regionSizeY); | 2056 | g.FillRectangle(transparent, 0, 0, regionSizeX, regionSizeY); |
2057 | <<<<<<< HEAD | ||
2058 | ======= | ||
2059 | |||
2060 | >>>>>>> avn/ubitvar | ||
1611 | 2061 | ||
1612 | foreach (ILandObject land in parcels) | 2062 | foreach (ILandObject land in parcels) |
1613 | { | 2063 | { |
@@ -1630,6 +2080,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1630 | 2080 | ||
1631 | using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9))) | 2081 | using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9))) |
1632 | { | 2082 | { |
2083 | <<<<<<< HEAD | ||
1633 | for (int x = 0 ; x < regionLandTilesX ; x++) | 2084 | for (int x = 0 ; x < regionLandTilesX ; x++) |
1634 | { | 2085 | { |
1635 | for (int y = 0 ; y < regionLandTilesY ; y++) | 2086 | for (int y = 0 ; y < regionLandTilesY ; y++) |
@@ -1639,6 +2090,18 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1639 | yellow, x * landTileSize, | 2090 | yellow, x * landTileSize, |
1640 | regionSizeX - landTileSize - (y * landTileSize), | 2091 | regionSizeX - landTileSize - (y * landTileSize), |
1641 | landTileSize, | 2092 | landTileSize, |
2093 | ======= | ||
2094 | for (int x = 0; x < regionLandTilesX ; x++) | ||
2095 | { | ||
2096 | for (int y = 0; y < regionLandTilesY ; y++) | ||
2097 | { | ||
2098 | if (saleBitmap[x, y]) | ||
2099 | g.FillRectangle( | ||
2100 | yellow, | ||
2101 | x * landTileSize, | ||
2102 | regionSizeX - landTileSize - (y * landTileSize), | ||
2103 | landTileSize, | ||
2104 | >>>>>>> avn/ubitvar | ||
1642 | landTileSize); | 2105 | landTileSize); |
1643 | } | 2106 | } |
1644 | } | 2107 | } |
@@ -1668,4 +2131,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1668 | public uint itemtype; | 2131 | public uint itemtype; |
1669 | public ulong regionhandle; | 2132 | public ulong regionhandle; |
1670 | } | 2133 | } |
2134 | |||
2135 | public struct MapBlockRequestData | ||
2136 | { | ||
2137 | public IClientAPI client; | ||
2138 | public int minX; | ||
2139 | public int minY; | ||
2140 | public int maxX; | ||
2141 | public int maxY; | ||
2142 | public uint flags; | ||
2143 | } | ||
1671 | } | 2144 | } |