aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs28
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs17
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs11
-rw-r--r--OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs25
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs160
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs448
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs37
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs14
-rw-r--r--OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs19
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs75
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs28
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs15
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs84
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs33
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs74
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs420
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs84
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs536
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs130
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs34
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs74
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs371
34 files changed, 221 insertions, 2586 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
index 345b53d..fdff199 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -455,8 +455,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
455 m_transactions.RemoveXferUploader(m_transactionID); 455 m_transactions.RemoveXferUploader(m_transactionID);
456 } 456 }
457 457
458<<<<<<< HEAD 458
459=======
460 private void ValidateAssets() 459 private void ValidateAssets()
461 { 460 {
462 if (m_asset.Type == (sbyte)CustomAssetType.AnimationSet) 461 if (m_asset.Type == (sbyte)CustomAssetType.AnimationSet)
@@ -599,6 +598,5 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
599 598
600 return result; 599 return result;
601 } 600 }
602>>>>>>> avn/ubitvar
603 } 601 }
604} 602}
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index b24dc0c..92beed2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -406,25 +406,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
406 406
407 Dictionary<SceneObjectGroup, string> scriptStates = new Dictionary<SceneObjectGroup, string>(); 407 Dictionary<SceneObjectGroup, string> scriptStates = new Dictionary<SceneObjectGroup, string>();
408 408
409<<<<<<< HEAD
410 foreach (SceneObjectGroup so in attachments)
411 {
412 // Scripts MUST be snapshotted before the object is
413 // removed from the scene because doing otherwise will
414 // clobber the run flag
415 // This must be done outside the sp.AttachmentSyncLock so that there is no risk of a deadlock from
416 // scripts performing attachment operations at the same time. Getting object states stops the scripts.
417 scriptStates[so] = PrepareScriptInstanceForSave(so, false);
418
419// m_log.DebugFormat(
420// "[ATTACHMENTS MODULE]: For object {0} for {1} in {2} got saved state {3}",
421// so.Name, sp.Name, m_scene.Name, scriptStates[so]);
422 }
423 409
424 lock (sp.AttachmentsSyncLock)
425=======
426 if (sp.PresenceType != PresenceType.Npc) 410 if (sp.PresenceType != PresenceType.Npc)
427>>>>>>> avn/ubitvar
428 { 411 {
429 foreach (SceneObjectGroup so in attachments) 412 foreach (SceneObjectGroup so in attachments)
430 { 413 {
@@ -477,18 +460,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
477 if (!Enabled) 460 if (!Enabled)
478 return false; 461 return false;
479 462
480<<<<<<< HEAD
481 group.DetachFromBackup();
482
483 bool success = AttachObjectInternal(sp, group, attachmentPt, silent, addToInventory, false, append);
484
485 if (!success)
486 group.AttachToBackup();
487
488 return success;
489=======
490 return AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, addToInventory, false, append); 463 return AttachObjectInternal(sp, group, attachmentPt, silent, useAttachData, addToInventory, false, append);
491>>>>>>> avn/ubitvar
492 } 464 }
493 465
494 /// <summary> 466 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 1e9cfba..0d3b39e 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -229,7 +229,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
229 private void SendAppearance(ScenePresence sp) 229 private void SendAppearance(ScenePresence sp)
230 { 230 {
231 // Send the appearance to everyone in the scene 231 // Send the appearance to everyone in the scene
232 sp.SendAppearanceToAllOtherClients(); 232 sp.SendAppearanceToAllOtherAgents();
233 233
234 // Send animations back to the avatar as well 234 // Send animations back to the avatar as well
235 sp.Animator.SendAnimPack(); 235 sp.Animator.SendAnimPack();
@@ -460,7 +460,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
460 { 460 {
461 m_log.Debug("[UpdateBakedCache] uploading to bakedModule cache"); 461 m_log.Debug("[UpdateBakedCache] uploading to bakedModule cache");
462 462
463 m_BakedTextureModule.Store(sp.UUID); 463 m_BakedTextureModule.Store(sp.UUID, wearableCache);
464 } 464 }
465 } 465 }
466 466
@@ -529,12 +529,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
529 ); 529 );
530 } 530 }
531 } 531 }
532<<<<<<< HEAD
533
534// m_log.DebugFormat(
535// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}",
536// face.TextureID, idx, client.Name, client.AgentId);
537=======
538*/ 532*/
539 bool wearableCacheValid = false; 533 bool wearableCacheValid = false;
540 if (wearableCache == null) 534 if (wearableCache == null)
@@ -577,15 +571,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
577 if (wearableCacheValid) 571 if (wearableCacheValid)
578 m_log.Debug("[ValidateBakedCache] have valid local cache"); 572 m_log.Debug("[ValidateBakedCache] have valid local cache");
579 } 573 }
580>>>>>>> avn/ubitvar
581 574
582 bool checkExternal = false; 575 bool checkExternal = false;
583 576
584<<<<<<< HEAD
585 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
586 return false;
587 }
588=======
589 if (!wearableCacheValid) 577 if (!wearableCacheValid)
590 { 578 {
591 // only use external bake module on login condition check 579 // only use external bake module on login condition check
@@ -658,7 +646,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
658 } 646 }
659 } 647 }
660 } 648 }
661>>>>>>> avn/ubitvar
662 649
663 sp.Appearance.WearableCacheItems = wearableCache; 650 sp.Appearance.WearableCacheItems = wearableCache;
664 651
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
index b7ff4e0..dd93449 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs
@@ -132,7 +132,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
132 for (byte i = 0; i < visualParams.Length; i++) 132 for (byte i = 0; i < visualParams.Length; i++)
133 visualParams[i] = i; 133 visualParams[i] = i;
134 134
135<<<<<<< HEAD
136 Primitive.TextureEntry bakedTextureEntry = new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)); 135 Primitive.TextureEntry bakedTextureEntry = new Primitive.TextureEntry(TestHelpers.ParseTail(0x10));
137 uint eyesFaceIndex = (uint)AppearanceManager.BakeTypeToAgentTextureIndex(BakeType.Eyes); 136 uint eyesFaceIndex = (uint)AppearanceManager.BakeTypeToAgentTextureIndex(BakeType.Eyes);
138 Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex); 137 Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex);
@@ -145,12 +144,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
145 afm.SetAppearance(sp, bakedTextureEntry, visualParams, null); 144 afm.SetAppearance(sp, bakedTextureEntry, visualParams, null);
146 145
147 Assert.That(rebakeRequestsReceived, Is.EqualTo(0)); 146 Assert.That(rebakeRequestsReceived, Is.EqualTo(0));
148=======
149 afm.SetAppearance(sp, new Primitive.TextureEntry(TestHelpers.ParseTail(0x10)), visualParams, new WearableCacheItem[0]);
150
151 // TODO: Check baked texture
152 Assert.AreEqual(visualParams, sp.Appearance.VisualParams);
153>>>>>>> avn/ubitvar
154 } 147 }
155 148
156 [Test] 149 [Test]
@@ -188,11 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
188 Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex); 181 Primitive.TextureEntryFace eyesFace = bakedTextureEntry.CreateFace(eyesFaceIndex);
189 eyesFace.TextureID = eyesTextureId; 182 eyesFace.TextureID = eyesTextureId;
190 183
191<<<<<<< HEAD
192 afm.SetAppearance(sp, bakedTextureEntry, visualParams, null);
193=======
194 afm.SetAppearance(sp, bakedTextureEntry, visualParams, new WearableCacheItem[0]); 184 afm.SetAppearance(sp, bakedTextureEntry, visualParams, new WearableCacheItem[0]);
195>>>>>>> avn/ubitvar
196 afm.SaveBakedTextures(userId); 185 afm.SaveBakedTextures(userId);
197// Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = afm.GetBakedTextureFaces(userId); 186// Dictionary<BakeType, Primitive.TextureEntryFace> bakedTextures = afm.GetBakedTextureFaces(userId);
198 187
diff --git a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
index 7d2cad6..b8a1dba 100644
--- a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs
@@ -151,6 +151,14 @@ namespace OpenSim.Region.CoreModules.Avatar.BakedTextures
151 } 151 }
152 } 152 }
153 153
154 public void Store(UUID agentId)
155 {
156 }
157 public void UpdateMeshAvatar(UUID agentId)
158 {
159 }
160
161
154 public void Store(UUID agentId, WearableCacheItem[] data) 162 public void Store(UUID agentId, WearableCacheItem[] data)
155 { 163 {
156 if (m_URL == String.Empty) 164 if (m_URL == String.Empty)
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
index 2801ef0..0b5d95b 100644
--- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs
@@ -214,13 +214,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
214 UUID destination = c.Destination; 214 UUID destination = c.Destination;
215 Vector3 fromPos = c.Position; 215 Vector3 fromPos = c.Position;
216 Vector3 regionPos = new Vector3(scene.RegionInfo.WorldLocX, scene.RegionInfo.WorldLocY, 0); 216 Vector3 regionPos = new Vector3(scene.RegionInfo.WorldLocX, scene.RegionInfo.WorldLocY, 0);
217<<<<<<< HEAD
218=======
219 217
220 bool checkParcelHide = false; 218 bool checkParcelHide = false;
221 UUID sourceParcelID = UUID.Zero; 219 UUID sourceParcelID = UUID.Zero;
222 Vector3 hidePos = fromPos; 220 Vector3 hidePos = fromPos;
223>>>>>>> avn/ubitvar
224 221
225 if (c.Channel == DEBUG_CHANNEL) c.Type = ChatTypeEnum.DebugChannel; 222 if (c.Channel == DEBUG_CHANNEL) c.Type = ChatTypeEnum.DebugChannel;
226 223
@@ -377,27 +374,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
377 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); 374 // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType);
378 HashSet<UUID> receiverIDs = new HashSet<UUID>(); 375 HashSet<UUID> receiverIDs = new HashSet<UUID>();
379 376
380<<<<<<< HEAD
381 ((Scene)c.Scene).ForEachRootClient(
382 delegate(IClientAPI client)
383 {
384 // don't forward SayOwner chat from objects to
385 // non-owner agents
386 if ((c.Type == ChatTypeEnum.Owner) &&
387 (null != c.SenderObject) &&
388 (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
389 return;
390
391 client.SendChatMessage(
392 c.Message, (byte)cType, CenterOfRegion, fromName, fromID, ownerID,
393 (byte)sourceType, (byte)ChatAudibleLevel.Fully);
394
395 receiverIDs.Add(client.AgentId);
396 });
397
398 (c.Scene as Scene).EventManager.TriggerOnChatToClients(
399 fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully);
400=======
401 if (c.Scene != null) 377 if (c.Scene != null)
402 { 378 {
403 ((Scene)c.Scene).ForEachRootClient 379 ((Scene)c.Scene).ForEachRootClient
@@ -419,7 +395,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
419 (c.Scene as Scene).EventManager.TriggerOnChatToClients( 395 (c.Scene as Scene).EventManager.TriggerOnChatToClients(
420 fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully); 396 fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully);
421 } 397 }
422>>>>>>> avn/ubitvar
423 } 398 }
424 399
425 /// <summary> 400 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
index b0b7054..4e1958a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
@@ -183,15 +183,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
183 try 183 try
184 { 184 {
185 ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 185 ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
186<<<<<<< HEAD
187
188 if (obj == null)
189 return;
190
191=======
192 if (obj == null) 186 if (obj == null)
193 return; 187 return;
194>>>>>>> avn/ubitvar
195 if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0 188 if ((obj.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0
196 || avatar.Scene.RegionInfo.RegionSettings.AllowDamage) 189 || avatar.Scene.RegionInfo.RegionSettings.AllowDamage)
197 { 190 {
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index 5573c94..3c82fd9 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -188,7 +188,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
188 SendGridInstantMessageViaXMLRPC(im, result); 188 SendGridInstantMessageViaXMLRPC(im, result);
189 } 189 }
190 190
191 public void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result) 191 public virtual void HandleUndeliverableMessage(GridInstantMessage im, MessageResultNotification result)
192 { 192 {
193 UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage; 193 UndeliveredMessage handlerUndeliveredMessage = OnUndeliveredMessage;
194 194
@@ -445,14 +445,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
445 return resp; 445 return resp;
446 } 446 }
447 447
448<<<<<<< HEAD 448
449 /// <summary> 449 /// <summary>
450 /// delegate for sending a grid instant message asynchronously 450 /// delegate for sending a grid instant message asynchronously
451 /// </summary> 451 /// </summary>
452 public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result);
453=======
454 private delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result); 452 private delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result);
455>>>>>>> avn/ubitvar
456 453
457 private class GIM { 454 private class GIM {
458 public GridInstantMessage im; 455 public GridInstantMessage im;
@@ -479,31 +476,22 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
479 } 476 }
480 } 477 }
481 478
482<<<<<<< HEAD 479
483 d.BeginInvoke(im, result, GridInstantMessageCompleted, d);
484=======
485 private void GridInstantMessageCompleted(IAsyncResult iar) 480 private void GridInstantMessageCompleted(IAsyncResult iar)
486 { 481 {
487 GridInstantMessageDelegate d = (GridInstantMessageDelegate)iar.AsyncState; 482 GridInstantMessageDelegate d = (GridInstantMessageDelegate)iar.AsyncState;
488 d.EndInvoke(iar); 483 d.EndInvoke(iar);
489>>>>>>> avn/ubitvar
490 } 484 }
491 485
492 /// <summary> 486 /// <summary>
493 /// Internal SendGridInstantMessage over XMLRPC method. 487 /// Internal SendGridInstantMessage over XMLRPC method.
494 /// </summary> 488 /// </summary>
495<<<<<<< HEAD 489
496 /// <remarks>
497 /// This is called from within a dedicated thread.
498 /// </remarks>
499 private void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result)
500=======
501 /// <param name="prevRegionHandle"> 490 /// <param name="prevRegionHandle">
502 /// Pass in 0 the first time this method is called. It will be called recursively with the last 491 /// Pass in 0 the first time this method is called. It will be called recursively with the last
503 /// regionhandle tried 492 /// regionhandle tried
504 /// </param> 493 /// </param>
505 private void SendGridInstantMessageViaXMLRPCAsyncMain(GridInstantMessage im, MessageResultNotification result) 494 private void SendGridInstantMessageViaXMLRPCAsyncMain(GridInstantMessage im, MessageResultNotification result)
506>>>>>>> avn/ubitvar
507 { 495 {
508 GIM gim; 496 GIM gim;
509 do { 497 do {
@@ -525,87 +513,124 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
525 } 513 }
526 } while (gim != null); 514 } while (gim != null);
527 } 515 }
516
528 private void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID) 517 private void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID)
529 { 518 {
530 519
531 UUID toAgentID = new UUID(im.toAgentID); 520 UUID toAgentID = new UUID(im.toAgentID);
521 PresenceInfo upd = null;
532 UUID regionID; 522 UUID regionID;
533 bool needToLookupAgent; 523 bool lookupAgent = false;
534 524
535 lock (m_UserRegionMap) 525 lock (m_UserRegionMap)
536 needToLookupAgent = !m_UserRegionMap.TryGetValue(toAgentID, out regionID);
537
538 while (true)
539 { 526 {
540 if (needToLookupAgent) 527 if (m_UserRegionMap.ContainsKey(toAgentID))
541 { 528 {
542 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); 529 upd = new PresenceInfo();
530 upd.RegionID = m_UserRegionMap[toAgentID];
531
532 // We need to compare the current regionhandle with the previous region handle
533 // or the recursive loop will never end because it will never try to lookup the agent again
534 if (prevRegionID == upd.RegionID)
535 {
536 lookupAgent = true;
537 }
538 }
539 else
540 {
541 lookupAgent = true;
542 }
543 }
543 544
544 UUID foundRegionID = UUID.Zero;
545 545
546 if (presences != null) 546 // Are we needing to look-up an agent?
547 if (lookupAgent)
548 {
549 // Non-cached user agent lookup.
550 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() });
551 if (presences != null && presences.Length > 0)
552 {
553 foreach (PresenceInfo p in presences)
547 { 554 {
548 foreach (PresenceInfo p in presences) 555 if (p.RegionID != UUID.Zero)
549 { 556 {
550 if (p.RegionID != UUID.Zero) 557 upd = p;
551 { 558 break;
552 foundRegionID = p.RegionID;
553 break;
554 }
555 } 559 }
556 } 560 }
557
558 // If not found or the found region is the same as the last lookup, then message is undeliverable
559 if (foundRegionID == UUID.Zero || foundRegionID == regionID)
560 break;
561 else
562 regionID = foundRegionID;
563 } 561 }
564 562
565 GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, regionID); 563 if (upd != null)
566 if (reginfo == null)
567 { 564 {
568 m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", regionID); 565 // check if we've tried this before..
569 break; 566 // This is one way to end the recursive loop
567 //
568 if (upd.RegionID == prevRegionID)
569 {
570 // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
571 HandleUndeliverableMessage(im, result);
572 return;
573 }
570 } 574 }
575 else
576 {
577 // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
578 HandleUndeliverableMessage(im, result);
579 return;
580 }
581 }
571 582
572<<<<<<< HEAD
573 // Try to send the message to the agent via the retrieved region.
574 Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im);
575 msgdata["region_handle"] = 0;
576 bool imresult = doIMSending(reginfo, msgdata);
577
578 // If the message delivery was successful, then cache the entry.
579 if (imresult)
580=======
581 if (upd != null) 583 if (upd != null)
582 { 584 {
583 GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(UUID.Zero, 585 GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(UUID.Zero,
584 upd.RegionID); 586 upd.RegionID);
585 if (reginfo != null) 587 if (reginfo != null)
586>>>>>>> avn/ubitvar
587 { 588 {
588 lock (m_UserRegionMap) 589 Hashtable msgdata = ConvertGridInstantMessageToXMLRPC(im);
590 // Not actually used anymore, left in for compatibility
591 // Remove at next interface change
592 //
593 msgdata["region_handle"] = 0;
594 bool imresult = doIMSending(reginfo, msgdata);
595 if (imresult)
596 {
597 // IM delivery successful, so store the Agent's location in our local cache.
598 lock (m_UserRegionMap)
599 {
600 if (m_UserRegionMap.ContainsKey(toAgentID))
601 {
602 m_UserRegionMap[toAgentID] = upd.RegionID;
603 }
604 else
605 {
606 m_UserRegionMap.Add(toAgentID, upd.RegionID);
607 }
608 }
609 result(true);
610 }
611 else
589 { 612 {
590 m_UserRegionMap[toAgentID] = regionID; 613 // try again, but lookup user this time.
614 // Warning, this must call the Async version
615 // of this method or we'll be making thousands of threads
616 // The version within the spawned thread is SendGridInstantMessageViaXMLRPCAsync
617 // The version that spawns the thread is SendGridInstantMessageViaXMLRPC
618
619 // This is recursive!!!!!
620 SendGridInstantMessageViaXMLRPCAsync(im, result,
621 upd.RegionID);
591 } 622 }
592 result(true);
593 return;
594 } 623 }
595 624 else
596 // If we reach this point in the first iteration of the while, then we may have unsuccessfully tried 625 {
597 // to use a locally cached region ID. All subsequent attempts need to lookup agent details from 626 m_log.WarnFormat("[GRID INSTANT MESSAGE]: Unable to find region {0}", upd.RegionID);
598 // the presence service. 627 HandleUndeliverableMessage(im, result);
599 needToLookupAgent = true; 628 }
629 }
630 else
631 {
632 HandleUndeliverableMessage(im, result);
600 } 633 }
601
602 // If we reached this point then the message was not deliverable. Remove the bad cache entry and
603 // signal the delivery failure.
604 lock (m_UserRegionMap)
605 m_UserRegionMap.Remove(toAgentID);
606
607 // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
608 HandleUndeliverableMessage(im, result);
609 } 634 }
610 635
611 /// <summary> 636 /// <summary>
@@ -709,6 +734,5 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
709 gim["message_key"] = m_MessageKey; 734 gim["message_key"] = m_MessageKey;
710 return gim; 735 return gim;
711 } 736 }
712
713 } 737 }
714} 738}
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index 76023bd..1650097 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -238,7 +238,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
238 return; 238 return;
239 } 239 }
240 240
241<<<<<<< HEAD
242 if (!m_ForwardOfflineGroupMessages) 241 if (!m_ForwardOfflineGroupMessages)
243 { 242 {
244 if (im.dialog == (byte)InstantMessageDialog.GroupNotice || 243 if (im.dialog == (byte)InstantMessageDialog.GroupNotice ||
@@ -246,9 +245,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
246 return; 245 return;
247 } 246 }
248 247
249 bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>(
250 "POST", m_RestURL+"/SaveMessage/", im, 10000);
251=======
252 Scene scene = FindScene(new UUID(im.fromAgentID)); 248 Scene scene = FindScene(new UUID(im.fromAgentID));
253 if (scene == null) 249 if (scene == null)
254 scene = m_SceneList[0]; 250 scene = m_SceneList[0];
@@ -256,7 +252,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
256 SendReply reply = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, SendReply>( 252 SendReply reply = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, SendReply>(
257 "POST", m_RestURL+"/SaveMessage/?scope=" + 253 "POST", m_RestURL+"/SaveMessage/?scope=" +
258 scene.RegionInfo.ScopeID.ToString(), im); 254 scene.RegionInfo.ScopeID.ToString(), im);
259>>>>>>> avn/ubitvar
260 255
261 if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) 256 if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
262 { 257 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 18e18a9..2d15b47 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -180,13 +180,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
180 "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory", 180 "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory",
181 folderID, new UUID(im.toAgentID)); 181 folderID, new UUID(im.toAgentID));
182 182
183<<<<<<< HEAD
184 InventoryFolderBase folderCopy 183 InventoryFolderBase folderCopy
185 = scene.GiveInventoryFolder(client, receipientID, client.AgentId, folderID, UUID.Zero); 184 = scene.GiveInventoryFolder(client, recipientID, client.AgentId, folderID, UUID.Zero);
186=======
187 InventoryFolderBase folderCopy
188 = scene.GiveInventoryFolder(recipientID, client.AgentId, folderID, UUID.Zero);
189>>>>>>> avn/ubitvar
190 185
191 if (folderCopy == null) 186 if (folderCopy == null)
192 { 187 {
@@ -475,7 +470,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
475 /// <param name="im"></param> 470 /// <param name="im"></param>
476 private void OnGridInstantMessage(GridInstantMessage im) 471 private void OnGridInstantMessage(GridInstantMessage im)
477 { 472 {
478<<<<<<< HEAD
479 // Check if it's a type of message that we should handle 473 // Check if it's a type of message that we should handle
480 if (!((im.dialog == (byte) InstantMessageDialog.InventoryOffered) 474 if (!((im.dialog == (byte) InstantMessageDialog.InventoryOffered)
481 || (im.dialog == (byte) InstantMessageDialog.TaskInventoryOffered) 475 || (im.dialog == (byte) InstantMessageDialog.TaskInventoryOffered)
@@ -488,8 +482,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
488 "[INVENTORY TRANSFER]: {0} IM type received from grid. From={1} ({2}), To={3}", 482 "[INVENTORY TRANSFER]: {0} IM type received from grid. From={1} ({2}), To={3}",
489 (InstantMessageDialog)im.dialog, im.fromAgentID, im.fromAgentName, im.toAgentID); 483 (InstantMessageDialog)im.dialog, im.fromAgentID, im.fromAgentName, im.toAgentID);
490 484
491=======
492>>>>>>> avn/ubitvar
493 // Check if this is ours to handle 485 // Check if this is ours to handle
494 // 486 //
495 Scene scene = FindClientScene(new UUID(im.toAgentID)); 487 Scene scene = FindClientScene(new UUID(im.toAgentID));
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index bea2834..4d1611c 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -869,7 +869,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
869 } 869 }
870 #endregion Notes 870 #endregion Notes
871 871
872<<<<<<< HEAD 872
873 #region User Preferences 873 #region User Preferences
874 /// <summary> 874 /// <summary>
875 /// Updates the user preferences. 875 /// Updates the user preferences.
@@ -933,8 +933,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
933 } 933 }
934 #endregion User Preferences 934 #endregion User Preferences
935 935
936=======
937>>>>>>> avn/ubitvar
938 #region Avatar Properties 936 #region Avatar Properties
939 /// <summary> 937 /// <summary>
940 /// Update the avatars interests . 938 /// Update the avatars interests .
@@ -1401,8 +1399,6 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1401 return null; 1399 return null;
1402 } 1400 }
1403 #endregion Util 1401 #endregion Util
1404<<<<<<< HEAD
1405=======
1406 1402
1407 #region Web Util 1403 #region Web Util
1408 /// <summary> 1404 /// <summary>
@@ -1580,6 +1576,5 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
1580 return true; 1576 return true;
1581 } 1577 }
1582 #endregion Web Util 1578 #endregion Web Util
1583>>>>>>> avn/ubitvar
1584 } 1579 }
1585} 1580}
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 7937383..9a57599 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -154,16 +154,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
154 // Add this agent in this region as a banned person 154 // Add this agent in this region as a banned person
155 public void Add(ulong pRegionHandle, UUID pAgentID) 155 public void Add(ulong pRegionHandle, UUID pAgentID)
156 { 156 {
157<<<<<<< HEAD
158 if (!m_bannedRegions.TryGetValue(pAgentID, out m_idCache))
159 {
160 m_idCache = new ExpiringCache<ulong, DateTime>();
161 m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(45));
162 }
163 m_idCache.Add(pRegionHandle, DateTime.Now + TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));
164=======
165 this.Add(pRegionHandle, pAgentID, 45, 15); 157 this.Add(pRegionHandle, pAgentID, 45, 15);
166 } 158 }
159
167 public void Add(ulong pRegionHandle, UUID pAgentID, double newTime, double extendTime) 160 public void Add(ulong pRegionHandle, UUID pAgentID, double newTime, double extendTime)
168 { 161 {
169 if (!m_bannedRegions.TryGetValue(pAgentID, out m_idCache)) 162 if (!m_bannedRegions.TryGetValue(pAgentID, out m_idCache))
@@ -172,8 +165,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
172 m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(newTime)); 165 m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(newTime));
173 } 166 }
174 m_idCache.Add(pRegionHandle, DateTime.Now + TimeSpan.FromSeconds(extendTime), TimeSpan.FromSeconds(extendTime)); 167 m_idCache.Add(pRegionHandle, DateTime.Now + TimeSpan.FromSeconds(extendTime), TimeSpan.FromSeconds(extendTime));
175>>>>>>> avn/ubitvar
176 } 168 }
169
177 // Remove the agent from the region's banned list 170 // Remove the agent from the region's banned list
178 public void Remove(ulong pRegionHandle, UUID pAgentID) 171 public void Remove(ulong pRegionHandle, UUID pAgentID)
179 { 172 {
@@ -183,6 +176,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
183 } 176 }
184 } 177 }
185 } 178 }
179
186 private BannedRegionCache m_bannedRegionCache = new BannedRegionCache(); 180 private BannedRegionCache m_bannedRegionCache = new BannedRegionCache();
187 181
188 private IEventQueue m_eqModule; 182 private IEventQueue m_eqModule;
@@ -222,7 +216,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
222 { 216 {
223 string transferVersionName = "SIMULATION"; 217 string transferVersionName = "SIMULATION";
224 float maxTransferVersion = 0.3f; 218 float maxTransferVersion = 0.3f;
225<<<<<<< HEAD
226 219
227 IConfig hypergridConfig = source.Configs["Hypergrid"]; 220 IConfig hypergridConfig = source.Configs["Hypergrid"];
228 if (hypergridConfig != null) 221 if (hypergridConfig != null)
@@ -235,8 +228,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
235 if (m_GatekeeperURI != string.Empty && !m_GatekeeperURI.EndsWith("/")) 228 if (m_GatekeeperURI != string.Empty && !m_GatekeeperURI.EndsWith("/"))
236 m_GatekeeperURI += '/'; 229 m_GatekeeperURI += '/';
237 } 230 }
238=======
239>>>>>>> avn/ubitvar
240 231
241 IConfig transferConfig = source.Configs["EntityTransfer"]; 232 IConfig transferConfig = source.Configs["EntityTransfer"];
242 if (transferConfig != null) 233 if (transferConfig != null)
@@ -515,11 +506,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
515 506
516 // TODO: Check other Scene HeightField 507 // TODO: Check other Scene HeightField
517 posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y]; 508 posZLimit = (float)sp.Scene.Heightmap[(int)position.X, (int)position.Y];
518<<<<<<< HEAD
519=======
520 509
521 posZLimit += localHalfAVHeight + 0.1f; 510 posZLimit += localHalfAVHeight + 0.1f;
522>>>>>>> avn/ubitvar
523 511
524 if ((position.Z < posZLimit) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit))) 512 if ((position.Z < posZLimit) && !(Single.IsInfinity(posZLimit) || Single.IsNaN(posZLimit)))
525 { 513 {
@@ -622,15 +610,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
622 Util.RegionHandleToRegionLoc(regionHandle, out regX, out regY); 610 Util.RegionHandleToRegionLoc(regionHandle, out regX, out regY);
623 611
624 MapBlockData block = new MapBlockData(); 612 MapBlockData block = new MapBlockData();
625<<<<<<< HEAD
626 block.X = (ushort)regX;
627 block.Y = (ushort)regY;
628 block.Access = (byte)SimAccess.Down;
629=======
630 block.X = (ushort)(regX); 613 block.X = (ushort)(regX);
631 block.Y = (ushort)(regY); 614 block.Y = (ushort)(regY);
632 block.Access = (byte)SimAccess.Down; // == not there 615 block.Access = (byte)SimAccess.Down; // == not there
633>>>>>>> avn/ubitvar
634 616
635 List<MapBlockData> blocks = new List<MapBlockData>(); 617 List<MapBlockData> blocks = new List<MapBlockData>();
636 blocks.Add(block); 618 blocks.Add(block);
@@ -765,13 +747,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
765 return; 747 return;
766 } 748 }
767 749
768<<<<<<< HEAD
769 uint newRegionX, newRegionY, oldRegionX, oldRegionY;
770 Util.RegionHandleToRegionLoc(reg.RegionHandle, out newRegionX, out newRegionY);
771 Util.RegionHandleToRegionLoc(sp.Scene.RegionInfo.RegionHandle, out oldRegionX, out oldRegionY);
772
773=======
774>>>>>>> avn/ubitvar
775 ulong destinationHandle = finalDestination.RegionHandle; 750 ulong destinationHandle = finalDestination.RegionHandle;
776 751
777 // Let's do DNS resolution only once in this process, please! 752 // Let's do DNS resolution only once in this process, please!
@@ -794,11 +769,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
794 string version; 769 string version;
795 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); 770 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
796 if (!Scene.SimulationService.QueryAccess( 771 if (!Scene.SimulationService.QueryAccess(
797<<<<<<< HEAD
798 finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, sp.Scene.GetFormatsOffered(), out version, out reason)) 772 finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, sp.Scene.GetFormatsOffered(), out version, out reason))
799=======
800 finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, out version, out reason))
801>>>>>>> avn/ubitvar
802 { 773 {
803 sp.ControllingClient.SendTeleportFailed(reason); 774 sp.ControllingClient.SendTeleportFailed(reason);
804 775
@@ -860,12 +831,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
860 agentCircuit.Id0 = currentAgentCircuit.Id0; 831 agentCircuit.Id0 = currentAgentCircuit.Id0;
861 } 832 }
862 833
863<<<<<<< HEAD
864 // if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY))
865 float dist = (float)Math.Max(sp.Scene.DefaultDrawDistance,
866 (float)Math.Max(sp.Scene.RegionInfo.RegionSizeX, sp.Scene.RegionInfo.RegionSizeY));
867 if (NeedsNewAgent(dist, oldRegionX, newRegionX, oldRegionY, newRegionY))
868=======
869 IClientIPEndpoint ipepClient; 834 IClientIPEndpoint ipepClient;
870 835
871 uint newRegionX, newRegionY, oldRegionX, oldRegionY; 836 uint newRegionX, newRegionY, oldRegionX, oldRegionY;
@@ -880,7 +845,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
880 oldSizeX, oldSizeY, newSizeX, newSizeY); 845 oldSizeX, oldSizeY, newSizeX, newSizeY);
881 846
882 if (OutSideViewRange) 847 if (OutSideViewRange)
883>>>>>>> avn/ubitvar
884 { 848 {
885 m_log.DebugFormat( 849 m_log.DebugFormat(
886 "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}", 850 "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}",
@@ -911,11 +875,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
911 float.TryParse(versionComponents[1], out versionNumber); 875 float.TryParse(versionComponents[1], out versionNumber);
912 876
913 if (versionNumber >= 0.2f && MaxOutgoingTransferVersion >= versionNumber) 877 if (versionNumber >= 0.2f && MaxOutgoingTransferVersion >= versionNumber)
914<<<<<<< HEAD
915 TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, oldRegionX, newRegionX, oldRegionY, newRegionY, version, out reason);
916=======
917 TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange , version, out reason); 878 TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange , version, out reason);
918>>>>>>> avn/ubitvar
919 else 879 else
920 TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, version, out reason); 880 TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, version, out reason);
921 } 881 }
@@ -973,21 +933,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
973 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); 933 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring);
974 934
975 // OK, it got this agent. Let's close some child agents 935 // OK, it got this agent. Let's close some child agents
976<<<<<<< HEAD
977 sp.CloseChildAgents(newRegionX, newRegionY);
978
979 IClientIPEndpoint ipepClient;
980 string capsPath = String.Empty;
981 float dist = (float)Math.Max(sp.Scene.DefaultDrawDistance,
982 (float)Math.Max(sp.Scene.RegionInfo.RegionSizeX, sp.Scene.RegionInfo.RegionSizeY));
983 if (NeedsNewAgent(dist, oldRegionX, newRegionX, oldRegionY, newRegionY))
984 {
985 m_log.DebugFormat(
986 "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for incoming agent {3} from {4}",
987 finalDestination.RegionName, newRegionX, newRegionY, sp.Name, Scene.Name);
988=======
989>>>>>>> avn/ubitvar
990
991 936
992 if (OutSideViewRange) 937 if (OutSideViewRange)
993 { 938 {
@@ -1157,11 +1102,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1157 1102
1158 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 1103 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
1159 1104
1160<<<<<<< HEAD
1161 if (NeedsClosing(sp.Scene.DefaultDrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
1162=======
1163 if (OutSideViewRange) 1105 if (OutSideViewRange)
1164>>>>>>> avn/ubitvar
1165 { 1106 {
1166 if (!sp.Scene.IncomingPreCloseClient(sp)) 1107 if (!sp.Scene.IncomingPreCloseClient(sp))
1167 return; 1108 return;
@@ -1226,35 +1167,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1226 // Past this point we have to attempt clean up if the teleport fails, so update transfer state. 1167 // Past this point we have to attempt clean up if the teleport fails, so update transfer state.
1227 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); 1168 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring);
1228 1169
1229<<<<<<< HEAD
1230 IClientIPEndpoint ipepClient;
1231 string capsPath = String.Empty;
1232 float dist = (float)Math.Max(sp.Scene.DefaultDrawDistance,
1233 (float)Math.Max(sp.Scene.RegionInfo.RegionSizeX, sp.Scene.RegionInfo.RegionSizeY));
1234 if (NeedsNewAgent(dist, oldRegionX, newRegionX, oldRegionY, newRegionY))
1235 {
1236 m_log.DebugFormat(
1237 "[ENTITY TRANSFER MODULE]: Determined that region {0} at {1},{2} needs new child agent for agent {3} from {4}",
1238 finalDestination.RegionName, newRegionX, newRegionY, sp.Name, Scene.Name);
1239
1240 //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent...");
1241 #region IP Translation for NAT
1242 // Uses ipepClient above
1243 if (sp.ClientView.TryGet(out ipepClient))
1244 {
1245 endPoint.Address = NetworkUtil.GetIPFor(ipepClient.EndPoint, endPoint.Address);
1246 }
1247 #endregion
1248 capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
1249 }
1250 else
1251 {
1252 agentCircuit.CapsPath = sp.Scene.CapsModule.GetChildSeed(sp.UUID, reg.RegionHandle);
1253 capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
1254 }
1255
1256=======
1257>>>>>>> avn/ubitvar
1258 // We need to set this here to avoid an unlikely race condition when teleporting to a neighbour simulator, 1170 // We need to set this here to avoid an unlikely race condition when teleporting to a neighbour simulator,
1259 // where that neighbour simulator could otherwise request a child agent create on the source which then 1171 // where that neighbour simulator could otherwise request a child agent create on the source which then
1260 // closes our existing agent which is still signalled as root. 1172 // closes our existing agent which is still signalled as root.
@@ -1333,11 +1245,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1333 sp.MakeChildAgent(destinationHandle); 1245 sp.MakeChildAgent(destinationHandle);
1334 1246
1335 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 1247 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
1336<<<<<<< HEAD
1337 if (NeedsClosing(sp.Scene.DefaultDrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
1338=======
1339 if (OutSideViewRange) 1248 if (OutSideViewRange)
1340>>>>>>> avn/ubitvar
1341 { 1249 {
1342 if (!sp.Scene.IncomingPreCloseClient(sp)) 1250 if (!sp.Scene.IncomingPreCloseClient(sp))
1343 return; 1251 return;
@@ -1465,12 +1373,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1465 // This returns 'true' if the new region already has a child agent for our 1373 // This returns 'true' if the new region already has a child agent for our
1466 // incoming agent. The implication is that, if 'false', we have to create the 1374 // incoming agent. The implication is that, if 'false', we have to create the
1467 // child and then teleport into the region. 1375 // child and then teleport into the region.
1468<<<<<<< HEAD
1469 protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY)
1470=======
1471 protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, 1376 protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY,
1472 int oldsizeX, int oldsizeY, int newsizeX, int newsizeY) 1377 int oldsizeX, int oldsizeY, int newsizeX, int newsizeY)
1473>>>>>>> avn/ubitvar
1474 { 1378 {
1475 if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) 1379 if (m_regionCombinerModule != null && m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
1476 { 1380 {
@@ -1487,9 +1391,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1487 return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, 1391 return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY,
1488 oldsizeX, oldsizeY, newsizeX, newsizeY); 1392 oldsizeX, oldsizeY, newsizeX, newsizeY);
1489 } 1393 }
1490<<<<<<< HEAD
1491
1492=======
1493/* 1394/*
1494 protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, 1395 protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY,
1495 uint oldsizeX, uint oldsizeY, uint newsizeX, uint newsizeY, GridRegion reg) 1396 uint oldsizeX, uint oldsizeY, uint newsizeX, uint newsizeY, GridRegion reg)
@@ -1499,7 +1400,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1499 oldsizeX, oldsizeY, newsizeX, newsizeY); 1400 oldsizeX, oldsizeY, newsizeX, newsizeY);
1500 } 1401 }
1501*/ 1402*/
1502>>>>>>> avn/ubitvar
1503 #endregion 1403 #endregion
1504 1404
1505 #region Landmark Teleport 1405 #region Landmark Teleport
@@ -1580,82 +1480,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1580 1480
1581 #region Agent Crossings 1481 #region Agent Crossings
1582 1482
1583<<<<<<< HEAD
1584 // Given a position relative to the current region (which has previously been tested to
1585 // see that it is actually outside the current region), find the new region that the
1586 // point is actually in.
1587 // Returns the coordinates and information of the new region or 'null' of it doesn't exist.
1588 public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos,
1589 out string version, out Vector3 newpos, out string failureReason)
1590=======
1591 public bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, out string version, out string reason) 1483 public bool checkAgentAccessToRegion(ScenePresence agent, GridRegion destiny, Vector3 position, out string version, out string reason)
1592>>>>>>> avn/ubitvar
1593 { 1484 {
1594 reason = String.Empty; 1485 reason = String.Empty;
1595 version = String.Empty; 1486 version = String.Empty;
1596<<<<<<< HEAD
1597 newpos = pos;
1598 failureReason = string.Empty;
1599 string homeURI = scene.GetAgentHomeURI(agentID);
1600
1601// m_log.DebugFormat(
1602// "[ENTITY TRANSFER MODULE]: Crossing agent {0} at pos {1} in {2}", agent.Name, pos, scene.Name);
1603
1604 // Compute world location of the object's position
1605 double presenceWorldX = (double)scene.RegionInfo.WorldLocX + pos.X;
1606 double presenceWorldY = (double)scene.RegionInfo.WorldLocY + pos.Y;
1607
1608 // Call the grid service to lookup the region containing the new position.
1609 GridRegion neighbourRegion = GetRegionContainingWorldLocation(scene.GridService, scene.RegionInfo.ScopeID,
1610 presenceWorldX, presenceWorldY,
1611 Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY));
1612
1613 if (neighbourRegion != null)
1614 {
1615 // Compute the entity's position relative to the new region
1616 newpos = new Vector3((float)(presenceWorldX - (double)neighbourRegion.RegionLocX),
1617 (float)(presenceWorldY - (double)neighbourRegion.RegionLocY),
1618 pos.Z);
1619
1620 if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID))
1621 {
1622 failureReason = "Cannot region cross into banned parcel";
1623 neighbourRegion = null;
1624 }
1625 else
1626 {
1627 // If not banned, make sure this agent is not in the list.
1628 m_bannedRegionCache.Remove(neighbourRegion.RegionHandle, agentID);
1629 }
1630
1631 // Check to see if we have access to the target region.
1632 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
1633 if (neighbourRegion != null
1634 && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, myversion, scene.GetFormatsOffered(), out version, out failureReason))
1635 {
1636 // remember banned
1637 m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
1638 neighbourRegion = null;
1639 }
1640 }
1641 else
1642 {
1643 // The destination region just doesn't exist
1644 failureReason = "Cannot cross into non-existent region";
1645 }
1646
1647 if (neighbourRegion == null)
1648 m_log.DebugFormat("{0} GetDestination: region not found. Old region name={1} at <{2},{3}> of size <{4},{5}>. Old pos={6}",
1649 LogHeader, scene.RegionInfo.RegionName,
1650 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY,
1651 scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY,
1652 pos);
1653 else
1654 m_log.DebugFormat("{0} GetDestination: new region={1} at <{2},{3}> of size <{4},{5}>, newpos=<{6},{7}>",
1655 LogHeader, neighbourRegion.RegionName,
1656 neighbourRegion.RegionLocX, neighbourRegion.RegionLocY, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY,
1657 newpos.X, newpos.Y);
1658=======
1659 1487
1660 UUID agentID = agent.UUID; 1488 UUID agentID = agent.UUID;
1661 ulong destinyHandle = destiny.RegionHandle; 1489 ulong destinyHandle = destiny.RegionHandle;
@@ -1672,7 +1500,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1672 1500
1673 1501
1674 if (!ascene.SimulationService.QueryAccess(destiny, agentID, homeURI, false, position, 1502 if (!ascene.SimulationService.QueryAccess(destiny, agentID, homeURI, false, position,
1675 myversion, out version, out reason)) 1503 myversion, agent.Scene.GetFormatsOffered(), out version, out reason))
1676 { 1504 {
1677 m_bannedRegionCache.Add(destinyHandle, agentID, 30.0, 30.0); 1505 m_bannedRegionCache.Add(destinyHandle, agentID, 30.0, 30.0);
1678 return false; 1506 return false;
@@ -1735,7 +1563,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1735 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); 1563 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
1736 string homeURI = scene.GetAgentHomeURI(agentID); 1564 string homeURI = scene.GetAgentHomeURI(agentID);
1737 if (neighbourRegion != null 1565 if (neighbourRegion != null
1738 && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, myversion, out version, out failureReason)) 1566 && !scene.SimulationService.QueryAccess(
1567 neighbourRegion, agentID, homeURI, false, newpos, myversion,
1568 new List<UUID>(), out version, out failureReason))
1739 { 1569 {
1740 // remember banned 1570 // remember banned
1741 m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); 1571 m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
@@ -1747,7 +1577,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1747 // The destination region just doesn't exist 1577 // The destination region just doesn't exist
1748 failureReason = "Cannot cross into non-existent region"; 1578 failureReason = "Cannot cross into non-existent region";
1749 } 1579 }
1750>>>>>>> avn/ubitvar
1751 1580
1752 if (neighbourRegion == null) 1581 if (neighbourRegion == null)
1753 m_log.DebugFormat("{0} GetDestination: region not found. Old region name={1} at <{2},{3}> of size <{4},{5}>. Old pos={6}", 1582 m_log.DebugFormat("{0} GetDestination: region not found. Old region name={1} at <{2},{3}> of size <{4},{5}>. Old pos={6}",
@@ -1766,8 +1595,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1766 1595
1767 public bool Cross(ScenePresence agent, bool isFlying) 1596 public bool Cross(ScenePresence agent, bool isFlying)
1768 { 1597 {
1769<<<<<<< HEAD
1770=======
1771 agent.IsInTransit = true; 1598 agent.IsInTransit = true;
1772 CrossAsyncDelegate d = CrossAsync; 1599 CrossAsyncDelegate d = CrossAsync;
1773 d.BeginInvoke(agent, isFlying, CrossCompleted, d); 1600 d.BeginInvoke(agent, isFlying, CrossCompleted, d);
@@ -1793,19 +1620,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1793 { 1620 {
1794 uint x; 1621 uint x;
1795 uint y; 1622 uint y;
1796>>>>>>> avn/ubitvar
1797 Vector3 newpos; 1623 Vector3 newpos;
1798 string version; 1624 string version;
1799 string failureReason; 1625 string failureReason;
1800 1626
1801<<<<<<< HEAD
1802 GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, agent.AbsolutePosition,
1803 out version, out newpos, out failureReason);
1804 if (neighbourRegion == null)
1805 {
1806 agent.ControllingClient.SendAlertMessage(failureReason);
1807 return false;
1808=======
1809 Vector3 pos = agent.AbsolutePosition + agent.Velocity; 1627 Vector3 pos = agent.AbsolutePosition + agent.Velocity;
1810 1628
1811 GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, pos, 1629 GridRegion neighbourRegion = GetDestination(agent.Scene, agent.UUID, pos,
@@ -1815,23 +1633,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1815 if (failureReason != String.Empty) 1633 if (failureReason != String.Empty)
1816 agent.ControllingClient.SendAlertMessage(failureReason); 1634 agent.ControllingClient.SendAlertMessage(failureReason);
1817 return agent; 1635 return agent;
1818>>>>>>> avn/ubitvar
1819 } 1636 }
1820 1637
1821// agent.IsInTransit = true; 1638// agent.IsInTransit = true;
1822 1639
1823<<<<<<< HEAD
1824 Scene.EventManager.TriggerCrossAgentToNewRegion(agent, isFlying, neighbourRegion);
1825
1826 return true;
1827=======
1828 CrossAgentToNewRegionAsync(agent, newpos, neighbourRegion, isFlying, version); 1640 CrossAgentToNewRegionAsync(agent, newpos, neighbourRegion, isFlying, version);
1829 agent.IsInTransit = false; 1641 agent.IsInTransit = false;
1830 return agent; 1642 return agent;
1831>>>>>>> avn/ubitvar
1832 } 1643 }
1833 1644
1834
1835 public delegate void InformClientToInitiateTeleportToLocationDelegate(ScenePresence agent, uint regionX, uint regionY, 1645 public delegate void InformClientToInitiateTeleportToLocationDelegate(ScenePresence agent, uint regionX, uint regionY,
1836 Vector3 position, 1646 Vector3 position,
1837 Scene initiatingScene); 1647 Scene initiatingScene);
@@ -1958,10 +1768,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1958 { 1768 {
1959 AgentData cAgent = new AgentData(); 1769 AgentData cAgent = new AgentData();
1960 agent.CopyTo(cAgent); 1770 agent.CopyTo(cAgent);
1961<<<<<<< HEAD
1962 cAgent.Position = pos;
1963
1964=======
1965 1771
1966// agent.Appearance.WearableCacheItems = null; 1772// agent.Appearance.WearableCacheItems = null;
1967 1773
@@ -1969,7 +1775,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1969 1775
1970 cAgent.ChildrenCapSeeds = agent.KnownRegions; 1776 cAgent.ChildrenCapSeeds = agent.KnownRegions;
1971 1777
1972>>>>>>> avn/ubitvar
1973 if (isFlying) 1778 if (isFlying)
1974 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; 1779 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
1975 1780
@@ -2048,25 +1853,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2048 capsPath); 1853 capsPath);
2049 } 1854 }
2050 1855
2051<<<<<<< HEAD
2052 // SUCCESS!
2053 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination);
2054
2055 // Unlike a teleport, here we do not wait for the destination region to confirm the receipt.
2056 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
2057
2058 agent.MakeChildAgent();
2059
2060 // FIXME: Possibly this should occur lower down after other commands to close other agents,
2061 // but not sure yet what the side effects would be.
2062 m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
2063
2064 // now we have a child agent in this region. Request all interesting data about other (root) agents
2065 agent.SendOtherAgentsAvatarDataToClient();
2066 agent.SendOtherAgentsAppearanceToClient();
2067
2068=======
2069>>>>>>> avn/ubitvar
2070 // Backwards compatibility. Best effort 1856 // Backwards compatibility. Best effort
2071 if (version == "Unknown" || version == string.Empty) 1857 if (version == "Unknown" || version == string.Empty)
2072 { 1858 {
@@ -2075,12 +1861,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2075 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); 1861 CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true);
2076 } 1862 }
2077 1863
2078<<<<<<< HEAD
2079 // Next, let's close the child agent connections that are too far away.
2080 uint neighbourx;
2081 uint neighboury;
2082 Util.RegionHandleToRegionLoc(neighbourRegion.RegionHandle, out neighbourx, out neighboury);
2083=======
2084 // SUCCESS! 1864 // SUCCESS!
2085 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination); 1865 m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.ReceivedAtDestination);
2086 1866
@@ -2096,7 +1876,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2096 // FIXME: Possibly this should occur lower down after other commands to close other agents, 1876 // FIXME: Possibly this should occur lower down after other commands to close other agents,
2097 // but not sure yet what the side effects would be. 1877 // but not sure yet what the side effects would be.
2098 m_entityTransferStateMachine.ResetFromTransit(agent.UUID); 1878 m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
2099>>>>>>> avn/ubitvar
2100 1879
2101 agent.CloseChildAgents(neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY); 1880 agent.CloseChildAgents(neighbourRegion.RegionHandle, neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY);
2102 1881
@@ -2177,24 +1956,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2177 1956
2178 seeds.Add(regionhandler, agent.CapsPath); 1957 seeds.Add(regionhandler, agent.CapsPath);
2179 1958
2180<<<<<<< HEAD
2181 sp.AddNeighbourRegion(region.RegionHandle, agent.CapsPath);
2182 //foreach (ulong h in agent.ChildrenCapSeeds.Keys)
2183 // m_log.DebugFormat("[XXX] --> {0}", h);
2184 //m_log.DebugFormat("[XXX] Adding {0}", region.RegionHandle);
2185 if (agent.ChildrenCapSeeds.ContainsKey(region.RegionHandle))
2186 {
2187 m_log.WarnFormat(
2188 "[ENTITY TRANSFER]: Overwriting caps seed {0} with {1} for region {2} (handle {3}) for {4} in {5}",
2189 agent.ChildrenCapSeeds[region.RegionHandle], agent.CapsPath,
2190 region.RegionName, region.RegionHandle, sp.Name, Scene.Name);
2191 }
2192 1959
2193 agent.ChildrenCapSeeds[region.RegionHandle] = agent.CapsPath;
2194=======
2195// agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds); 1960// agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds);
2196 agent.ChildrenCapSeeds = null; 1961 agent.ChildrenCapSeeds = null;
2197>>>>>>> avn/ubitvar
2198 1962
2199 if (sp.Scene.CapsModule != null) 1963 if (sp.Scene.CapsModule != null)
2200 { 1964 {
@@ -2278,11 +2042,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2278 2042
2279 if (m_regionInfo != null) 2043 if (m_regionInfo != null)
2280 { 2044 {
2281<<<<<<< HEAD
2282 neighbours = GetNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
2283=======
2284 neighbours = GetNeighbors(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); 2045 neighbours = GetNeighbors(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
2285>>>>>>> avn/ubitvar
2286 } 2046 }
2287 else 2047 else
2288 { 2048 {
@@ -2531,127 +2291,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2531 #endregion // NotFoundLocationCache class 2291 #endregion // NotFoundLocationCache class
2532 private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache(); 2292 private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache();
2533 2293
2534<<<<<<< HEAD
2535 // Computes the difference between two region bases.
2536 // Returns a vector of world coordinates (meters) from base of first region to the second.
2537 // The first region is the home region of the passed scene presence.
2538 Vector3 CalculateOffset(ScenePresence sp, GridRegion neighbour)
2539 {
2540 /*
2541 int rRegionX = (int)sp.Scene.RegionInfo.LegacyRegionLocX;
2542 int rRegionY = (int)sp.Scene.RegionInfo.LegacyRegionLocY;
2543 int tRegionX = neighbour.RegionLocX / (int)Constants.RegionSize;
2544 int tRegionY = neighbour.RegionLocY / (int)Constants.RegionSize;
2545 int shiftx = (rRegionX - tRegionX) * (int)Constants.RegionSize;
2546 int shifty = (rRegionY - tRegionY) * (int)Constants.RegionSize;
2547 return new Vector3(shiftx, shifty, 0f);
2548 */
2549 return new Vector3( sp.Scene.RegionInfo.WorldLocX - neighbour.RegionLocX,
2550 sp.Scene.RegionInfo.WorldLocY - neighbour.RegionLocY,
2551 0f);
2552 }
2553
2554 public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py)
2555 {
2556 // Since we don't know how big the regions could be, we have to search a very large area
2557 // to find possible regions.
2558 return GetRegionContainingWorldLocation(pGridService, pScopeID, px, py, Constants.MaximumRegionSize);
2559 }
2560
2561 #region NotFoundLocationCache class
2562 // A collection of not found locations to make future lookups 'not found' lookups quick.
2563 // A simple expiring cache that keeps not found locations for some number of seconds.
2564 // A 'not found' location is presumed to be anywhere in the minimum sized region that
2565 // contains that point. A conservitive estimate.
2566 private class NotFoundLocationCache
2567 {
2568 private struct NotFoundLocation
2569 {
2570 public double minX, maxX, minY, maxY;
2571 public DateTime expireTime;
2572 }
2573 private List<NotFoundLocation> m_notFoundLocations = new List<NotFoundLocation>();
2574 public NotFoundLocationCache()
2575 {
2576 }
2577 // Add an area to the list of 'not found' places. The area is the snapped region
2578 // area around the added point.
2579 public void Add(double pX, double pY)
2580 {
2581 lock (m_notFoundLocations)
2582 {
2583 if (!LockedContains(pX, pY))
2584 {
2585 NotFoundLocation nfl = new NotFoundLocation();
2586 // A not found location is not found for at least a whole region sized area
2587 nfl.minX = pX - (pX % (double)Constants.RegionSize);
2588 nfl.minY = pY - (pY % (double)Constants.RegionSize);
2589 nfl.maxX = nfl.minX + (double)Constants.RegionSize;
2590 nfl.maxY = nfl.minY + (double)Constants.RegionSize;
2591 nfl.expireTime = DateTime.Now + TimeSpan.FromSeconds(30);
2592 m_notFoundLocations.Add(nfl);
2593 }
2594 }
2595
2596 }
2597 // Test to see of this point is in any of the 'not found' areas.
2598 // Return 'true' if the point is found inside the 'not found' areas.
2599 public bool Contains(double pX, double pY)
2600 {
2601 bool ret = false;
2602 lock (m_notFoundLocations)
2603 ret = LockedContains(pX, pY);
2604 return ret;
2605 }
2606 private bool LockedContains(double pX, double pY)
2607 {
2608 bool ret = false;
2609 this.DoExpiration();
2610 foreach (NotFoundLocation nfl in m_notFoundLocations)
2611 {
2612 if (pX >= nfl.minX && pX < nfl.maxX && pY >= nfl.minY && pY < nfl.maxY)
2613 {
2614 ret = true;
2615 break;
2616 }
2617 }
2618 return ret;
2619 }
2620 private void DoExpiration()
2621 {
2622 List<NotFoundLocation> m_toRemove = null;
2623 DateTime now = DateTime.Now;
2624 foreach (NotFoundLocation nfl in m_notFoundLocations)
2625 {
2626 if (nfl.expireTime < now)
2627 {
2628 if (m_toRemove == null)
2629 m_toRemove = new List<NotFoundLocation>();
2630 m_toRemove.Add(nfl);
2631 }
2632 }
2633 if (m_toRemove != null)
2634 {
2635 foreach (NotFoundLocation nfl in m_toRemove)
2636 m_notFoundLocations.Remove(nfl);
2637 m_toRemove.Clear();
2638 }
2639 }
2640 }
2641 #endregion // NotFoundLocationCache class
2642 private NotFoundLocationCache m_notFoundLocationCache = new NotFoundLocationCache();
2643
2644 // Given a world position (fractional meter coordinate), get the GridRegion info for
2645 // the region containing that point.
2646 // Someday this should be a method on GridService.
2647 // 'pSizeHint' is the size of the source region but since the destination point can be anywhere
2648 // the size of the target region is unknown thus the search area might have to be very large.
2649 // Return 'null' if no such region exists.
2650 public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID,
2651 double px, double py, uint pSizeHint)
2652 {
2653 m_log.DebugFormat("{0} GetRegionContainingWorldLocation: query, loc=<{1},{2}>", LogHeader, px, py);
2654=======
2655// needed for current OSG or old grid code 2294// needed for current OSG or old grid code
2656 2295
2657 public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py) 2296 public GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py)
@@ -2671,7 +2310,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2671 double px, double py, uint pSizeHint) 2310 double px, double py, uint pSizeHint)
2672 { 2311 {
2673 m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py); 2312 m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py);
2674>>>>>>> avn/ubitvar
2675 GridRegion ret = null; 2313 GridRegion ret = null;
2676 const double fudge = 2.0; 2314 const double fudge = 2.0;
2677 2315
@@ -2765,13 +2403,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2765 IPEndPoint endPoint, bool newAgent) 2403 IPEndPoint endPoint, bool newAgent)
2766 { 2404 {
2767 2405
2768<<<<<<< HEAD
2769 Scene scene = sp.Scene;
2770
2771 m_log.DebugFormat(
2772 "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})",
2773 sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY);
2774=======
2775 if (newAgent) 2406 if (newAgent)
2776 { 2407 {
2777 Scene scene = sp.Scene; 2408 Scene scene = sp.Scene;
@@ -2779,17 +2410,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2779 m_log.DebugFormat( 2410 m_log.DebugFormat(
2780 "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", 2411 "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})",
2781 sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY); 2412 sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY);
2782>>>>>>> avn/ubitvar
2783 2413
2784 string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); 2414 string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath);
2785 2415
2786 string reason = String.Empty; 2416 string reason = String.Empty;
2787 2417
2788<<<<<<< HEAD 2418 bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, a, (uint)TeleportFlags.Default, out reason);
2789 bool regionAccepted = scene.SimulationService.CreateAgent(null, reg, a, (uint)TeleportFlags.Default, out reason);
2790=======
2791 bool regionAccepted = scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason);
2792>>>>>>> avn/ubitvar
2793 2419
2794 if (regionAccepted) 2420 if (regionAccepted)
2795 { 2421 {
@@ -2848,10 +2474,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2848 extent.Y = (float)Util.WorldToRegionLoc((uint)megaRegionSize.Y); 2474 extent.Y = (float)Util.WorldToRegionLoc((uint)megaRegionSize.Y);
2849 } 2475 }
2850 2476
2851<<<<<<< HEAD
2852=======
2853
2854>>>>>>> avn/ubitvar
2855 swCorner.X = Scene.RegionInfo.RegionLocX - 1; 2477 swCorner.X = Scene.RegionInfo.RegionLocX - 1;
2856 swCorner.Y = Scene.RegionInfo.RegionLocY - 1; 2478 swCorner.Y = Scene.RegionInfo.RegionLocY - 1;
2857 neCorner.X = Scene.RegionInfo.RegionLocX + extent.X; 2479 neCorner.X = Scene.RegionInfo.RegionLocX + extent.X;
@@ -2865,11 +2487,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2865 /// <param name="pRegionLocX"></param> 2487 /// <param name="pRegionLocX"></param>
2866 /// <param name="pRegionLocY"></param> 2488 /// <param name="pRegionLocY"></param>
2867 /// <returns></returns> 2489 /// <returns></returns>
2868<<<<<<< HEAD
2869 protected List<GridRegion> GetNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY)
2870=======
2871 protected List<GridRegion> GetNeighbors(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY) 2490 protected List<GridRegion> GetNeighbors(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY)
2872>>>>>>> avn/ubitvar
2873 { 2491 {
2874 Scene pScene = avatar.Scene; 2492 Scene pScene = avatar.Scene;
2875 RegionInfo m_regionInfo = pScene.RegionInfo; 2493 RegionInfo m_regionInfo = pScene.RegionInfo;
@@ -2880,22 +2498,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2880 // view to include everything in the megaregion 2498 // view to include everything in the megaregion
2881 if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID)) 2499 if (m_regionCombinerModule == null || !m_regionCombinerModule.IsRootForMegaregion(Scene.RegionInfo.RegionID))
2882 { 2500 {
2883<<<<<<< HEAD
2884 // The area to check is as big as the current region.
2885 // We presume all adjacent regions are the same size as this region.
2886 uint dd = Math.Max((uint)avatar.Scene.DefaultDrawDistance,
2887 Math.Max(Scene.RegionInfo.RegionSizeX, Scene.RegionInfo.RegionSizeY));
2888
2889 uint startX = Util.RegionToWorldLoc(pRegionLocX) - dd + Constants.RegionSize/2;
2890 uint startY = Util.RegionToWorldLoc(pRegionLocY) - dd + Constants.RegionSize/2;
2891
2892 uint endX = Util.RegionToWorldLoc(pRegionLocX) + dd + Constants.RegionSize/2;
2893 uint endY = Util.RegionToWorldLoc(pRegionLocY) + dd + Constants.RegionSize/2;
2894
2895 neighbours
2896 = avatar.Scene.GridService.GetRegionRange(
2897 m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY);
2898=======
2899 uint dd = (uint)avatar.DrawDistance; 2501 uint dd = (uint)avatar.DrawDistance;
2900 2502
2901 // until avatar movement updates client connections, we need to seend at least this current region imediate Neighbors 2503 // until avatar movement updates client connections, we need to seend at least this current region imediate Neighbors
@@ -2919,8 +2521,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2919 neighbours 2521 neighbours
2920 = avatar.Scene.GridService.GetRegionRange( 2522 = avatar.Scene.GridService.GetRegionRange(
2921 m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY); 2523 m_regionInfo.ScopeID, (int)startX, (int)endX, (int)startY, (int)endY);
2922
2923>>>>>>> avn/ubitvar
2924 } 2524 }
2925 else 2525 else
2926 { 2526 {
@@ -2934,24 +2534,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
2934 (int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y)); 2534 (int)Util.RegionToWorldLoc((uint)swCorner.Y), (int)Util.RegionToWorldLoc((uint)neCorner.Y));
2935 } 2535 }
2936 2536
2937<<<<<<< HEAD
2938// neighbours.ForEach(
2939// n =>
2940// m_log.DebugFormat(
2941// "[ENTITY TRANSFER MODULE]: Region flags for {0} as seen by {1} are {2}",
2942// n.RegionName, Scene.Name, n.RegionFlags != null ? n.RegionFlags.ToString() : "not present"));
2943
2944 // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1).
2945 neighbours.RemoveAll(
2946 r =>
2947 r.RegionID == m_regionInfo.RegionID
2948 || (r.RegionFlags != null && (r.RegionFlags & OpenSim.Framework.RegionFlags.RegionOnline) == 0));
2949
2950=======
2951 // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1). 2537 // The r.RegionFlags == null check only needs to be made for simulators before 2015-01-14 (pre 0.8.1).
2952 neighbours.RemoveAll( r => r.RegionID == m_regionInfo.RegionID ); 2538 neighbours.RemoveAll( r => r.RegionID == m_regionInfo.RegionID );
2953 2539
2954>>>>>>> avn/ubitvar
2955 return neighbours; 2540 return neighbours;
2956 } 2541 }
2957 #endregion 2542 #endregion
@@ -3036,23 +2621,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
3036 if (scene == null) 2621 if (scene == null)
3037 return; 2622 return;
3038 2623
3039<<<<<<< HEAD
3040 if (grp.RootPart.DIE_AT_EDGE)
3041 {
3042 // We remove the object here
3043 try
3044 {
3045 scene.DeleteSceneObject(grp, false);
3046 }
3047 catch (Exception)
3048 {
3049 m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border.");
3050 }
3051 return;
3052 }
3053
3054=======
3055>>>>>>> avn/ubitvar
3056 // Remember the old group position in case the region lookup fails so position can be restored. 2624 // Remember the old group position in case the region lookup fails so position can be restored.
3057 Vector3 oldGroupPosition = grp.RootPart.GroupPosition; 2625 Vector3 oldGroupPosition = grp.RootPart.GroupPosition;
3058 2626
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 233b251..5ec688c 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -434,14 +434,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
434 // return base.UpdateAgent(reg, finalDestination, agentData, sp); 434 // return base.UpdateAgent(reg, finalDestination, agentData, sp);
435 //} 435 //}
436 436
437<<<<<<< HEAD
438 public override void TriggerTeleportHome(UUID id, IClientAPI client)
439 {
440 TeleportHome(id, client);
441 }
442 437
443=======
444>>>>>>> avn/ubitvar
445 public override bool TeleportHome(UUID id, IClientAPI client) 438 public override bool TeleportHome(UUID id, IClientAPI client)
446 { 439 {
447 m_log.DebugFormat( 440 m_log.DebugFormat(
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index dff9126..96f1198 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -207,17 +207,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
207 { 207 {
208 byte[] data = null; 208 byte[] data = null;
209 209
210<<<<<<< HEAD
211 AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId);
212 m_Scene.AssetService.Store(asset);
213 m_Scene.CreateNewInventoryItem(
214 remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
215 name, description, 0, callbackID, asset.FullID, asset.Type, invType, nextOwnerMask, creationDate);
216 }
217 else
218=======
219 if (invType == (sbyte)InventoryType.Landmark && presence != null) 210 if (invType == (sbyte)InventoryType.Landmark && presence != null)
220>>>>>>> avn/ubitvar
221 { 211 {
222 string suffix = string.Empty, prefix = string.Empty; 212 string suffix = string.Empty, prefix = string.Empty;
223 string strdata = GenerateLandmark(presence, out prefix, out suffix); 213 string strdata = GenerateLandmark(presence, out prefix, out suffix);
@@ -229,8 +219,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
229 AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId); 219 AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId);
230 m_Scene.AssetService.Store(asset); 220 m_Scene.AssetService.Store(asset);
231 m_Scene.CreateNewInventoryItem( 221 m_Scene.CreateNewInventoryItem(
232 remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, 222 remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
233 name, description, 0, callbackID, asset, invType, nextOwnerMask, creationDate,transactionID); 223 name, description, 0, callbackID, asset.FullID, asset.Type, invType, nextOwnerMask, creationDate);
234 } 224 }
235 else 225 else
236 { 226 {
@@ -420,26 +410,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
420 { 410 {
421 if (objectGroup.RootPart.KeyframeMotion != null) 411 if (objectGroup.RootPart.KeyframeMotion != null)
422 { 412 {
423<<<<<<< HEAD
424 objectGroup.RootPart.KeyframeMotion.Pause();
425 group2Keyframe.Add(objectGroup, objectGroup.RootPart.KeyframeMotion);
426 objectGroup.RootPart.KeyframeMotion = null;
427 }
428
429// Vector3 inventoryStoredPosition = new Vector3
430// (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize)
431// ? 250
432// : objectGroup.AbsolutePosition.X)
433// ,
434// (objectGroup.AbsolutePosition.Y > (int)Constants.RegionSize)
435// ? 250
436// : objectGroup.AbsolutePosition.Y,
437// objectGroup.AbsolutePosition.Z);
438//
439// originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition;
440//
441// objectGroup.AbsolutePosition = inventoryStoredPosition;
442=======
443 objectGroup.RootPart.KeyframeMotion.Suspend(); 413 objectGroup.RootPart.KeyframeMotion.Suspend();
444 } 414 }
445 objectGroup.RootPart.SetForce(Vector3.Zero); 415 objectGroup.RootPart.SetForce(Vector3.Zero);
@@ -480,7 +450,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
480 450
481 objectGroup.AbsolutePosition = inventoryStoredPosition; 451 objectGroup.AbsolutePosition = inventoryStoredPosition;
482 objectGroup.RootPart.RotationOffset = inventoryStoredRotation; 452 objectGroup.RootPart.RotationOffset = inventoryStoredRotation;
483>>>>>>> avn/ubitvar
484 453
485 // Make sure all bits but the ones we want are clear 454 // Make sure all bits but the ones we want are clear
486 // on take. 455 // on take.
@@ -626,6 +595,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
626 IClientAPI remoteClient) 595 IClientAPI remoteClient)
627 { 596 {
628 uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7; 597 uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7;
598 uint allObjectsNextOwnerPerms = 0x7fffffff;
599
629 // For the porposes of inventory, an object is modify if the prims 600 // For the porposes of inventory, an object is modify if the prims
630 // are modify. This allows renaming an object that contains no 601 // are modify. This allows renaming an object that contains no
631 // mod items. 602 // mod items.
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index a536757..7d0c47f 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -336,8 +336,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
336 } 336 }
337 } 337 }
338 338
339<<<<<<< HEAD
340=======
341 /// <summary> 339 /// <summary>
342 /// 340 ///
343 /// </summary> 341 /// </summary>
@@ -433,7 +431,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
433 } 431 }
434 } 432 }
435 433
436>>>>>>> avn/ubitvar 434
437 #region IUserManagement 435 #region IUserManagement
438 436
439 public UUID GetUserIdByName(string name) 437 public UUID GetUserIdByName(string name)
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index 235fbbb..c0faad8 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -358,9 +358,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
358 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); 358 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
359 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); 359 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
360 360
361<<<<<<< HEAD 361
362 m_outboundUrlFilter = new OutboundUrlFilter("Script HTTP request module", config); 362 m_outboundUrlFilter = new OutboundUrlFilter("Script HTTP request module", config);
363=======
364 int maxThreads = 15; 363 int maxThreads = 15;
365 364
366 IConfig httpConfig = config.Configs["HttpRequestModule"]; 365 IConfig httpConfig = config.Configs["HttpRequestModule"];
@@ -368,7 +367,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
368 { 367 {
369 maxThreads = httpConfig.GetInt("MaxPoolThreads", maxThreads); 368 maxThreads = httpConfig.GetInt("MaxPoolThreads", maxThreads);
370 } 369 }
371>>>>>>> avn/ubitvar
372 370
373 m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); 371 m_pendingRequests = new Dictionary<UUID, HttpRequestClass>();
374 372
@@ -532,16 +530,12 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
532 530
533 try 531 try
534 { 532 {
535<<<<<<< HEAD
536 Request = (HttpWebRequest)WebRequest.Create(Url); 533 Request = (HttpWebRequest)WebRequest.Create(Url);
537 Request.AllowAutoRedirect = false; 534 Request.AllowAutoRedirect = false;
538=======
539 Request = (HttpWebRequest) WebRequest.Create(Url);
540 535
541 //This works around some buggy HTTP Servers like Lighttpd 536 //This works around some buggy HTTP Servers like Lighttpd
542 Request.ServicePoint.Expect100Continue = false; 537 Request.ServicePoint.Expect100Continue = false;
543 538
544>>>>>>> avn/ubitvar
545 Request.Method = HttpMethod; 539 Request.Method = HttpMethod;
546 Request.ContentType = HttpMIMEType; 540 Request.ContentType = HttpMIMEType;
547 541
@@ -646,7 +640,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
646 { 640 {
647 using (Stream responseStream = webRsp.GetResponseStream()) 641 using (Stream responseStream = webRsp.GetResponseStream())
648 { 642 {
649 ResponseBody = responseStream.GetStreamString(); 643 using (StreamReader reader = new StreamReader(responseStream))
644 ResponseBody = reader.ReadToEnd();
650 } 645 }
651 } 646 }
652 catch 647 catch
@@ -676,7 +671,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
676 resStream.Close(); 671 resStream.Close();
677 if (response != null) 672 if (response != null)
678 response.Close(); 673 response.Close();
679<<<<<<< HEAD
680 674
681 // We need to resubmit 675 // We need to resubmit
682 if ( 676 if (
@@ -724,8 +718,6 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
724 { 718 {
725 _finished = true; 719 _finished = true;
726 } 720 }
727=======
728>>>>>>> avn/ubitvar
729 } 721 }
730 722
731 if (ResponseBody == null) 723 if (ResponseBody == null)
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
index 1c3a714..93a4f09 100644
--- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
@@ -380,28 +380,13 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
380 380
381 if (sp != null) 381 if (sp != null)
382 { 382 {
383<<<<<<< HEAD 383 // Send message to avatar
384 // ignore if a child agent this is restricted to inside one
385 // region
386 if (sp.IsChildAgent)
387 return;
388
389 // Channel zero only goes to the avatar
390 // non zero channel messages only go to the attachments of the avatar.
391 if (channel != 0)
392 {
393 List<SceneObjectGroup> attachments = sp.GetAttachments();
394 if (attachments.Count == 0)
395 return;
396=======
397 // Send message to avatar
398 if (channel == 0) 384 if (channel == 0)
399 { 385 {
400 // Channel 0 goes to viewer ONLY 386 // Channel 0 goes to viewer ONLY
401 m_scene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, target, false, false); 387 m_scene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Broadcast, 0, pos, name, id, target, false, false);
402 return true; 388 return true;
403 } 389 }
404>>>>>>> avn/ubitvar
405 390
406 List<SceneObjectGroup> attachments = sp.GetAttachments(); 391 List<SceneObjectGroup> attachments = sp.GetAttachments();
407 392
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
index d786c80..db3f900 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
@@ -53,11 +53,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
53 /// </remarks> 53 /// </remarks>
54 54
55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapImageServiceModule")] 55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapImageServiceModule")]
56<<<<<<< HEAD 56
57 public class MapImageServiceModule : IMapImageUploadModule, ISharedRegionModule 57 public class MapImageServiceModule : IMapImageUploadModule, ISharedRegionModule
58=======
59 public class MapImageServiceModule : ISharedRegionModule, IMapImageUploadModule
60>>>>>>> avn/ubitvar
61 { 58 {
62 private static readonly ILog m_log = 59 private static readonly ILog m_log =
63 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 60 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -97,13 +94,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
97 if (config == null) 94 if (config == null)
98 return; 95 return;
99 96
100<<<<<<< HEAD
101 int refreshminutes = Convert.ToInt32(config.GetString("RefreshTime"));
102
103 // if refresh is less than zero, disable the module
104=======
105 int refreshminutes = Convert.ToInt32(config.GetString("RefreshTime", "-1")); 97 int refreshminutes = Convert.ToInt32(config.GetString("RefreshTime", "-1"));
106>>>>>>> avn/ubitvar
107 if (refreshminutes < 0) 98 if (refreshminutes < 0)
108 { 99 {
109 m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Negative refresh time given in config. Module disabled."); 100 m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Negative refresh time given in config. Module disabled.");
@@ -136,19 +127,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
136 m_refreshTimer.Interval = m_refreshtime; 127 m_refreshTimer.Interval = m_refreshtime;
137 m_refreshTimer.Elapsed += new ElapsedEventHandler(HandleMaptileRefresh); 128 m_refreshTimer.Elapsed += new ElapsedEventHandler(HandleMaptileRefresh);
138 129
139<<<<<<< HEAD
140 m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with refresh time {0} min and service object {1}",
141=======
142 if (m_refreshtime > 0)
143 {
144 m_refreshTimer.Enabled = true;
145 m_refreshTimer.AutoReset = true;
146 m_refreshTimer.Interval = m_refreshtime;
147 m_refreshTimer.Elapsed += new ElapsedEventHandler(HandleMaptileRefresh);
148 }
149 130
150 m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with refresh time {0} min and service object {1}", 131 m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with refresh time {0} min and service object {1}",
151>>>>>>> avn/ubitvar
152 refreshminutes, service); 132 refreshminutes, service);
153 } 133 }
154 else 134 else
@@ -174,10 +154,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
174 // v2 Map generation on startup is now handled by scene to allow bmp to be shared with 154 // v2 Map generation on startup is now handled by scene to allow bmp to be shared with
175 // v1 service and not generate map tiles twice as was previous behavior 155 // v1 service and not generate map tiles twice as was previous behavior
176 //scene.EventManager.OnRegionReadyStatusChange += s => { if (s.Ready) UploadMapTile(s); }; 156 //scene.EventManager.OnRegionReadyStatusChange += s => { if (s.Ready) UploadMapTile(s); };
177<<<<<<< HEAD
178 157
179=======
180>>>>>>> avn/ubitvar
181 scene.RegisterModuleInterface<IMapImageUploadModule>(this); 158 scene.RegisterModuleInterface<IMapImageUploadModule>(this);
182 } 159 }
183 160
@@ -235,15 +212,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
235 // If the region/maptile is legacy sized, just upload the one tile like it has always been done 212 // If the region/maptile is legacy sized, just upload the one tile like it has always been done
236 if (mapTile.Width == Constants.RegionSize && mapTile.Height == Constants.RegionSize) 213 if (mapTile.Width == Constants.RegionSize && mapTile.Height == Constants.RegionSize)
237 { 214 {
238<<<<<<< HEAD 215 ConvertAndUploadMaptile(scene, mapTile,
239 ConvertAndUploadMaptile(mapTile,
240 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, 216 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY,
241 scene.RegionInfo.RegionName); 217 scene.RegionInfo.RegionName);
242=======
243 ConvertAndUploadMaptile(mapTile, scene,
244 scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY,
245 scene.RegionInfo.RegionName);
246>>>>>>> avn/ubitvar
247 } 218 }
248 else 219 else
249 { 220 {
@@ -263,17 +234,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
263 (int)Constants.RegionSize, (int)Constants.RegionSize); 234 (int)Constants.RegionSize, (int)Constants.RegionSize);
264 using (Bitmap subMapTile = mapTile.Clone(rect, mapTile.PixelFormat)) 235 using (Bitmap subMapTile = mapTile.Clone(rect, mapTile.PixelFormat))
265 { 236 {
266<<<<<<< HEAD 237 ConvertAndUploadMaptile(scene, subMapTile,
267 ConvertAndUploadMaptile(subMapTile,
268 scene.RegionInfo.RegionLocX + (xx / Constants.RegionSize), 238 scene.RegionInfo.RegionLocX + (xx / Constants.RegionSize),
269 scene.RegionInfo.RegionLocY + (yy / Constants.RegionSize), 239 scene.RegionInfo.RegionLocY + (yy / Constants.RegionSize),
270 scene.Name); 240 scene.Name);
271=======
272 ConvertAndUploadMaptile(subMapTile, scene,
273 scene.RegionInfo.RegionLocX + (xx / Constants.RegionSize),
274 scene.RegionInfo.RegionLocY + (yy / Constants.RegionSize),
275 scene.Name);
276>>>>>>> avn/ubitvar
277 } 241 }
278 } 242 }
279 } 243 }
@@ -285,11 +249,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
285 ///</summary> 249 ///</summary>
286 public void UploadMapTile(IScene scene) 250 public void UploadMapTile(IScene scene)
287 { 251 {
288<<<<<<< HEAD
289=======
290 m_log.DebugFormat("{0}: upload maptile for {1}", LogHeader, scene.RegionInfo.RegionName); 252 m_log.DebugFormat("{0}: upload maptile for {1}", LogHeader, scene.RegionInfo.RegionName);
291 253
292>>>>>>> avn/ubitvar
293 // Create a JPG map tile and upload it to the AddMapTile API 254 // Create a JPG map tile and upload it to the AddMapTile API
294 IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>(); 255 IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>();
295 if (tileGenerator == null) 256 if (tileGenerator == null)
@@ -300,23 +261,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
300 261
301 using (Bitmap mapTile = tileGenerator.CreateMapTile()) 262 using (Bitmap mapTile = tileGenerator.CreateMapTile())
302 { 263 {
303<<<<<<< HEAD
304 if (mapTile != null)
305 {
306 UploadMapTile(scene, mapTile);
307 }
308 else
309 {
310 m_log.WarnFormat("{0} Tile image generation failed", LogHeader);
311 }
312 }
313 }
314
315 private void ConvertAndUploadMaptile(Image tileImage, uint locX, uint locY, string regionName)
316 {
317 byte[] jpgData = Utils.EmptyBytes;
318
319=======
320 // XXX: The MapImageModule will return a null if the user has chosen not to create map tiles and there 264 // XXX: The MapImageModule will return a null if the user has chosen not to create map tiles and there
321 // is no static map tile. 265 // is no static map tile.
322 if (mapTile == null) 266 if (mapTile == null)
@@ -326,11 +270,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
326 } 270 }
327 } 271 }
328 272
329 private void ConvertAndUploadMaptile(Image tileImage, IScene scene, uint locX, uint locY, string regionName) 273 private void ConvertAndUploadMaptile(IScene scene, Image tileImage, uint locX, uint locY, string regionName)
330 { 274 {
331 byte[] jpgData = Utils.EmptyBytes; 275 byte[] jpgData = Utils.EmptyBytes;
332 276
333>>>>>>> avn/ubitvar
334 using (MemoryStream stream = new MemoryStream()) 277 using (MemoryStream stream = new MemoryStream())
335 { 278 {
336 tileImage.Save(stream, ImageFormat.Jpeg); 279 tileImage.Save(stream, ImageFormat.Jpeg);
@@ -339,11 +282,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
339 if (jpgData != Utils.EmptyBytes) 282 if (jpgData != Utils.EmptyBytes)
340 { 283 {
341 string reason = string.Empty; 284 string reason = string.Empty;
342<<<<<<< HEAD
343 if (!m_MapService.AddMapTile((int)locX, (int)locY, jpgData, out reason))
344=======
345 if (!m_MapService.AddMapTile((int)locX, (int)locY, jpgData, scene.RegionInfo.ScopeID, out reason)) 285 if (!m_MapService.AddMapTile((int)locX, (int)locY, jpgData, scene.RegionInfo.ScopeID, out reason))
346>>>>>>> avn/ubitvar
347 { 286 {
348 m_log.DebugFormat("{0} Unable to upload tile image for {1} at {2}-{3}: {4}", LogHeader, 287 m_log.DebugFormat("{0} Unable to upload tile image for {1} at {2}-{3}: {4}", LogHeader,
349 regionName, locX, locY, reason); 288 regionName, locX, locY, reason);
@@ -351,11 +290,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
351 } 290 }
352 else 291 else
353 { 292 {
354<<<<<<< HEAD
355 m_log.WarnFormat("{0} Tile image generation failed for region {1}", LogHeader, regionName); 293 m_log.WarnFormat("{0} Tile image generation failed for region {1}", LogHeader, regionName);
356=======
357 m_log.WarnFormat("{0} Tile image generation failed for region {1}", LogHeader, scene.RegionInfo.RegionName);
358>>>>>>> avn/ubitvar
359 } 294 }
360 } 295 }
361 } 296 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 50238a5..9d4c282 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -269,11 +269,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
269 return true; 269 return true;
270 } 270 }
271 271
272<<<<<<< HEAD 272
273 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, List<UUID> features, out string version, out string reason) 273 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, List<UUID> features, out string version, out string reason)
274=======
275 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, out string version, out string reason)
276>>>>>>> avn/ubitvar
277 { 274 {
278 reason = "Communications failure"; 275 reason = "Communications failure";
279 version = ServiceVersion; 276 version = ServiceVersion;
@@ -302,29 +299,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
302 299
303 } 300 }
304 301
305<<<<<<< HEAD
306 return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, viaTeleport, position, features, out reason);
307=======
308
309 // not really need on a grid running var regions sims
310
311 uint size = m_scenes[destination.RegionID].RegionInfo.RegionSizeX;
312
313 float theirVersionNumber = 0f;
314 string[] versionComponents = theirversion.Split(new char[] { '/' });
315 if (versionComponents.Length >= 2)
316 float.TryParse(versionComponents[1], out theirVersionNumber);
317 302
318 // Var regions here, and the requesting simulator is in an older version. 303 return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, viaTeleport, position, features, out reason);
319 // We will forbide this, because it crashes the viewers
320 if (theirVersionNumber < 0.3f && size > 256)
321 {
322 reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading.";
323 m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from {0} simulator was denied", theirVersionNumber);
324 return false;
325 }
326 return m_scenes[destination.RegionID].QueryAccess(agentID, position, out reason);
327>>>>>>> avn/ubitvar
328 } 304 }
329 305
330 //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); 306 //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index 7044d92..12ffc01 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -206,11 +206,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
206 return m_remoteConnector.UpdateAgent(destination, cAgentData); 206 return m_remoteConnector.UpdateAgent(destination, cAgentData);
207 } 207 }
208 208
209<<<<<<< HEAD 209
210 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, List<UUID> features, out string version, out string reason) 210 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, List<UUID> features, out string version, out string reason)
211=======
212 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason)
213>>>>>>> avn/ubitvar
214 { 211 {
215 reason = "Communications failure"; 212 reason = "Communications failure";
216 version = "Unknown"; 213 version = "Unknown";
@@ -219,22 +216,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
219 return false; 216 return false;
220 217
221 // Try local first 218 // Try local first
222<<<<<<< HEAD
223 if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, features, out version, out reason)) 219 if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, features, out version, out reason))
224=======
225 if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason))
226 return true;
227>>>>>>> avn/ubitvar
228 return true; 220 return true;
229 221
230 // else do the remote thing 222 // else do the remote thing
231 if (!m_localBackend.IsLocalRegion(destination.RegionID)) 223 if (!m_localBackend.IsLocalRegion(destination.RegionID))
232<<<<<<< HEAD
233 return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, features, out version, out reason); 224 return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, features, out version, out reason);
234=======
235 return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason);
236
237>>>>>>> avn/ubitvar
238 225
239 return false; 226 return false;
240 } 227 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index f0b0f4a..406f4a8 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -162,13 +162,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
162 162
163 private UUID m_defaultUser; 163 private UUID m_defaultUser;
164 164
165<<<<<<< HEAD
166 private UUID m_defaultUser;
167
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) 165 public ArchiveReadRequest(Scene scene, string loadPath, Guid requestId, Dictionary<string, object> options)
171>>>>>>> avn/ubitvar
172 { 166 {
173 m_rootScene = scene; 167 m_rootScene = scene;
174 168
@@ -177,11 +171,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
177 m_defaultUser = (UUID)options["default-user"]; 171 m_defaultUser = (UUID)options["default-user"];
178 m_log.InfoFormat("Using User {0} as default user", m_defaultUser.ToString()); 172 m_log.InfoFormat("Using User {0} as default user", m_defaultUser.ToString());
179 } 173 }
180<<<<<<< HEAD
181 else
182=======
183 else 174 else
184>>>>>>> avn/ubitvar
185 { 175 {
186 m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner; 176 m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner;
187 } 177 }
@@ -200,10 +190,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
200 } 190 }
201 191
202 m_errorMessage = String.Empty; 192 m_errorMessage = String.Empty;
203<<<<<<< HEAD
204=======
205 193
206>>>>>>> avn/ubitvar
207 m_merge = options.ContainsKey("merge"); 194 m_merge = options.ContainsKey("merge");
208 m_forceTerrain = options.ContainsKey("force-terrain"); 195 m_forceTerrain = options.ContainsKey("force-terrain");
209 m_forceParcels = options.ContainsKey("force-parcels"); 196 m_forceParcels = options.ContainsKey("force-parcels");
@@ -212,34 +199,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
212 m_requestId = requestId; 199 m_requestId = requestId;
213 m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero; 200 m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero;
214 m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f; 201 m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f;
215<<<<<<< HEAD
216 m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"]
217 : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f);
218
219 // Zero can never be a valid user or group id
220 m_validUserUuids[UUID.Zero] = false;
221 m_validGroupUuids[UUID.Zero] = false;
222=======
223 m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"] 202 m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"]
224 : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f); 203 : new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f);
225 204
226 m_requestId = requestId;
227
228 // Zero can never be a valid user id (or group) 205 // Zero can never be a valid user id (or group)
229 m_validUserUuids[UUID.Zero] = false; 206 m_validUserUuids[UUID.Zero] = false;
230 m_validGroupUuids[UUID.Zero] = false; 207 m_validGroupUuids[UUID.Zero] = false;
231 208
232>>>>>>> avn/ubitvar
233
234 m_groupsModule = m_rootScene.RequestModuleInterface<IGroupsModule>(); 209 m_groupsModule = m_rootScene.RequestModuleInterface<IGroupsModule>();
235 m_assetService = m_rootScene.AssetService; 210 m_assetService = m_rootScene.AssetService;
236 } 211 }
237 212
238<<<<<<< HEAD
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) 213 public ArchiveReadRequest(Scene scene, Stream loadStream, Guid requestId, Dictionary<string, object> options)
242>>>>>>> avn/ubitvar
243 { 214 {
244 m_rootScene = scene; 215 m_rootScene = scene;
245 m_loadPath = null; 216 m_loadPath = null;
@@ -249,11 +220,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
249 m_requestId = requestId; 220 m_requestId = requestId;
250 221
251 m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner; 222 m_defaultUser = scene.RegionInfo.EstateSettings.EstateOwner;
252<<<<<<< HEAD
253
254=======
255 223
256>>>>>>> avn/ubitvar
257 // Zero can never be a valid user id 224 // Zero can never be a valid user id
258 m_validUserUuids[UUID.Zero] = false; 225 m_validUserUuids[UUID.Zero] = false;
259 226
@@ -327,24 +294,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
327 if ((successfulAssetRestores + failedAssetRestores) % 250 == 0) 294 if ((successfulAssetRestores + failedAssetRestores) % 250 == 0)
328 m_log.Debug("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets..."); 295 m_log.Debug("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets...");
329 } 296 }
330<<<<<<< HEAD
331 else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH) && (!m_merge || m_forceTerrain)) 297 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
335 { 298 {
336 LoadTerrain(scene, filePath, data); 299 LoadTerrain(scene, filePath, data);
337 } 300 }
338 else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH)) 301 else if (!m_merge && filePath.StartsWith(ArchiveConstants.SETTINGS_PATH))
339 { 302 {
340 LoadRegionSettings(scene, filePath, data, dearchivedScenes); 303 LoadRegionSettings(scene, filePath, data, dearchivedScenes);
341<<<<<<< HEAD
342 } 304 }
343 else if (filePath.StartsWith(ArchiveConstants.LANDDATA_PATH) && (!m_merge || m_forceParcels)) 305 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
348 { 306 {
349 sceneContext.SerialisedParcels.Add(Encoding.UTF8.GetString(data)); 307 sceneContext.SerialisedParcels.Add(Encoding.UTF8.GetString(data));
350 } 308 }
@@ -565,10 +523,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
565 } 523 }
566 } 524 }
567 525
568<<<<<<< HEAD
569
570=======
571>>>>>>> avn/ubitvar
572 bool isTelehub = (sceneObject.UUID == oldTelehubUUID) && (oldTelehubUUID != UUID.Zero); 526 bool isTelehub = (sceneObject.UUID == oldTelehubUUID) && (oldTelehubUUID != UUID.Zero);
573 527
574 // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned 528 // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned
@@ -585,10 +539,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
585 } 539 }
586 540
587 ModifySceneObject(scene, sceneObject); 541 ModifySceneObject(scene, sceneObject);
588<<<<<<< HEAD
589=======
590
591>>>>>>> avn/ubitvar
592 542
593 if (scene.AddRestoredSceneObject(sceneObject, true, false)) 543 if (scene.AddRestoredSceneObject(sceneObject, true, false))
594 { 544 {
@@ -649,8 +599,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
649 // being no copy/no mod for everyone 599 // being no copy/no mod for everyone
650 lock (part.TaskInventory) 600 lock (part.TaskInventory)
651 { 601 {
652<<<<<<< HEAD
653=======
654 // And zap any troublesome sit target information 602 // And zap any troublesome sit target information
655 part.SitTargetOrientation = new Quaternion(0, 0, 0, 1); 603 part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
656 part.SitTargetPosition = new Vector3(0, 0, 0); 604 part.SitTargetPosition = new Vector3(0, 0, 0);
@@ -659,7 +607,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
659 // Not doing so results in inventory items 607 // Not doing so results in inventory items
660 // being no copy/no mod for everyone 608 // being no copy/no mod for everyone
661 part.TaskInventory.LockItemsForRead(true); 609 part.TaskInventory.LockItemsForRead(true);
662>>>>>>> avn/ubitvar 610
663 TaskInventoryDictionary inv = part.TaskInventory; 611 TaskInventoryDictionary inv = part.TaskInventory;
664 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) 612 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
665 { 613 {
@@ -680,18 +628,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
680 if (!ResolveGroupUuid(kvp.Value.GroupID)) 628 if (!ResolveGroupUuid(kvp.Value.GroupID))
681 kvp.Value.GroupID = UUID.Zero; 629 kvp.Value.GroupID = UUID.Zero;
682 } 630 }
683<<<<<<< HEAD
684=======
685 part.TaskInventory.LockItemsForRead(false); 631 part.TaskInventory.LockItemsForRead(false);
686>>>>>>> avn/ubitvar 632
687 } 633 }
688 } 634 }
689 } 635 }
690 636
691<<<<<<< HEAD
692
693=======
694>>>>>>> avn/ubitvar
695 /// <summary> 637 /// <summary>
696 /// Load serialized parcels. 638 /// Load serialized parcels.
697 /// </summary> 639 /// </summary>
@@ -712,11 +654,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
712 parcel.AABBMin += parcelDisp; 654 parcel.AABBMin += parcelDisp;
713 parcel.AABBMax += parcelDisp; 655 parcel.AABBMax += parcelDisp;
714 } 656 }
715<<<<<<< HEAD 657
716
717=======
718
719>>>>>>> avn/ubitvar
720 // Validate User and Group UUID's 658 // Validate User and Group UUID's
721 659
722 if (!ResolveGroupUuid(parcel.GroupID)) 660 if (!ResolveGroupUuid(parcel.GroupID))
@@ -731,26 +669,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
731 } 669 }
732 else 670 else
733 { 671 {
734<<<<<<< HEAD
735 parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
736=======
737 parcel.OwnerID = m_defaultUser; 672 parcel.OwnerID = m_defaultUser;
738 parcel.GroupID = UUID.Zero; 673 parcel.GroupID = UUID.Zero;
739>>>>>>> avn/ubitvar
740 parcel.IsGroupOwned = false; 674 parcel.IsGroupOwned = false;
741 } 675 }
742 } 676 }
743 else 677 else
744 { 678 {
745 if (!ResolveUserUuid(scene, parcel.OwnerID)) 679 if (!ResolveUserUuid(scene, parcel.OwnerID))
746<<<<<<< HEAD
747 parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
748=======
749 parcel.OwnerID = m_defaultUser; 680 parcel.OwnerID = m_defaultUser;
750 681
751 if (!ResolveGroupUuid(parcel.GroupID)) 682 if (!ResolveGroupUuid(parcel.GroupID))
752 parcel.GroupID = UUID.Zero; 683 parcel.GroupID = UUID.Zero;
753>>>>>>> avn/ubitvar
754 } 684 }
755 685
756 List<LandAccessEntry> accessList = new List<LandAccessEntry>(); 686 List<LandAccessEntry> accessList = new List<LandAccessEntry>();
@@ -879,10 +809,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
879 if (data == null) 809 if (data == null)
880 return false; 810 return false;
881 } 811 }
882<<<<<<< HEAD
883 812
884=======
885>>>>>>> avn/ubitvar
886 //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); 813 //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
887 814
888 AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType, UUID.Zero.ToString()); 815 AssetBase asset = new AssetBase(new UUID(uuid), String.Empty, assetType, UUID.Zero.ToString());
@@ -1004,11 +931,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
1004 private bool LoadTerrain(Scene scene, string terrainPath, byte[] data) 931 private bool LoadTerrain(Scene scene, string terrainPath, byte[] data)
1005 { 932 {
1006 ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>(); 933 ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>();
1007<<<<<<< HEAD
1008
1009=======
1010
1011>>>>>>> avn/ubitvar
1012 using (MemoryStream ms = new MemoryStream(data)) 934 using (MemoryStream ms = new MemoryStream(data))
1013 { 935 {
1014 if (m_displacement != Vector3.Zero || m_rotation != 0f) 936 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 0fb8a32..4178a57 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -111,19 +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
116 OptionSet options = new OptionSet();
117 options.Add("m|merge", delegate (string v) { mergeOar = (v != null); });
118 options.Add("s|skip-assets", delegate (string v) { skipAssets = (v != null); });
119 options.Add("force-terrain", delegate (string v) { forceTerrain = (v != null); });
120 options.Add("forceterrain", delegate (string v) { forceTerrain = (v != null); }); // downward compatibility
121 options.Add("force-parcels", delegate (string v) { forceParcels = (v != null); });
122 options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility
123 options.Add("no-objects", delegate (string v) { noObjects = (v != null); });
124 options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; });
125 options.Add("displacement=", delegate (string v) {
126=======
127 115
128 OptionSet options = new OptionSet(); 116 OptionSet options = new OptionSet();
129 options.Add("m|merge", delegate(string v) { mergeOar = (v != null); }); 117 options.Add("m|merge", delegate(string v) { mergeOar = (v != null); });
@@ -136,7 +124,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
136 options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; }); 124 options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; });
137 options.Add("displacement=", delegate(string v) 125 options.Add("displacement=", delegate(string v)
138 { 126 {
139>>>>>>> avn/ubitvar
140 try 127 try
141 { 128 {
142 displacement = v == null ? Vector3.Zero : Vector3.Parse(v); 129 displacement = v == null ? Vector3.Zero : Vector3.Parse(v);
@@ -163,12 +150,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
163 // Convert to radians for internals 150 // Convert to radians for internals
164 rotation = Util.Clamp<float>(rotation, -359f, 359f) / 180f * (float)Math.PI; 151 rotation = Util.Clamp<float>(rotation, -359f, 359f) / 180f * (float)Math.PI;
165 }); 152 });
166<<<<<<< HEAD
167 options.Add("rotation-center=", delegate (string v) {
168=======
169 options.Add("rotation-center=", delegate(string v) 153 options.Add("rotation-center=", delegate(string v)
170 { 154 {
171>>>>>>> avn/ubitvar
172 try 155 try
173 { 156 {
174 rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v); 157 rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v);
@@ -308,21 +291,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
308 Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); 291 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
309 DearchiveRegion(loadPath, Guid.Empty, archiveOptions); 292 DearchiveRegion(loadPath, Guid.Empty, archiveOptions);
310 } 293 }
311<<<<<<< HEAD
312
313 public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string,object> options)
314 {
315 m_log.InfoFormat(
316 "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath);
317
318=======
319 294
320 public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string, object> options) 295 public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string, object> options)
321 { 296 {
322 m_log.InfoFormat( 297 m_log.InfoFormat(
323 "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath); 298 "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath);
324 299
325>>>>>>> avn/ubitvar
326 new ArchiveReadRequest(Scene, loadPath, requestId, options).DearchiveRegion(); 300 new ArchiveReadRequest(Scene, loadPath, requestId, options).DearchiveRegion();
327 } 301 }
328 302
@@ -331,11 +305,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
331 Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); 305 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
332 DearchiveRegion(loadStream, Guid.Empty, archiveOptions); 306 DearchiveRegion(loadStream, Guid.Empty, archiveOptions);
333 } 307 }
334<<<<<<< HEAD
335
336=======
337
338>>>>>>> avn/ubitvar
339 public void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options) 308 public void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options)
340 { 309 {
341 new ArchiveReadRequest(Scene, loadStream, requestId, options).DearchiveRegion(); 310 new ArchiveReadRequest(Scene, loadStream, requestId, options).DearchiveRegion();
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index e6e6485..3ded00c 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -68,6 +68,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
68 public event ChangeDelegate OnEstateInfoChange; 68 public event ChangeDelegate OnEstateInfoChange;
69 public event MessageDelegate OnEstateMessage; 69 public event MessageDelegate OnEstateMessage;
70 70
71 private int m_delayCount = 0;
72
71 #region Region Module interface 73 #region Region Module interface
72 74
73 public string Name { get { return "EstateManagementModule"; } } 75 public string Name { get { return "EstateManagementModule"; } }
@@ -146,6 +148,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
146 flags |= RegionFlags.AllowParcelChanges; 148 flags |= RegionFlags.AllowParcelChanges;
147 if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) 149 if (Scene.RegionInfo.RegionSettings.BlockShowInSearch)
148 flags |= RegionFlags.BlockParcelSearch; 150 flags |= RegionFlags.BlockParcelSearch;
151 if (Scene.RegionInfo.RegionSettings.GodBlockSearch)
152 flags |= (RegionFlags)(1 << 11);
153 if (Scene.RegionInfo.RegionSettings.Casino)
154 flags |= (RegionFlags)(1 << 10);
149 155
150 if (Scene.RegionInfo.RegionSettings.FixedSun) 156 if (Scene.RegionInfo.RegionSettings.FixedSun)
151 flags |= RegionFlags.SunFixed; 157 flags |= RegionFlags.SunFixed;
@@ -198,6 +204,14 @@ namespace OpenSim.Region.CoreModules.World.Estate
198 change(Scene.RegionInfo.RegionID); 204 change(Scene.RegionInfo.RegionID);
199 } 205 }
200 206
207 protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e)
208 {
209 ChangeDelegate change = OnRegionInfoChange;
210
211 if (change != null)
212 change(Scene.RegionInfo.RegionID);
213 }
214
201 public void TriggerRegionInfoChange() 215 public void TriggerRegionInfoChange()
202 { 216 {
203 m_regionChangeTimer.Stop(); 217 m_regionChangeTimer.Stop();
@@ -1491,68 +1505,8 @@ namespace OpenSim.Region.CoreModules.World.Estate
1491 sendRegionHandshake(client); 1505 sendRegionHandshake(client);
1492 } 1506 }
1493 1507
1494<<<<<<< HEAD
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 1508
1554 public uint GetEstateFlags() 1509 public uint GetEstateFlags()
1555>>>>>>> avn/ubitvar
1556 { 1510 {
1557 RegionFlags flags = RegionFlags.None; 1511 RegionFlags flags = RegionFlags.None;
1558 1512
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 8bd46f6..749c2cc 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -69,11 +69,8 @@ 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
73 public const int LandUnit = 4; 73 public const int LandUnit = 4;
74=======
75 public const int landUnit = 4;
76>>>>>>> avn/ubitvar
77 74
78 private static readonly string remoteParcelRequestPath = "0009/"; 75 private static readonly string remoteParcelRequestPath = "0009/";
79 76
@@ -106,17 +103,12 @@ namespace OpenSim.Region.CoreModules.World.Land
106 103
107 // caches ExtendedLandData 104 // caches ExtendedLandData
108 private Cache parcelInfoCache; 105 private Cache parcelInfoCache;
109<<<<<<< HEAD
110
111 106
112 /// <summary> 107 /// <summary>
113 /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. 108 /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions.
114 /// </summary> 109 /// </summary>
115 private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>(); 110 private Dictionary<UUID, Vector3> forcedPosition = new Dictionary<UUID, Vector3>();
116======= 111
117 private Dictionary<UUID, Vector3> forcedPosition =
118 new Dictionary<UUID, Vector3>();
119>>>>>>> avn/ubitvar
120 112
121 // Enables limiting parcel layer info transmission when doing simple updates 113 // Enables limiting parcel layer info transmission when doing simple updates
122 private bool shouldLimitParcelLayerInfoToViewDistance { get; set; } 114 private bool shouldLimitParcelLayerInfoToViewDistance { get; set; }
@@ -132,7 +124,6 @@ namespace OpenSim.Region.CoreModules.World.Land
132 124
133 public void Initialise(IConfigSource source) 125 public void Initialise(IConfigSource source)
134 { 126 {
135<<<<<<< HEAD
136 shouldLimitParcelLayerInfoToViewDistance = true; 127 shouldLimitParcelLayerInfoToViewDistance = true;
137 parcelLayerViewDistance = 128; 128 parcelLayerViewDistance = 128;
138 IConfig landManagementConfig = source.Configs["LandManagement"]; 129 IConfig landManagementConfig = source.Configs["LandManagement"];
@@ -140,24 +131,16 @@ namespace OpenSim.Region.CoreModules.World.Land
140 { 131 {
141 shouldLimitParcelLayerInfoToViewDistance = landManagementConfig.GetBoolean("LimitParcelLayerUpdateDistance", shouldLimitParcelLayerInfoToViewDistance); 132 shouldLimitParcelLayerInfoToViewDistance = landManagementConfig.GetBoolean("LimitParcelLayerUpdateDistance", shouldLimitParcelLayerInfoToViewDistance);
142 parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance); 133 parcelLayerViewDistance = landManagementConfig.GetInt("ParcelLayerViewDistance", parcelLayerViewDistance);
143======= 134 DefaultGodParcelGroup = new UUID(landManagementConfig.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString()));
144 IConfig cnf = source.Configs["LandManagement"]; 135 DefaultGodParcelName = landManagementConfig.GetString("DefaultAdministratorParcelName", "Default Parcel");
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
150 } 136 }
151 } 137 }
152 138
153 public void AddRegion(Scene scene) 139 public void AddRegion(Scene scene)
154 { 140 {
155 m_scene = scene; 141 m_scene = scene;
156<<<<<<< HEAD
157 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; 142 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit];
158======= 143
159 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / landUnit, m_scene.RegionInfo.RegionSizeY / landUnit];
160>>>>>>> avn/ubitvar
161 landChannel = new LandChannel(scene, this); 144 landChannel = new LandChannel(scene, this);
162 145
163 parcelInfoCache = new Cache(); 146 parcelInfoCache = new Cache();
@@ -299,11 +282,8 @@ namespace OpenSim.Region.CoreModules.World.Land
299 { 282 {
300 m_landList.Clear(); 283 m_landList.Clear();
301 m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; 284 m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
302<<<<<<< HEAD 285
303 m_landIDList = new int[m_scene.RegionInfo.RegionSizeX / LandUnit, m_scene.RegionInfo.RegionSizeY / LandUnit]; 286 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
307 } 287 }
308 } 288 }
309 289
@@ -313,16 +293,10 @@ namespace OpenSim.Region.CoreModules.World.Land
313 /// <returns>The parcel created.</returns> 293 /// <returns>The parcel created.</returns>
314 protected ILandObject CreateDefaultParcel() 294 protected ILandObject CreateDefaultParcel()
315 { 295 {
316<<<<<<< HEAD
317 m_log.DebugFormat(
318 "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName);
319
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); 296 m_log.DebugFormat("{0} Creating default parcel for region {1}", LogHeader, m_scene.RegionInfo.RegionName);
323 297
324 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); 298 ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
325>>>>>>> avn/ubitvar 299
326 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, 300 fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0,
327 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY)); 301 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY));
328 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 302 fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
@@ -456,15 +430,10 @@ namespace OpenSim.Region.CoreModules.World.Land
456 430
457 public void SendLandUpdate(ScenePresence avatar, bool force) 431 public void SendLandUpdate(ScenePresence avatar, bool force)
458 { 432 {
459<<<<<<< HEAD
460 ILandObject over = GetLandObject((int)Math.Min(((int)m_scene.RegionInfo.RegionSizeX - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))),
461 (int)Math.Min(((int)m_scene.RegionInfo.RegionSizeY - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y))));
462=======
463 if (avatar.IsChildAgent) 433 if (avatar.IsChildAgent)
464 return; 434 return;
465 435
466 ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 436 ILandObject over = GetLandObjectClipedXY(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
467>>>>>>> avn/ubitvar
468 437
469 if (over != null) 438 if (over != null)
470 { 439 {
@@ -621,28 +590,17 @@ namespace OpenSim.Region.CoreModules.World.Land
621 new_land.LandData.LocalID = newLandLocalID; 590 new_land.LandData.LocalID = newLandLocalID;
622 591
623 bool[,] landBitmap = new_land.GetLandBitmap(); 592 bool[,] landBitmap = new_land.GetLandBitmap();
624<<<<<<< HEAD
625 // m_log.DebugFormat("{0} AddLandObject. new_land.bitmapSize=({1},{2}). newLocalID={3}",
626 // LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), newLandLocalID);
627
628=======
629>>>>>>> avn/ubitvar
630 if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1)) 593 if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1))
631 { 594 {
632 // Going to variable sized regions can cause mismatches 595 // Going to variable sized regions can cause mismatches
633 m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})", 596 m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})",
634<<<<<<< HEAD
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)); 597 LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1));
638>>>>>>> avn/ubitvar
639 } 598 }
640 else 599 else
641 { 600 {
642 // If other land objects still believe that they occupy any parts of the same space, 601 // If other land objects still believe that they occupy any parts of the same space,
643 // then do not allow the add to proceed. 602 // then do not allow the add to proceed.
644 for (int x = 0; x < landBitmap.GetLength(0); x++) 603 for (int x = 0; x < landBitmap.GetLength(0); x++)
645<<<<<<< HEAD
646 { 604 {
647 for (int y = 0; y < landBitmap.GetLength(1); y++) 605 for (int y = 0; y < landBitmap.GetLength(1); y++)
648 { 606 {
@@ -658,40 +616,6 @@ namespace OpenSim.Region.CoreModules.World.Land
658 { 616 {
659 m_log.ErrorFormat( 617 m_log.ErrorFormat(
660 "{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}", 618 "{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}",
661 LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y,
662 lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name);
663
664 return null;
665 }
666 }
667 }
668 }
669 }
670
671 for (int x = 0; x < landBitmap.GetLength(0); x++)
672=======
673>>>>>>> avn/ubitvar
674 {
675 for (int y = 0; y < landBitmap.GetLength(1); y++)
676 {
677 if (landBitmap[x, y])
678 {
679<<<<<<< HEAD
680 // m_log.DebugFormat(
681 // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}",
682 // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName);
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, 619 LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y,
696 lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name); 620 lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name);
697 621
@@ -712,7 +636,6 @@ namespace OpenSim.Region.CoreModules.World.Land
712 // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", 636 // "[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); 637 // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName);
714 638
715>>>>>>> avn/ubitvar
716 m_landIDList[x, y] = newLandLocalID; 639 m_landIDList[x, y] = newLandLocalID;
717 } 640 }
718 } 641 }
@@ -829,33 +752,6 @@ namespace OpenSim.Region.CoreModules.World.Land
829 /// <returns>Land object at the point supplied</returns> 752 /// <returns>Land object at the point supplied</returns>
830 public ILandObject GetLandObject(float x_float, float y_float) 753 public ILandObject GetLandObject(float x_float, float y_float)
831 { 754 {
832<<<<<<< HEAD
833 return GetLandObject((int)x_float, (int)y_float, true /* returnNullIfLandObjectNotFound */);
834 /*
835 int x;
836 int y;
837
838 if (x_float >= m_scene.RegionInfo.RegionSizeX || x_float < 0 || y_float >= m_scene.RegionInfo.RegionSizeX || y_float < 0)
839 return null;
840
841 try
842 {
843 x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / (float)landUnit));
844 y = Convert.ToInt32(Math.Floor(Convert.ToDouble(y_float) / (float)landUnit));
845 }
846 catch (OverflowException)
847 {
848 return null;
849 }
850
851 if (x >= (m_scene.RegionInfo.RegionSizeX / landUnit)
852 || y >= (m_scene.RegionInfo.RegionSizeY / landUnit)
853 || x < 0
854 || y < 0)
855 {
856 return null;
857 }
858=======
859 return GetLandObject((int)x_float, (int)y_float, true); 755 return GetLandObject((int)x_float, (int)y_float, true);
860 } 756 }
861 757
@@ -875,45 +771,18 @@ namespace OpenSim.Region.CoreModules.World.Land
875 avy = 0; 771 avy = 0;
876 else if (avy >= m_scene.RegionInfo.RegionSizeY) 772 else if (avy >= m_scene.RegionInfo.RegionSizeY)
877 avy = (int)Constants.RegionSize - 1; 773 avy = (int)Constants.RegionSize - 1;
878>>>>>>> avn/ubitvar
879 774
880 lock (m_landIDList) 775 lock (m_landIDList)
881 { 776 {
882<<<<<<< HEAD
883 // Corner case. If an autoreturn happens during sim startup
884 // we will come here with the list uninitialized
885 //
886// int landId = m_landIDList[x, y];
887
888// if (landId == 0)
889// m_log.DebugFormat(
890// "[LAND MANAGEMENT MODULE]: No land object found at ({0}, {1}) on {2}",
891// x, y, m_scene.RegionInfo.RegionName);
892
893 try
894 {
895 if (m_landList.ContainsKey(m_landIDList[x, y]))
896 return m_landList[m_landIDList[x, y]];
897 }
898 catch (Exception e)
899 {
900 m_log.DebugFormat("{0} GetLandObject exception. x={1}, y={2}, m_landIDList.len=({3},{4})",
901 LogHeader, x, y, m_landIDList.GetLength(0), m_landIDList.GetLength(1));
902 }
903
904 return null;
905=======
906 try 777 try
907 { 778 {
908 return m_landList[m_landIDList[avx / landUnit, avy / landUnit]]; 779 return m_landList[m_landIDList[avx / LandUnit, avy / LandUnit]];
909 } 780 }
910 catch (IndexOutOfRangeException) 781 catch (IndexOutOfRangeException)
911 { 782 {
912 return null; 783 return null;
913 } 784 }
914>>>>>>> avn/ubitvar
915 } 785 }
916 */
917 } 786 }
918 787
919 // Public entry. 788 // Public entry.
@@ -923,38 +792,15 @@ namespace OpenSim.Region.CoreModules.World.Land
923 return GetLandObject(x, y, false /* returnNullIfLandObjectNotFound */); 792 return GetLandObject(x, y, false /* returnNullIfLandObjectNotFound */);
924 } 793 }
925 794
926<<<<<<< HEAD
927 /// <summary>
928 /// Given a region position, return the parcel land object for that location
929 /// </summary>
930 /// <returns>
931 /// The land object.
932 /// </returns>
933 /// <param name='x'></param>
934 /// <param name='y'></param>
935 /// <param name='returnNullIfLandObjectNotFound'>
936 /// Return null if the land object requested is not within the region's bounds.
937 /// </param>
938 private ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds)
939 {
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) 795 public ILandObject GetLandObject(int x, int y, bool returnNullIfLandObjectOutsideBounds)
943 { 796 {
944 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0) 797 if (x >= m_scene.RegionInfo.RegionSizeX || y >= m_scene.RegionInfo.RegionSizeY || x < 0 || y < 0)
945>>>>>>> avn/ubitvar
946 { 798 {
947 // These exceptions here will cause a lot of complaints from the users specifically because 799 // These exceptions here will cause a lot of complaints from the users specifically because
948 // they happen every time at border crossings 800 // they happen every time at border crossings
949 if (returnNullIfLandObjectOutsideBounds) 801 if (returnNullIfLandObjectOutsideBounds)
950 return null; 802 return null;
951 else 803 else
952<<<<<<< HEAD
953 throw new Exception(
954 String.Format("{0} GetLandObject for non-existent position. Region={1}, pos=<{2},{3}",
955 LogHeader, m_scene.RegionInfo.RegionName, x, y)
956 );
957=======
958 throw new Exception("Error: Parcel not found at point " + x + ", " + y); 804 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
959 } 805 }
960 806
@@ -968,7 +814,6 @@ namespace OpenSim.Region.CoreModules.World.Land
968 { 814 {
969 return null; 815 return null;
970 } 816 }
971>>>>>>> avn/ubitvar
972 } 817 }
973 818
974 return m_landList[m_landIDList[x / 4, y / 4]]; 819 return m_landList[m_landIDList[x / 4, y / 4]];
@@ -987,19 +832,6 @@ namespace OpenSim.Region.CoreModules.World.Land
987 return ret; 832 return ret;
988 } 833 }
989 834
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
1003 #endregion 835 #endregion
1004 836
1005 #region Parcel Modification 837 #region Parcel Modification
@@ -1169,19 +1001,12 @@ namespace OpenSim.Region.CoreModules.World.Land
1169 1001
1170 //Now add the new land object 1002 //Now add the new land object
1171 ILandObject result = AddLandObject(newLand); 1003 ILandObject result = AddLandObject(newLand);
1172<<<<<<< HEAD
1173 1004
1174 if (result != null)
1175 {
1176 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData);
1177 result.SendLandUpdateToAvatarsOverMe();
1178 }
1179=======
1180 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); 1005 UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData);
1181 result.SendLandUpdateToAvatarsOverMe(); 1006 result.SendLandUpdateToAvatarsOverMe();
1182 startLandObject.SendLandUpdateToAvatarsOverMe(); 1007 startLandObject.SendLandUpdateToAvatarsOverMe();
1183 m_scene.ForEachClient(SendParcelOverlay); 1008 m_scene.ForEachClient(SendParcelOverlay);
1184>>>>>>> avn/ubitvar 1009
1185 } 1010 }
1186 1011
1187 /// <summary> 1012 /// <summary>
@@ -1263,15 +1088,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1263 1088
1264 #region Parcel Updating 1089 #region Parcel Updating
1265 1090
1266<<<<<<< HEAD
1267 // Send parcel layer info for the whole region
1268 public void SendParcelOverlay(IClientAPI remote_client)
1269 {
1270 SendParcelOverlay(remote_client, 0, 0, (int)Constants.MaximumRegionSize);
1271 }
1272=======
1273>>>>>>> avn/ubitvar
1274
1275 /// <summary> 1091 /// <summary>
1276 /// Send the parcel overlay blocks to the client. We send the overlay packets 1092 /// Send the parcel overlay blocks to the client. We send the overlay packets
1277 /// around a location and limited by the 'parcelLayerViewDistance'. This number 1093 /// around a location and limited by the 'parcelLayerViewDistance'. This number
@@ -1285,7 +1101,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1285 /// <param name="xPlace">X position in the region to send surrounding parcel layer info</param> 1101 /// <param name="xPlace">X position in the region to send surrounding parcel layer info</param>
1286 /// <param name="yPlace">y position in the region to send surrounding parcel layer info</param> 1102 /// <param name="yPlace">y position in the region to send surrounding parcel layer info</param>
1287 /// <param name="layerViewDistance">Distance from x,y position to send parcel layer info</param> 1103 /// <param name="layerViewDistance">Distance from x,y position to send parcel layer info</param>
1288 private void SendParcelOverlay(IClientAPI remote_client, int xPlace, int yPlace, int layerViewDistance) 1104 public void SendParcelOverlay(IClientAPI remote_client)
1289 { 1105 {
1290 if (remote_client.SceneAgent.PresenceType == PresenceType.Npc) 1106 if (remote_client.SceneAgent.PresenceType == PresenceType.Npc)
1291 return; 1107 return;
@@ -1295,149 +1111,18 @@ namespace OpenSim.Region.CoreModules.World.Land
1295 byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; 1111 byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET];
1296 int byteArrayCount = 0; 1112 int byteArrayCount = 0;
1297 int sequenceID = 0; 1113 int sequenceID = 0;
1298<<<<<<< HEAD
1299
1300 int xLow = 0;
1301 int xHigh = (int)m_scene.RegionInfo.RegionSizeX;
1302 int yLow = 0;
1303 int yHigh = (int)m_scene.RegionInfo.RegionSizeY;
1304
1305 if (shouldLimitParcelLayerInfoToViewDistance)
1306 {
1307 // Compute view distance around the given point
1308 int txLow = xPlace - layerViewDistance;
1309 int txHigh = xPlace + layerViewDistance;
1310 // If the distance is outside the region area, move the view distance to ba all in the region
1311 if (txLow < xLow)
1312=======
1313 1114
1314 // Layer data is in landUnit (4m) chunks 1115 // Layer data is in LandUnit (4m) chunks
1315 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += landUnit) 1116 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY; y += LandUnit)
1316 { 1117 {
1317 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += landUnit) 1118 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX; x += LandUnit)
1318>>>>>>> avn/ubitvar
1319 { 1119 {
1320 txLow = xLow; 1120 byte tempByte = 0; //This represents the byte for the current 4x4
1321 txHigh = Math.Min(yLow + (layerViewDistance * 2), xHigh);
1322 }
1323 if (txHigh > xHigh)
1324 {
1325 txLow = Math.Max(xLow, xHigh - (layerViewDistance * 2));
1326 txHigh = xHigh;
1327 }
1328 xLow = txLow;
1329 xHigh = txHigh;
1330 1121
1331<<<<<<< HEAD
1332 int tyLow = yPlace - layerViewDistance;
1333 int tyHigh = yPlace + layerViewDistance;
1334 if (tyLow < yLow)
1335 {
1336 tyLow = yLow;
1337 tyHigh = Math.Min(yLow + (layerViewDistance * 2), yHigh);
1338 }
1339 if (tyHigh > yHigh)
1340 {
1341 tyLow = Math.Max(yLow, yHigh - (layerViewDistance * 2));
1342 tyHigh = yHigh;
1343 }
1344 yLow = tyLow;
1345 yHigh = tyHigh;
1346 }
1347 // m_log.DebugFormat("{0} SendParcelOverlay: place=<{1},{2}>, vDist={3}, xLH=<{4},{5}, yLH=<{6},{7}>",
1348 // LogHeader, xPlace, yPlace, layerViewDistance, xLow, xHigh, yLow, yHigh);
1349=======
1350 ILandObject currentParcelBlock = GetLandObject(x, y); 1122 ILandObject currentParcelBlock = GetLandObject(x, y);
1351>>>>>>> avn/ubitvar
1352 1123
1353 // Layer data is in landUnit (4m) chunks 1124 if (currentParcelBlock != null)
1354 for (int y = yLow; y < yHigh / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++)
1355 {
1356 for (int x = xLow; x < xHigh / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++)
1357 {
1358 byteArray[byteArrayCount] = BuildLayerByte(GetLandObject(x * LandUnit, y * LandUnit), x, y, remote_client);
1359 byteArrayCount++;
1360 if (byteArrayCount >= LAND_BLOCKS_PER_PACKET)
1361 { 1125 {
1362<<<<<<< HEAD
1363 // m_log.DebugFormat("{0} SendParcelOverlay, sending packet, bytes={1}", LogHeader, byteArray.Length);
1364 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1365 byteArrayCount = 0;
1366 sequenceID++;
1367 byteArray = new byte[LAND_BLOCKS_PER_PACKET];
1368 }
1369
1370 }
1371 }
1372
1373 if (byteArrayCount != 0)
1374 {
1375 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1376 // m_log.DebugFormat("{0} SendParcelOverlay, complete sending packet, bytes={1}", LogHeader, byteArray.Length);
1377 }
1378 }
1379
1380 private byte BuildLayerByte(ILandObject currentParcelBlock, int x, int y, IClientAPI remote_client)
1381 {
1382 byte tempByte = 0; //This represents the byte for the current 4x4
1383
1384 if (currentParcelBlock != null)
1385 {
1386 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId)
1387 {
1388 //Owner Flag
1389 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER);
1390 }
1391 else if (currentParcelBlock.LandData.SalePrice > 0 &&
1392 (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero ||
1393 currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId))
1394 {
1395 //Sale Flag
1396 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_IS_FOR_SALE);
1397 }
1398 else if (currentParcelBlock.LandData.OwnerID == UUID.Zero)
1399 {
1400 //Public Flag
1401 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_PUBLIC);
1402 }
1403 else
1404 {
1405 //Other Flag
1406 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_OTHER);
1407 }
1408
1409 //Now for border control
1410
1411 ILandObject westParcel = null;
1412 ILandObject southParcel = null;
1413 if (x > 0)
1414 {
1415 westParcel = GetLandObject((x - 1) * LandUnit, y * LandUnit);
1416 }
1417 if (y > 0)
1418 {
1419 southParcel = GetLandObject(x * LandUnit, (y - 1) * LandUnit);
1420 }
1421
1422 if (x == 0)
1423 {
1424 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST);
1425 }
1426 else if (westParcel != null && westParcel != currentParcelBlock)
1427 {
1428 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_WEST);
1429 }
1430
1431 if (y == 0)
1432 {
1433 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH);
1434 }
1435 else if (southParcel != null && southParcel != currentParcelBlock)
1436 {
1437 tempByte = Convert.ToByte(tempByte | LandChannel.LAND_FLAG_PROPERTY_BORDER_SOUTH);
1438 }
1439
1440=======
1441 // types 1126 // types
1442 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId) 1127 if (currentParcelBlock.LandData.OwnerID == remote_client.AgentId)
1443 { 1128 {
@@ -1525,10 +1210,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1525 if (byteArrayCount > 0) 1210 if (byteArrayCount > 0)
1526 { 1211 {
1527 remote_client.SendLandParcelOverlay(byteArray, sequenceID); 1212 remote_client.SendLandParcelOverlay(byteArray, sequenceID);
1528>>>>>>> avn/ubitvar
1529 } 1213 }
1530
1531 return tempByte;
1532 } 1214 }
1533 1215
1534 public void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id, 1216 public void ClientOnParcelPropertiesRequest(int start_x, int start_y, int end_x, int end_y, int sequence_id,
@@ -1569,10 +1251,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1569 temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client); 1251 temp[i].SendLandProperties(sequence_id, snap_selection, requestResult, remote_client);
1570 } 1252 }
1571 1253
1572<<<<<<< HEAD
1573 // Also send the layer data around the point of interest
1574 SendParcelOverlay(remote_client, (start_x + end_x) / 2, (start_y + end_y) / 2, parcelLayerViewDistance);
1575=======
1576// SendParcelOverlay(remote_client); 1254// SendParcelOverlay(remote_client);
1577 } 1255 }
1578 1256
@@ -1612,7 +1290,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1612 avatar.currentParcelUUID = parcelID; // force parcel flags review 1290 avatar.currentParcelUUID = parcelID; // force parcel flags review
1613 }); 1291 });
1614 } 1292 }
1615>>>>>>> avn/ubitvar
1616 } 1293 }
1617 1294
1618 public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client) 1295 public void ClientOnParcelPropertiesUpdateRequest(LandUpdateArgs args, int localID, IClientAPI remote_client)
@@ -1821,35 +1498,17 @@ namespace OpenSim.Region.CoreModules.World.Land
1821 for (int i = 0; i < data.Count; i++) 1498 for (int i = 0; i < data.Count; i++)
1822 IncomingLandObjectFromStorage(data[i]); 1499 IncomingLandObjectFromStorage(data[i]);
1823 1500
1824<<<<<<< HEAD 1501 // Layer data is in LandUnit (4m) chunks
1825 // Prevent race conditions from any auto-creation of new parcels for varregions whilst we are still loading
1826 // the existing parcels.
1827 lock (m_landList)
1828 {
1829 for (int i = 0; i < data.Count; i++)
1830 IncomingLandObjectFromStorage(data[i]);
1831
1832 // Layer data is in landUnit (4m) chunks
1833 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++) 1502 for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); y++)
1834 { 1503 {
1835 for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize * (Constants.TerrainPatchSize / LandUnit); x++) 1504 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
1842 { 1505 {
1843 if (m_landIDList[x, y] == 0) 1506 if (m_landIDList[x, y] == 0)
1844 { 1507 {
1845 if (m_landList.Count == 1) 1508 if (m_landList.Count == 1)
1846 { 1509 {
1847 m_log.DebugFormat( 1510 m_log.DebugFormat(
1848<<<<<<< HEAD
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}", 1511 "[{0}]: Auto-extending land parcel as landID at {1},{2} is 0 and only one land parcel is present in {3}",
1852>>>>>>> avn/ubitvar
1853 LogHeader, x, y, m_scene.Name); 1512 LogHeader, x, y, m_scene.Name);
1854 1513
1855 int onlyParcelID = 0; 1514 int onlyParcelID = 0;
@@ -1872,19 +1531,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1872 else if (m_landList.Count > 1) 1531 else if (m_landList.Count > 1)
1873 { 1532 {
1874 m_log.DebugFormat( 1533 m_log.DebugFormat(
1875<<<<<<< HEAD
1876 "{0}: Auto-creating land parcel as landID at {1},{2} is 0 and more than one land parcel is present in {3}",
1877 LogHeader, x, y, m_scene.Name);
1878
1879 // There are several other parcels so we must create a new one for the unassigned space
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}", 1534 "{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); 1535 LogHeader, x, y, m_scene.Name);
1884 1536
1885 // There are several other parcels so we must create a new one for the unassigned space 1537 // 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); 1538 ILandObject newLand = new LandObject(UUID.Zero, false, m_scene);
1887>>>>>>> avn/ubitvar
1888 // Claim all the unclaimed "0" ids 1539 // Claim all the unclaimed "0" ids
1889 newLand.SetLandBitmap(CreateBitmapForID(0)); 1540 newLand.SetLandBitmap(CreateBitmapForID(0));
1890 newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 1541 newLand.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
@@ -1895,11 +1546,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1895 { 1546 {
1896 // We should never reach this point as the separate code path when no land data exists should have fired instead. 1547 // We should never reach this point as the separate code path when no land data exists should have fired instead.
1897 m_log.WarnFormat( 1548 m_log.WarnFormat(
1898<<<<<<< HEAD
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", 1549 "{0}: Ignoring request to auto-create parcel in {1} as there are no other parcels present",
1902>>>>>>> avn/ubitvar
1903 LogHeader, m_scene.Name); 1550 LogHeader, m_scene.Name);
1904 } 1551 }
1905 } 1552 }
@@ -1910,13 +1557,9 @@ namespace OpenSim.Region.CoreModules.World.Land
1910 1557
1911 private void IncomingLandObjectFromStorage(LandData data) 1558 private void IncomingLandObjectFromStorage(LandData data)
1912 { 1559 {
1913<<<<<<< HEAD
1914 ILandObject new_land = new LandObject(data, m_scene);
1915=======
1916
1917 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); 1560 ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
1918 new_land.LandData = data.Copy(); 1561 new_land.LandData = data.Copy();
1919>>>>>>> avn/ubitvar 1562
1920 new_land.SetLandBitmapFromByteArray(); 1563 new_land.SetLandBitmapFromByteArray();
1921 AddLandObject(new_land); 1564 AddLandObject(new_land);
1922// new_land.SendLandUpdateToAvatarsOverMe(); 1565// new_land.SendLandUpdateToAvatarsOverMe();
@@ -2568,17 +2211,6 @@ namespace OpenSim.Region.CoreModules.World.Land
2568 2211
2569 private void AppendParcelsSummaryReport(StringBuilder report) 2212 private void AppendParcelsSummaryReport(StringBuilder report)
2570 { 2213 {
2571<<<<<<< HEAD
2572 report.AppendFormat("Land information for {0}\n", m_scene.Name);
2573
2574 ConsoleDisplayTable cdt = new ConsoleDisplayTable();
2575 cdt.AddColumn("Parcel Name", ConsoleDisplayUtil.ParcelNameSize);
2576 cdt.AddColumn("ID", 3);
2577 cdt.AddColumn("Area", 6);
2578 cdt.AddColumn("Starts", ConsoleDisplayUtil.VectorSize);
2579 cdt.AddColumn("Ends", ConsoleDisplayUtil.VectorSize);
2580 cdt.AddColumn("Owner", ConsoleDisplayUtil.UserNameSize);
2581=======
2582 report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); 2214 report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName);
2583 report.AppendFormat( 2215 report.AppendFormat(
2584 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", 2216 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n",
@@ -2588,27 +2220,12 @@ namespace OpenSim.Region.CoreModules.World.Land
2588 "AABBMin", 2220 "AABBMin",
2589 "AABBMax", 2221 "AABBMax",
2590 "Owner"); 2222 "Owner");
2591>>>>>>> avn/ubitvar
2592 2223
2593 lock (m_landList) 2224 lock (m_landList)
2594 { 2225 {
2595 foreach (ILandObject lo in m_landList.Values) 2226 foreach (ILandObject lo in m_landList.Values)
2596 { 2227 {
2597 LandData ld = lo.LandData; 2228 LandData ld = lo.LandData;
2598<<<<<<< HEAD
2599 string ownerName;
2600 if (ld.IsGroupOwned)
2601 {
2602 GroupRecord rec = m_groupManager.GetGroupRecord(ld.GroupID);
2603 ownerName = (rec != null) ? rec.GroupName : "Unknown Group";
2604 }
2605 else
2606 {
2607 ownerName = m_userManager.GetUserName(ld.OwnerID);
2608 }
2609 cdt.AddRow(
2610 ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, ownerName);
2611=======
2612 2229
2613 report.AppendFormat( 2230 report.AppendFormat(
2614 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", 2231 "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n",
@@ -2636,11 +2253,8 @@ namespace OpenSim.Region.CoreModules.World.Land
2636 else 2253 else
2637 { 2254 {
2638 ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); 2255 ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition);
2639>>>>>>> avn/ubitvar
2640 } 2256 }
2641 } 2257 }
2642
2643 report.Append(cdt.ToString());
2644 } 2258 }
2645 2259
2646 private void AppendParcelReport(StringBuilder report, ILandObject lo) 2260 private void AppendParcelReport(StringBuilder report, ILandObject lo)
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 3b81d6b..040c90b 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -46,20 +46,12 @@ 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
50
51 private readonly int landUnit = 4;
52
53 private int m_lastSeqId = 0;
54
55=======
56 49
57 private readonly int landUnit = 4; 50 private readonly int landUnit = 4;
58 51
59 private int m_lastSeqId = 0; 52 private int m_lastSeqId = 0;
60 private int m_expiryCounter = 0; 53 private int m_expiryCounter = 0;
61 54
62>>>>>>> avn/ubitvar
63 protected Scene m_scene; 55 protected Scene m_scene;
64 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); 56 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
65 protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); 57 protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>();
@@ -67,16 +59,12 @@ namespace OpenSim.Region.CoreModules.World.Land
67 protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>(); 59 protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>();
68 protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds 60 protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds
69 61
70<<<<<<< HEAD
71 public bool[,] LandBitmap { get; set; }
72=======
73 private bool[,] m_landBitmap; 62 private bool[,] m_landBitmap;
74 public bool[,] LandBitmap 63 public bool[,] LandBitmap
75 { 64 {
76 get { return m_landBitmap; } 65 get { return m_landBitmap; }
77 set { m_landBitmap = value; } 66 set { m_landBitmap = value; }
78 } 67 }
79>>>>>>> avn/ubitvar
80 68
81 #endregion 69 #endregion
82 70
@@ -87,9 +75,6 @@ namespace OpenSim.Region.CoreModules.World.Land
87 return free; 75 return free;
88 } 76 }
89 77
90<<<<<<< HEAD
91 public LandData LandData { get; set; }
92=======
93 protected LandData m_landData; 78 protected LandData m_landData;
94 public LandData LandData 79 public LandData LandData
95 { 80 {
@@ -97,7 +82,6 @@ namespace OpenSim.Region.CoreModules.World.Land
97 82
98 set { m_landData = value; } 83 set { m_landData = value; }
99 } 84 }
100>>>>>>> avn/ubitvar
101 85
102 public IPrimCounts PrimCounts { get; set; } 86 public IPrimCounts PrimCounts { get; set; }
103 87
@@ -225,12 +209,6 @@ namespace OpenSim.Region.CoreModules.World.Land
225 else 209 else
226 { 210 {
227 // Normal Calculations 211 // Normal Calculations
228<<<<<<< HEAD
229 int parcelMax = (int)(((float)LandData.Area / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY))
230 * (float)m_scene.RegionInfo.ObjectCapacity
231 * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
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 212 int parcelMax = (int)( (long)LandData.Area
235 * (long)m_scene.RegionInfo.ObjectCapacity 213 * (long)m_scene.RegionInfo.ObjectCapacity
236 * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus 214 * (long)m_scene.RegionInfo.RegionSettings.ObjectBonus
@@ -252,7 +230,6 @@ namespace OpenSim.Region.CoreModules.World.Land
252 int parcelMax = (int)((long)LandData.Area 230 int parcelMax = (int)((long)LandData.Area
253 * (long)m_scene.RegionInfo.ObjectCapacity 231 * (long)m_scene.RegionInfo.ObjectCapacity
254 / 65536L); 232 / 65536L);
255>>>>>>> avn/ubitvar
256 return parcelMax; 233 return parcelMax;
257 } 234 }
258 } 235 }
@@ -266,15 +243,10 @@ namespace OpenSim.Region.CoreModules.World.Land
266 else 243 else
267 { 244 {
268 //Normal Calculations 245 //Normal Calculations
269<<<<<<< HEAD
270 int simMax = (int)(((float)LandData.SimwideArea / (m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY))
271 * (float)m_scene.RegionInfo.ObjectCapacity);
272=======
273 int simMax = (int)( (long)LandData.SimwideArea 246 int simMax = (int)( (long)LandData.SimwideArea
274 * (long)m_scene.RegionInfo.ObjectCapacity 247 * (long)m_scene.RegionInfo.ObjectCapacity
275 / (long)(m_scene.RegionInfo.RegionSizeX * m_scene.RegionInfo.RegionSizeY) ); 248 / (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); 249 // m_log.DebugFormat("Simwide Area: {0}, Capacity {1}, SimMax {2}", LandData.SimwideArea, m_scene.RegionInfo.ObjectCapacity, simMax);
277>>>>>>> avn/ubitvar
278 return simMax; 250 return simMax;
279 } 251 }
280 } 252 }
@@ -439,12 +411,6 @@ namespace OpenSim.Region.CoreModules.World.Land
439 { 411 {
440 uint preserve = LandData.Flags & ~allowedDelta; 412 uint preserve = LandData.Flags & ~allowedDelta;
441 newData.Flags = preserve | (args.ParcelFlags & allowedDelta); 413 newData.Flags = preserve | (args.ParcelFlags & allowedDelta);
442<<<<<<< HEAD
443
444 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
445 SendLandUpdateToAvatarsOverMe(snap_selection);
446 }
447=======
448 414
449 uint curdelta = LandData.Flags ^ newData.Flags; 415 uint curdelta = LandData.Flags ^ newData.Flags;
450 curdelta &= (uint)(ParcelFlags.SoundLocal); 416 curdelta &= (uint)(ParcelFlags.SoundLocal);
@@ -456,7 +422,6 @@ namespace OpenSim.Region.CoreModules.World.Land
456 return true; 422 return true;
457 } 423 }
458 return false; 424 return false;
459>>>>>>> avn/ubitvar
460 } 425 }
461 426
462 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) 427 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area)
@@ -806,17 +771,11 @@ namespace OpenSim.Region.CoreModules.World.Land
806 /// </summary> 771 /// </summary>
807 private void UpdateAABBAndAreaValues() 772 private void UpdateAABBAndAreaValues()
808 { 773 {
809<<<<<<< HEAD 774
810 int min_x = 10000;
811 int min_y = 10000;
812 int max_x = 0;
813 int max_y = 0;
814=======
815 int min_x = Int32.MaxValue; 775 int min_x = Int32.MaxValue;
816 int min_y = Int32.MaxValue; 776 int min_y = Int32.MaxValue;
817 int max_x = Int32.MinValue; 777 int max_x = Int32.MinValue;
818 int max_y = Int32.MinValue; 778 int max_y = Int32.MinValue;
819>>>>>>> avn/ubitvar
820 int tempArea = 0; 779 int tempArea = 0;
821 int x, y; 780 int x, y;
822 for (x = 0; x < LandBitmap.GetLength(0); x++) 781 for (x = 0; x < LandBitmap.GetLength(0); x++)
@@ -825,12 +784,6 @@ namespace OpenSim.Region.CoreModules.World.Land
825 { 784 {
826 if (LandBitmap[x, y] == true) 785 if (LandBitmap[x, y] == true)
827 { 786 {
828<<<<<<< HEAD
829 if (min_x > x) min_x = x;
830 if (min_y > y) min_y = y;
831 if (max_x < x) max_x = x;
832 if (max_y < y) max_y = y;
833=======
834 if (min_x > x) 787 if (min_x > x)
835 min_x = x; 788 min_x = x;
836 if (min_y > y) 789 if (min_y > y)
@@ -839,7 +792,6 @@ namespace OpenSim.Region.CoreModules.World.Land
839 max_x = x; 792 max_x = x;
840 if (max_y < y) 793 if (max_y < y)
841 max_y = y; 794 max_y = y;
842>>>>>>> avn/ubitvar
843 tempArea += landUnit * landUnit; //16sqm peice of land 795 tempArea += landUnit * landUnit; //16sqm peice of land
844 } 796 }
845 } 797 }
@@ -847,27 +799,6 @@ namespace OpenSim.Region.CoreModules.World.Land
847 int tx = min_x * landUnit; 799 int tx = min_x * landUnit;
848 if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1)) 800 if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1))
849 tx = ((int)m_scene.RegionInfo.RegionSizeX - 1); 801 tx = ((int)m_scene.RegionInfo.RegionSizeX - 1);
850<<<<<<< HEAD
851 int ty = min_y * landUnit;
852 if (ty > ((int)m_scene.RegionInfo.RegionSizeY - 1))
853 ty = ((int)m_scene.RegionInfo.RegionSizeY - 1);
854
855 LandData.AABBMin =
856 new Vector3(
857 (float)(min_x * landUnit), (float)(min_y * landUnit), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0);
858
859 tx = max_x * landUnit;
860 if (tx > ((int)m_scene.RegionInfo.RegionSizeX - 1))
861 tx = ((int)m_scene.RegionInfo.RegionSizeX - 1);
862 ty = max_y * landUnit;
863 if (ty > ((int)m_scene.RegionInfo.RegionSizeY - 1))
864 ty = ((int)m_scene.RegionInfo.RegionSizeY - 1);
865
866 LandData.AABBMax
867 = new Vector3(
868 (float)(max_x * landUnit), (float)(max_y * landUnit), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0);
869=======
870
871 int htx; 802 int htx;
872 if (tx >= ((int)m_scene.RegionInfo.RegionSizeX)) 803 if (tx >= ((int)m_scene.RegionInfo.RegionSizeX))
873 htx = (int)m_scene.RegionInfo.RegionSizeX - 1; 804 htx = (int)m_scene.RegionInfo.RegionSizeX - 1;
@@ -904,7 +835,6 @@ namespace OpenSim.Region.CoreModules.World.Land
904 LandData.AABBMax 835 LandData.AABBMax
905 = new Vector3( 836 = new Vector3(
906 (float)(tx), (float)(ty), m_scene != null ? (float)m_scene.Heightmap[htx, hty] : 0); 837 (float)(tx), (float)(ty), m_scene != null ? (float)m_scene.Heightmap[htx, hty] : 0);
907>>>>>>> avn/ubitvar
908 838
909 LandData.Area = tempArea; 839 LandData.Area = tempArea;
910 } 840 }
@@ -920,10 +850,6 @@ namespace OpenSim.Region.CoreModules.World.Land
920 public void SetLandBitmap(bool[,] bitmap) 850 public void SetLandBitmap(bool[,] bitmap)
921 { 851 {
922 LandBitmap = bitmap; 852 LandBitmap = bitmap;
923<<<<<<< HEAD
924 // m_log.DebugFormat("{0} SetLandBitmap. BitmapSize=<{1},{2}>", LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1));
925=======
926>>>>>>> avn/ubitvar
927 ForceUpdateLandInfo(); 853 ForceUpdateLandInfo();
928 } 854 }
929 855
@@ -1024,16 +950,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1024 private byte[] ConvertLandBitmapToBytes() 950 private byte[] ConvertLandBitmapToBytes()
1025 { 951 {
1026 byte[] tempConvertArr = new byte[LandBitmap.GetLength(0) * LandBitmap.GetLength(1) / 8]; 952 byte[] tempConvertArr = new byte[LandBitmap.GetLength(0) * LandBitmap.GetLength(1) / 8];
1027<<<<<<< HEAD 953
1028 byte tempByte = 0;
1029 int byteNum = 0;
1030 int i = 0;
1031=======
1032 int tempByte = 0; 954 int tempByte = 0;
1033 int i, byteNum = 0; 955 int i, byteNum = 0;
1034 int mask = 1; 956 int mask = 1;
1035 i = 0; 957 i = 0;
1036>>>>>>> avn/ubitvar
1037 for (int y = 0; y < LandBitmap.GetLength(1); y++) 958 for (int y = 0; y < LandBitmap.GetLength(1); y++)
1038 { 959 {
1039 for (int x = 0; x < LandBitmap.GetLength(0); x++) 960 for (int x = 0; x < LandBitmap.GetLength(0); x++)
@@ -1070,7 +991,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1070 // LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1)); 991 // LogHeader, LandBitmap.GetLength(0), LandBitmap.GetLength(1));
1071======= 992=======
1072 */ 993 */
1073>>>>>>> avn/ubitvar
1074 return tempConvertArr; 994 return tempConvertArr;
1075 } 995 }
1076 996
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
index a228e7a..5155804 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
@@ -104,7 +104,6 @@ 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
108 mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, 107 mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height,
109 System.Drawing.Imaging.PixelFormat.Format24bppRgb); 108 System.Drawing.Imaging.PixelFormat.Format24bppRgb);
110 //long t = System.Environment.TickCount; 109 //long t = System.Environment.TickCount;
@@ -113,17 +112,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
113 //} 112 //}
114 //t = System.Environment.TickCount - t; 113 //t = System.Environment.TickCount - t;
115 //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); 114 //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
126
127 if (drawPrimVolume) 115 if (drawPrimVolume)
128 { 116 {
129 DrawObjectVolume(m_scene, mapbmp); 117 DrawObjectVolume(m_scene, mapbmp);
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
index a9cc993..0ec2053 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
@@ -270,14 +270,8 @@ 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
274 private float getHeight(ITerrainChannel hm, int x, int y) { 273 private float getHeight(ITerrainChannel hm, int x, int y) {
275 if (x < (hm.Width - 1) && y < (hm.Height - 1)) 274 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
281 return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112); 275 return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112);
282 else 276 else
283 return (float)hm[x, y]; 277 return (float)hm[x, y];
@@ -294,14 +288,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
294 if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height) 288 if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height)
295 { 289 {
296 m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>", 290 m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>",
297 LogHeader, mapbmp.Width, mapbmp.Height, hm.Width, hm.Height);
298 }
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); 291 "[TEXTURED MAP TILE RENDERER]", mapbmp.Width, mapbmp.Height, hm.Width, hm.Height);
306 } 292 }
307 293
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs
index 236584a..d634e8b 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/FloodBrushes/NoiseArea.cs
@@ -46,10 +46,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FloodBrushes
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
50
51=======
52>>>>>>> avn/ubitvar
53 map[x, y] += noise * strength; 49 map[x, y] += noise * strength;
54 } 50 }
55 } 51 }
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 925de2a..22723fc 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -75,15 +75,6 @@ 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
87 78
88#pragma warning disable 414 79#pragma warning disable 414
89 private static readonly string LogHeader = "[TERRAIN MODULE]"; 80 private static readonly string LogHeader = "[TERRAIN MODULE]";
@@ -95,16 +86,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
95 private readonly Dictionary<string, ITerrainLoader> m_loaders = new Dictionary<string, ITerrainLoader>(); 86 private readonly Dictionary<string, ITerrainLoader> m_loaders = new Dictionary<string, ITerrainLoader>();
96 private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects = 87 private readonly Dictionary<StandardTerrainEffects, ITerrainPaintableEffect> m_painteffects =
97 new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>(); 88 new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>();
98<<<<<<< HEAD
99 private Dictionary<string, ITerrainEffect> m_plugineffects;
100 private Dictionary<string, ITerrainModifier> m_modifyOperations =
101 new Dictionary<string, ITerrainModifier>();
102 private ITerrainChannel m_channel;
103 private ITerrainChannel m_revert;
104 private Scene m_scene;
105 private volatile bool m_tainted;
106 private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5);
107=======
108 89
109 private Dictionary<string, ITerrainEffect> m_plugineffects; 90 private Dictionary<string, ITerrainEffect> m_plugineffects;
110 private ITerrainChannel m_channel; 91 private ITerrainChannel m_channel;
@@ -112,7 +93,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
112 private Scene m_scene; 93 private Scene m_scene;
113 private volatile bool m_tainted; 94 private volatile bool m_tainted;
114 95
115>>>>>>> avn/ubitvar
116 private String m_InitialTerrain = "pinhead-island"; 96 private String m_InitialTerrain = "pinhead-island";
117 97
118 // If true, send terrain patch updates to clients based on their view distance 98 // If true, send terrain patch updates to clients based on their view distance
@@ -126,19 +106,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
126 private bool[,] updated; // for each patch, whether it needs to be sent to this client 106 private bool[,] updated; // for each patch, whether it needs to be sent to this client
127 private int updateCount; // number of patches that need to be sent 107 private int updateCount; // number of patches that need to be sent
128 public ScenePresence Presence; // a reference to the client to send to 108 public ScenePresence Presence; // a reference to the client to send to
129<<<<<<< HEAD 109
130 public TerrainData Terrain; // reference to the underlying terrain
131=======
132>>>>>>> avn/ubitvar
133 public PatchUpdates(TerrainData terrData, ScenePresence pPresence) 110 public PatchUpdates(TerrainData terrData, ScenePresence pPresence)
134 { 111 {
135 updated = new bool[terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize]; 112 updated = new bool[terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize];
136 updateCount = 0; 113 updateCount = 0;
137 Presence = pPresence; 114 Presence = pPresence;
138<<<<<<< HEAD
139 Terrain = terrData;
140=======
141>>>>>>> avn/ubitvar
142 // Initially, send all patches to the client 115 // Initially, send all patches to the client
143 SetAll(true); 116 SetAll(true);
144 } 117 }
@@ -147,26 +120,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain
147 { 120 {
148 return (updateCount > 0); 121 return (updateCount > 0);
149 } 122 }
150<<<<<<< HEAD
151 123
152=======
153>>>>>>> avn/ubitvar
154 public void SetByXY(int x, int y, bool state) 124 public void SetByXY(int x, int y, bool state)
155 { 125 {
156 this.SetByPatch(x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, state); 126 this.SetByPatch(x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize, state);
157 } 127 }
158<<<<<<< HEAD
159 128
160=======
161>>>>>>> avn/ubitvar
162 public bool GetByPatch(int patchX, int patchY) 129 public bool GetByPatch(int patchX, int patchY)
163 { 130 {
164 return updated[patchX, patchY]; 131 return updated[patchX, patchY];
165 } 132 }
166<<<<<<< HEAD
167 133
168=======
169>>>>>>> avn/ubitvar
170 public void SetByPatch(int patchX, int patchY, bool state) 134 public void SetByPatch(int patchX, int patchY, bool state)
171 { 135 {
172 bool prevState = updated[patchX, patchY]; 136 bool prevState = updated[patchX, patchY];
@@ -176,24 +140,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain
176 updateCount--; 140 updateCount--;
177 updated[patchX, patchY] = state; 141 updated[patchX, patchY] = state;
178 } 142 }
179<<<<<<< HEAD
180 143
181 public void SetAll(bool state) 144 public void SetAll(bool state)
182 { 145 {
183 updateCount = 0; 146 updateCount = 0;
184 for(int xx = 0; xx < updated.GetLength(0); xx++)
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++) 147 for (int xx = 0; xx < updated.GetLength(0); xx++)
191 for (int yy = 0; yy < updated.GetLength(1); yy++) 148 for (int yy = 0; yy < updated.GetLength(1); yy++)
192>>>>>>> avn/ubitvar
193 updated[xx, yy] = state; 149 updated[xx, yy] = state;
194 if (state) 150 if (state)
195 updateCount = updated.GetLength(0) * updated.GetLength(1); 151 updateCount = updated.GetLength(0) * updated.GetLength(1);
196 } 152 }
153
197 // Logically OR's the terrain data's patch taint map into this client's update map. 154 // Logically OR's the terrain data's patch taint map into this client's update map.
198 public void SetAll(TerrainData terrData) 155 public void SetAll(TerrainData terrData)
199 { 156 {
@@ -206,15 +163,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain
206 terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize) 163 terrData.SizeX / Constants.TerrainPatchSize, terrData.SizeY / Constants.TerrainPatchSize)
207 ); 164 );
208 } 165 }
209<<<<<<< HEAD 166
210 for(int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize)
211 {
212 for(int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize)
213=======
214 for (int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize) 167 for (int xx = 0; xx < terrData.SizeX; xx += Constants.TerrainPatchSize)
215 { 168 {
216 for (int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize) 169 for (int yy = 0; yy < terrData.SizeY; yy += Constants.TerrainPatchSize)
217>>>>>>> avn/ubitvar
218 { 170 {
219 // Only set tainted. The patch bit may be set if the patch was to be sent later. 171 // Only set tainted. The patch bit may be set if the patch was to be sent later.
220 if (terrData.IsTaintedAt(xx, yy, false)) 172 if (terrData.IsTaintedAt(xx, yy, false))
@@ -275,20 +227,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain
275 (int)m_scene.RegionInfo.RegionSizeY, 227 (int)m_scene.RegionInfo.RegionSizeY,
276 (int)m_scene.RegionInfo.RegionSizeZ); 228 (int)m_scene.RegionInfo.RegionSizeZ);
277 m_scene.Heightmap = m_channel; 229 m_scene.Heightmap = m_channel;
278<<<<<<< HEAD 230
279 UpdateRevertMap();
280=======
281 UpdateBakedMap(); 231 UpdateBakedMap();
282>>>>>>> avn/ubitvar
283 } 232 }
284 else 233 else
285 { 234 {
286 m_channel = m_scene.Heightmap; 235 m_channel = m_scene.Heightmap;
287<<<<<<< HEAD
288 UpdateRevertMap();
289=======
290 UpdateBakedMap(); 236 UpdateBakedMap();
291>>>>>>> avn/ubitvar
292 } 237 }
293 238
294 m_scene.RegisterModuleInterface<ITerrainModule>(this); 239 m_scene.RegisterModuleInterface<ITerrainModule>(this);
@@ -296,11 +241,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
296 m_scene.EventManager.OnClientClosed += EventManager_OnClientClosed; 241 m_scene.EventManager.OnClientClosed += EventManager_OnClientClosed;
297 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; 242 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
298 m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick; 243 m_scene.EventManager.OnTerrainTick += EventManager_OnTerrainTick;
299<<<<<<< HEAD
300 m_scene.EventManager.OnFrame += EventManager_OnFrame;
301=======
302 m_scene.EventManager.OnTerrainCheckUpdates += EventManager_TerrainCheckUpdates; 244 m_scene.EventManager.OnTerrainCheckUpdates += EventManager_TerrainCheckUpdates;
303>>>>>>> avn/ubitvar
304 } 245 }
305 246
306 InstallDefaultEffects(); 247 InstallDefaultEffects();
@@ -339,11 +280,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
339 // remove the commands 280 // remove the commands
340 m_scene.UnregisterModuleCommander(m_commander.Name); 281 m_scene.UnregisterModuleCommander(m_commander.Name);
341 // remove the event-handlers 282 // remove the event-handlers
342<<<<<<< HEAD 283
343 m_scene.EventManager.OnFrame -= EventManager_OnFrame;
344=======
345 m_scene.EventManager.OnTerrainCheckUpdates -= EventManager_TerrainCheckUpdates; 284 m_scene.EventManager.OnTerrainCheckUpdates -= EventManager_TerrainCheckUpdates;
346>>>>>>> avn/ubitvar
347 m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick; 285 m_scene.EventManager.OnTerrainTick -= EventManager_OnTerrainTick;
348 m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; 286 m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole;
349 m_scene.EventManager.OnClientClosed -= EventManager_OnClientClosed; 287 m_scene.EventManager.OnClientClosed -= EventManager_OnClientClosed;
@@ -490,11 +428,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
490 { 428 {
491 ITerrainChannel channel = loader.Value.LoadStream(stream); 429 ITerrainChannel channel = loader.Value.LoadStream(stream);
492 m_channel.Merge(channel, displacement, radianRotation, rotationDisplacement); 430 m_channel.Merge(channel, displacement, radianRotation, rotationDisplacement);
493<<<<<<< HEAD
494 UpdateRevertMap();
495=======
496 UpdateBakedMap(); 431 UpdateBakedMap();
497>>>>>>> avn/ubitvar
498 } 432 }
499 catch(NotImplementedException) 433 catch(NotImplementedException)
500 { 434 {
@@ -574,27 +508,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain
574 508
575 // Someone diddled terrain outside the normal code paths. Set the taintedness for all clients. 509 // Someone diddled terrain outside the normal code paths. Set the taintedness for all clients.
576 // ITerrainModule.TaintTerrain() 510 // ITerrainModule.TaintTerrain()
577<<<<<<< HEAD
578 public void TaintTerrain()
579 {
580 lock(m_perClientPatchUpdates)
581 {
582 // Set the flags for all clients so the tainted patches will be sent out
583 foreach(PatchUpdates pups in m_perClientPatchUpdates.Values)
584=======
585 public void TaintTerrain () 511 public void TaintTerrain ()
586 { 512 {
587 lock (m_perClientPatchUpdates) 513 lock (m_perClientPatchUpdates)
588 { 514 {
589 // Set the flags for all clients so the tainted patches will be sent out 515 // Set the flags for all clients so the tainted patches will be sent out
590 foreach (PatchUpdates pups in m_perClientPatchUpdates.Values) 516 foreach (PatchUpdates pups in m_perClientPatchUpdates.Values)
591>>>>>>> avn/ubitvar
592 { 517 {
593 pups.SetAll(m_scene.Heightmap.GetTerrainData()); 518 pups.SetAll(m_scene.Heightmap.GetTerrainData());
594 } 519 }
595 } 520 }
596<<<<<<< HEAD
597=======
598 } 521 }
599 522
600 // ITerrainModule.PushTerrain() 523 // ITerrainModule.PushTerrain()
@@ -615,38 +538,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
615 pups.SetAll(true); 538 pups.SetAll(true);
616 } 539 }
617 } 540 }
618>>>>>>> avn/ubitvar
619 } 541 }
620 542
621 // ITerrainModule.PushTerrain()
622 public void PushTerrain(IClientAPI pClient)
623 {
624 // If view distance based, set the modified patch bits and the frame event will send the updates
625 if (m_sendTerrainUpdatesByViewDistance)
626 {
627 ScenePresence presence = m_scene.GetScenePresence(pClient.AgentId);
628 if (presence != null)
629 {
630 lock(m_perClientPatchUpdates)
631 {
632 PatchUpdates pups;
633 if (!m_perClientPatchUpdates.TryGetValue(pClient.AgentId, out pups))
634 {
635 // There is a ScenePresence without a send patch map. Create one.
636 pups = new PatchUpdates(m_scene.Heightmap.GetTerrainData(), presence);
637 m_perClientPatchUpdates.Add(presence.UUID, pups);
638 }
639 // By setting all to modified, the next update tick will send the patches
640 pups.SetAll(true);
641 }
642 }
643 }
644 else
645 {
646 // The traditional way is to call into the protocol stack to send them all.
647 pClient.SendLayerData(new float[10]);
648 }
649 }
650 #region Plugin Loading Methods 543 #region Plugin Loading Methods
651 544
652 private void LoadPlugins() 545 private void LoadPlugins()
@@ -750,6 +643,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
750 m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked); 643 m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked);
751 644
752 // Terrain Modifier operations 645 // Terrain Modifier operations
646/*
753 m_modifyOperations["min"] = new MinModifier(this); 647 m_modifyOperations["min"] = new MinModifier(this);
754 m_modifyOperations["max"] = new MaxModifier(this); 648 m_modifyOperations["max"] = new MaxModifier(this);
755 m_modifyOperations["raise"] = new RaiseModifier(this); 649 m_modifyOperations["raise"] = new RaiseModifier(this);
@@ -757,7 +651,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
757 m_modifyOperations["fill"] = new FillModifier(this); 651 m_modifyOperations["fill"] = new FillModifier(this);
758 m_modifyOperations["smooth"] = new SmoothModifier(this); 652 m_modifyOperations["smooth"] = new SmoothModifier(this);
759 m_modifyOperations["noise"] = new NoiseModifier(this); 653 m_modifyOperations["noise"] = new NoiseModifier(this);
760 654*/
761 // Filesystem load/save loaders 655 // Filesystem load/save loaders
762 m_loaders[".r32"] = new RAW32(); 656 m_loaders[".r32"] = new RAW32();
763 m_loaders[".f32"] = m_loaders[".r32"]; 657 m_loaders[".f32"] = m_loaders[".r32"];
@@ -778,24 +672,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
778 /// </summary> 672 /// </summary>
779 public void UpdateBakedMap() 673 public void UpdateBakedMap()
780 { 674 {
781<<<<<<< HEAD
782 /*
783 int x;
784 for (x = 0; x < m_channel.Width; x++)
785 {
786 int y;
787 for (y = 0; y < m_channel.Height; y++)
788 {
789 m_revert[x, y] = m_channel[x, y];
790 }
791 }
792 */
793 m_revert = m_channel.MakeCopy();
794=======
795 m_baked = m_channel.MakeCopy(); 675 m_baked = m_channel.MakeCopy();
796 m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked); 676 m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked);
797 m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked); 677 m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked);
798>>>>>>> avn/ubitvar
799 } 678 }
800 679
801 /// <summary> 680 /// <summary>
@@ -822,13 +701,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
822 { 701 {
823 ITerrainChannel channel = loader.Value.LoadFile(filename, offsetX, offsetY, 702 ITerrainChannel channel = loader.Value.LoadFile(filename, offsetX, offsetY,
824 fileWidth, fileHeight, 703 fileWidth, fileHeight,
825<<<<<<< HEAD
826 (int)m_scene.RegionInfo.RegionSizeX,
827 (int)m_scene.RegionInfo.RegionSizeY);
828=======
829 (int) m_scene.RegionInfo.RegionSizeX, 704 (int) m_scene.RegionInfo.RegionSizeX,
830 (int) m_scene.RegionInfo.RegionSizeY); 705 (int) m_scene.RegionInfo.RegionSizeY);
831>>>>>>> avn/ubitvar
832 m_scene.Heightmap = channel; 706 m_scene.Heightmap = channel;
833 m_channel = channel; 707 m_channel = channel;
834 UpdateBakedMap(); 708 UpdateBakedMap();
@@ -894,27 +768,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
894 } 768 }
895 769
896 /// <summary> 770 /// <summary>
897<<<<<<< HEAD
898 /// Called before processing of every simulation frame.
899=======
900>>>>>>> avn/ubitvar
901 /// This is used to check to see of any of the terrain is tainted and, if so, schedule 771 /// This is used to check to see of any of the terrain is tainted and, if so, schedule
902 /// updates for all the presences. 772 /// updates for all the presences.
903 /// This also checks to see if there are updates that need to be sent for each presence. 773 /// This also checks to see if there are updates that need to be sent for each presence.
904 /// This is where the logic is to send terrain updates to clients. 774 /// This is where the logic is to send terrain updates to clients.
905 /// </summary> 775 /// </summary>
906<<<<<<< HEAD
907 private void EventManager_OnFrame()
908 {
909 TerrainData terrData = m_channel.GetTerrainData();
910
911 bool shouldTaint = false;
912 for(int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize)
913 {
914 for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
915 {
916 if (terrData.IsTaintedAt(x, y))
917=======
918 private void EventManager_TerrainCheckUpdates() 776 private void EventManager_TerrainCheckUpdates()
919 { 777 {
920 // this needs fixing 778 // this needs fixing
@@ -926,7 +784,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
926 for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) 784 for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
927 { 785 {
928 if (terrData.IsTaintedAt(x, y,true)) 786 if (terrData.IsTaintedAt(x, y,true))
929>>>>>>> avn/ubitvar
930 { 787 {
931 // Found a patch that was modified. Push this flag into the clients. 788 // Found a patch that was modified. Push this flag into the clients.
932 SendToClients(terrData, x, y); 789 SendToClients(terrData, x, y);
@@ -944,10 +801,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
944 m_scene.EventManager.TriggerTerrainTainted(); 801 m_scene.EventManager.TriggerTerrainTainted();
945 m_tainted = true; 802 m_tainted = true;
946 } 803 }
947<<<<<<< HEAD
948=======
949
950>>>>>>> avn/ubitvar
951 } 804 }
952 805
953 /// <summary> 806 /// <summary>
@@ -1016,14 +869,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1016 presence.ControllingClient.OnLandUndo -= client_OnLandUndo; 869 presence.ControllingClient.OnLandUndo -= client_OnLandUndo;
1017 presence.ControllingClient.OnUnackedTerrain -= client_OnUnackedTerrain; 870 presence.ControllingClient.OnUnackedTerrain -= client_OnUnackedTerrain;
1018 } 871 }
1019<<<<<<< HEAD
1020
1021 lock(m_perClientPatchUpdates)
1022 m_perClientPatchUpdates.Remove(client);
1023 }
1024=======
1025>>>>>>> avn/ubitvar
1026
1027 lock (m_perClientPatchUpdates) 872 lock (m_perClientPatchUpdates)
1028 m_perClientPatchUpdates.Remove(client); 873 m_perClientPatchUpdates.Remove(client);
1029 } 874 }
@@ -1038,21 +883,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1038 TerrainData terrData = m_channel.GetTerrainData(); 883 TerrainData terrData = m_channel.GetTerrainData();
1039 884
1040 bool wasLimited = false; 885 bool wasLimited = false;
1041<<<<<<< HEAD
1042 for(int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize)
1043 {
1044 for(int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
1045 {
1046 if (terrData.IsTaintedAt(x, y, false /* clearOnTest */))
1047 {
1048=======
1049 for (int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize) 886 for (int x = 0; x < terrData.SizeX; x += Constants.TerrainPatchSize)
1050 { 887 {
1051 for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize) 888 for (int y = 0; y < terrData.SizeY; y += Constants.TerrainPatchSize)
1052 { 889 {
1053 if (terrData.IsTaintedAt(x, y, false /* clearOnTest */)) 890 if (terrData.IsTaintedAt(x, y, false /* clearOnTest */))
1054 { 891 {
1055>>>>>>> avn/ubitvar
1056 // If we should respect the estate settings then 892 // If we should respect the estate settings then
1057 // fixup and height deltas that don't respect them. 893 // fixup and height deltas that don't respect them.
1058 // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values. 894 // Note that LimitChannelChanges() modifies the TerrainChannel with the limited height values.
@@ -1075,22 +911,13 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1075 float maxDelta = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; 911 float maxDelta = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit;
1076 912
1077 // loop through the height map for this patch and compare it against 913 // loop through the height map for this patch and compare it against
1078<<<<<<< HEAD
1079 // the revert map
1080 for(int x = xStart; x < xStart + Constants.TerrainPatchSize; x++)
1081=======
1082 // the baked map 914 // the baked map
1083 for (int x = xStart; x < xStart + Constants.TerrainPatchSize; x++) 915 for (int x = xStart; x < xStart + Constants.TerrainPatchSize; x++)
1084>>>>>>> avn/ubitvar
1085 { 916 {
1086 for(int y = yStart; y < yStart + Constants.TerrainPatchSize; y++) 917 for(int y = yStart; y < yStart + Constants.TerrainPatchSize; y++)
1087 { 918 {
1088 float requestedHeight = terrData[x, y]; 919 float requestedHeight = terrData[x, y];
1089<<<<<<< HEAD
1090 float bakedHeight = (float)m_revert[x, y];
1091=======
1092 float bakedHeight = (float)m_baked[x, y]; 920 float bakedHeight = (float)m_baked[x, y];
1093>>>>>>> avn/ubitvar
1094 float requestedDelta = requestedHeight - bakedHeight; 921 float requestedDelta = requestedHeight - bakedHeight;
1095 922
1096 if (requestedDelta > maxDelta) 923 if (requestedDelta > maxDelta)
@@ -1111,19 +938,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1111 938
1112 private void client_OnLandUndo(IClientAPI client) 939 private void client_OnLandUndo(IClientAPI client)
1113 { 940 {
1114<<<<<<< HEAD
1115 lock(m_undo)
1116 {
1117 if (m_undo.Count > 0)
1118 {
1119 LandUndoState goback = m_undo.Pop();
1120 if (goback != null)
1121 goback.PlaybackState();
1122 }
1123 }
1124=======
1125
1126>>>>>>> avn/ubitvar
1127 } 941 }
1128 942
1129 /// <summary> 943 /// <summary>
@@ -1133,175 +947,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1133 /// <param name="x">The patch corner to send</param> 947 /// <param name="x">The patch corner to send</param>
1134 /// <param name="y">The patch corner to send</param> 948 /// <param name="y">The patch corner to send</param>
1135 private void SendToClients(TerrainData terrData, int x, int y) 949 private void SendToClients(TerrainData terrData, int x, int y)
1136<<<<<<< HEAD
1137 {
1138 if (m_sendTerrainUpdatesByViewDistance)
1139 {
1140 // Add that this patch needs to be sent to the accounting for each client.
1141 lock(m_perClientPatchUpdates)
1142 {
1143 m_scene.ForEachScenePresence(presence =>
1144 {
1145 PatchUpdates thisClientUpdates;
1146 if (!m_perClientPatchUpdates.TryGetValue(presence.UUID, out thisClientUpdates))
1147 {
1148 // There is a ScenePresence without a send patch map. Create one.
1149 thisClientUpdates = new PatchUpdates(terrData, presence);
1150 m_perClientPatchUpdates.Add(presence.UUID, thisClientUpdates);
1151 }
1152 thisClientUpdates.SetByXY(x, y, true);
1153 }
1154 );
1155 }
1156 }
1157 else
1158 {
1159 // Legacy update sending where the update is sent out as soon as noticed
1160 // We know the actual terrain data that is passed is ignored so this passes a dummy heightmap.
1161 //float[] heightMap = terrData.GetFloatsSerialized();
1162 float[] heightMap = new float[10];
1163 m_scene.ForEachClient(
1164 delegate(IClientAPI controller)
1165 {
1166 controller.SendLayerData(x / Constants.TerrainPatchSize,
1167 y / Constants.TerrainPatchSize,
1168 heightMap);
1169 }
1170 );
1171 }
1172 }
1173
1174 private class PatchesToSend : IComparable<PatchesToSend>
1175 {
1176 public int PatchX;
1177 public int PatchY;
1178 public float Dist;
1179
1180 public PatchesToSend(int pX, int pY, float pDist)
1181 {
1182 PatchX = pX;
1183 PatchY = pY;
1184 Dist = pDist;
1185 }
1186
1187 public int CompareTo(PatchesToSend other)
1188 {
1189 return Dist.CompareTo(other.Dist);
1190 }
1191 }
1192
1193 // Called each frame time to see if there are any patches to send to any of the
1194 // ScenePresences.
1195 // We know this is only called if we are doing view distance patch sending so some
1196 // tests are not made.
1197 // Loop through all the per-client info and send any patches necessary.
1198 private void CheckSendingPatchesToClients()
1199 {
1200 lock(m_perClientPatchUpdates)
1201 {
1202 foreach(PatchUpdates pups in m_perClientPatchUpdates.Values)
1203 {
1204 if (pups.HasUpdates())
1205 {
1206 // There is something that could be sent to this client.
1207 List<PatchesToSend> toSend = GetModifiedPatchesInViewDistance(pups);
1208 if (toSend.Count > 0)
1209 {
1210 // m_log.DebugFormat("{0} CheckSendingPatchesToClient: sending {1} patches to {2} in region {3}",
1211 // LogHeader, toSend.Count, pups.Presence.Name, m_scene.RegionInfo.RegionName);
1212 // Sort the patches to send by the distance from the presence
1213 toSend.Sort();
1214 /* old way that sent individual patches
1215 foreach (PatchesToSend pts in toSend)
1216 {
1217 pups.Presence.ControllingClient.SendLayerData(pts.PatchX, pts.PatchY, null);
1218 // presence.ControllingClient.SendLayerData(xs.ToArray(), ys.ToArray(), null, TerrainPatch.LayerType.Land);
1219 }
1220 */
1221
1222 // new way that sends all patches to the protocol so they can be sent in one block
1223 int[] xPieces = new int[toSend.Count];
1224 int[] yPieces = new int[toSend.Count];
1225 float[] patchPieces = new float[toSend.Count * 2];
1226 int pieceIndex = 0;
1227 foreach(PatchesToSend pts in toSend)
1228 {
1229 patchPieces[pieceIndex++] = pts.PatchX;
1230 patchPieces[pieceIndex++] = pts.PatchY;
1231 }
1232 pups.Presence.ControllingClient.SendLayerData(-toSend.Count, 0, patchPieces);
1233 }
1234 }
1235 }
1236 }
1237 }
1238
1239 // Compute a list of modified patches that are within our view distance.
1240 private List<PatchesToSend> GetModifiedPatchesInViewDistance(PatchUpdates pups)
1241 {
1242 List<PatchesToSend> ret = new List<PatchesToSend>();
1243
1244 ScenePresence presence = pups.Presence;
1245 if (presence == null)
1246 return ret;
1247
1248 Vector3 presencePos = presence.AbsolutePosition;
1249
1250 // Before this distance check, the whole region just showed up. Adding the distance
1251 // check causes different things to happen for the current and adjacent regions.
1252 // So, to keep legacy views, if the region is legacy sized, don't do distance check.
1253 bool isLegacySizedRegion = pups.Terrain.SizeX == Constants.RegionSize && pups.Terrain.SizeY == Constants.RegionSize;
1254 bool shouldCheckViewDistance = m_sendTerrainUpdatesByViewDistance && !isLegacySizedRegion;
1255
1256 int startX = 0;
1257 int endX = (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize;
1258 int startY = 0;
1259 int endY = (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize;
1260
1261 // The following only reduces the size of area scanned for updates. Only significant for very large varregions.
1262 if (shouldCheckViewDistance)
1263 {
1264 // Compute the area of patches within our draw distance
1265 startX = (((int)(presencePos.X - presence.DrawDistance)) / Constants.TerrainPatchSize) - 2;
1266 startX = Math.Max(startX, 0);
1267 startX = Math.Min(startX, (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize);
1268 startY = (((int)(presencePos.Y - presence.DrawDistance)) / Constants.TerrainPatchSize) - 2;
1269 startY = Math.Max(startY, 0);
1270 startY = Math.Min(startY, (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize);
1271 endX = (((int)(presencePos.X + presence.DrawDistance)) / Constants.TerrainPatchSize) + 2;
1272 endX = Math.Max(endX, 0);
1273 endX = Math.Min(endX, (int)m_scene.RegionInfo.RegionSizeX / Constants.TerrainPatchSize);
1274 endY = (((int)(presencePos.Y + presence.DrawDistance)) / Constants.TerrainPatchSize) + 2;
1275 endY = Math.Max(endY, 0);
1276 endY = Math.Min(endY, (int)m_scene.RegionInfo.RegionSizeY / Constants.TerrainPatchSize);
1277 }
1278
1279 // m_log.DebugFormat("{0} GetModifiedPatchesInViewDistance. rName={1}, ddist={2}, apos={3}, cpos={4}, isChild={5}, start=<{6},{7}>, end=<{8},{9}>",
1280 // LogHeader, m_scene.RegionInfo.RegionName,
1281 // presence.DrawDistance, presencePos, presence.CameraPosition,
1282 // isLegacySizeChildRegion,
1283 // startX, startY, endX, endY);
1284 for(int x = startX; x < endX; x++)
1285 {
1286 for(int y = startY; y < endY; y++)
1287 {
1288 //Need to make sure we don't send the same ones over and over
1289 Vector3 patchPos = new Vector3(x * Constants.TerrainPatchSize, y * Constants.TerrainPatchSize, presencePos.Z);
1290 if (pups.GetByPatch(x, y))
1291 {
1292 //Check which has less distance, camera or avatar position, both have to be done.
1293 //Its not a radius, its a diameter and we add 50 so that it doesn't look like it cuts off
1294 if (!shouldCheckViewDistance
1295 || Util.DistanceLessThan(presencePos, patchPos, presence.DrawDistance + 50)
1296 || Util.DistanceLessThan(presence.CameraPosition, patchPos, presence.DrawDistance + 50))
1297 {
1298 //They can see it, send it to them
1299 pups.SetByPatch(x, y, false);
1300 float dist = Vector3.DistanceSquared(presencePos, patchPos);
1301 ret.Add(new PatchesToSend(x, y, dist));
1302 }
1303 }
1304=======
1305 { 950 {
1306 // Add that this patch needs to be sent to the accounting for each client. 951 // Add that this patch needs to be sent to the accounting for each client.
1307 lock (m_perClientPatchUpdates) 952 lock (m_perClientPatchUpdates)
@@ -1475,7 +1120,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1475 } 1120 }
1476 } 1121 }
1477 } 1122 }
1478>>>>>>> avn/ubitvar
1479 } 1123 }
1480 } 1124 }
1481 return ret; 1125 return ret;
@@ -1499,24 +1143,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1499 int zx = (int)(west + 0.5); 1143 int zx = (int)(west + 0.5);
1500 int zy = (int)(north + 0.5); 1144 int zy = (int)(north + 0.5);
1501 1145
1502<<<<<<< HEAD
1503 int dx;
1504 for(dx=-n; dx<=n; dx++)
1505 {
1506 int dy;
1507 for(dy=-n; dy<=n; dy++)
1508 {
1509 int x = zx + dx;
1510 int y = zy + dy;
1511 if (x >= 0 && y >= 0 && x < m_channel.Width && y < m_channel.Height)
1512 {
1513 if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x, y, 0)))
1514 {
1515 allowMask[x, y] = true;
1516 allowed = true;
1517 }
1518=======
1519
1520 int startX = zx - n; 1146 int startX = zx - n;
1521 if (startX < 0) 1147 if (startX < 0)
1522 startX = 0; 1148 startX = 0;
@@ -1542,25 +1168,17 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1542 { 1168 {
1543 allowMask[x, y] = true; 1169 allowMask[x, y] = true;
1544 allowed = true; 1170 allowed = true;
1545>>>>>>> avn/ubitvar
1546 } 1171 }
1547 } 1172 }
1548 } 1173 }
1549 if (allowed) 1174 if (allowed)
1550 { 1175 {
1551 StoreUndoState(); 1176 StoreUndoState();
1552<<<<<<< HEAD
1553 m_painteffects[(StandardTerrainEffects)action].PaintEffect(
1554 m_channel, allowMask, west, south, height, size, seconds);
1555
1556 //revert changes outside estate limits
1557=======
1558 m_painteffects[(StandardTerrainEffects) action].PaintEffect( 1177 m_painteffects[(StandardTerrainEffects) action].PaintEffect(
1559 m_channel, allowMask, west, south, height, size, seconds, 1178 m_channel, allowMask, west, south, height, size, seconds,
1560 startX, endX, startY, endY); 1179 startX, endX, startY, endY);
1561 1180
1562 //block changes outside estate limits 1181 //block changes outside estate limits
1563>>>>>>> avn/ubitvar
1564 if (!god) 1182 if (!god)
1565 EnforceEstateLimits(); 1183 EnforceEstateLimits();
1566 } 1184 }
@@ -1577,22 +1195,42 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1577 bool[,] fillArea = new bool[m_channel.Width, m_channel.Height]; 1195 bool[,] fillArea = new bool[m_channel.Width, m_channel.Height];
1578 fillArea.Initialize(); 1196 fillArea.Initialize();
1579 1197
1580 int x; 1198 int startX = (int)west;
1581 for(x = 0; x < m_channel.Width; x++) 1199 int startY = (int)south;
1200 int endX = (int)east;
1201 int endY = (int)north;
1202
1203 if (startX < 0)
1204 startX = 0;
1205 else if (startX >= m_channel.Width)
1206 startX = m_channel.Width - 1;
1207
1208 if (endX < 0)
1209 endX = 0;
1210 else if (endX >= m_channel.Width)
1211 endX = m_channel.Width - 1;
1212
1213 if (startY < 0)
1214 startY = 0;
1215 else if (startY >= m_channel.Height)
1216 startY = m_channel.Height - 1;
1217
1218 if (endY < 0)
1219 endY = 0;
1220 else if (endY >= m_channel.Height)
1221 endY = m_channel.Height - 1;
1222
1223
1224 int x, y;
1225
1226 for (x = startX; x <= endX; x++)
1582 { 1227 {
1583 int y; 1228 for (y = startY; y <= endY; y++)
1584 for(y = 0; y < m_channel.Height; y++)
1585 { 1229 {
1586 if (x < east && x > west) 1230 if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x, y, 0)))
1587 { 1231 {
1588 if (y < north && y > south) 1232 fillArea[x, y] = true;
1589 { 1233 allowed = true;
1590 if (m_scene.Permissions.CanTerraformLand(agentId, new Vector3(x, y, 0)))
1591 {
1592 fillArea[x, y] = true;
1593 allowed = true;
1594 }
1595 }
1596 } 1234 }
1597 } 1235 }
1598 } 1236 }
@@ -1600,15 +1238,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1600 if (allowed) 1238 if (allowed)
1601 { 1239 {
1602 StoreUndoState(); 1240 StoreUndoState();
1603<<<<<<< HEAD 1241 m_floodeffects[(StandardTerrainEffects)action].FloodEffect(m_channel, fillArea, size,
1604 m_floodeffects[(StandardTerrainEffects)action].FloodEffect(m_channel, fillArea, size); 1242 startX, endX, startY, endY);
1605
1606 //revert changes outside estate limits
1607=======
1608 m_floodeffects[(StandardTerrainEffects) action].FloodEffect(m_channel, fillArea, size);
1609 1243
1610 //block changes outside estate limits 1244 //block changes outside estate limits
1611>>>>>>> avn/ubitvar
1612 if (!god) 1245 if (!god)
1613 EnforceEstateLimits(); 1246 EnforceEstateLimits();
1614 } 1247 }
@@ -1641,52 +1274,22 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1641 1274
1642 private void StoreUndoState() 1275 private void StoreUndoState()
1643 { 1276 {
1644<<<<<<< HEAD
1645 lock(m_undo)
1646 {
1647 if (m_undo.Count > 0)
1648 {
1649 LandUndoState last = m_undo.Peek();
1650 if (last != null)
1651 {
1652 if (last.Compare(m_channel))
1653 return;
1654 }
1655 }
1656
1657 LandUndoState nUndo = new LandUndoState(this, m_channel);
1658 m_undo.Push(nUndo);
1659 }
1660=======
1661>>>>>>> avn/ubitvar
1662 } 1277 }
1663 1278
1664 #region Console Commands 1279 #region Console Commands
1665 1280
1666 private void InterfaceLoadFile(Object[] args) 1281 private void InterfaceLoadFile(Object[] args)
1667 { 1282 {
1668<<<<<<< HEAD
1669 LoadFromFile((string)args[0]);
1670=======
1671 LoadFromFile((string) args[0]); 1283 LoadFromFile((string) args[0]);
1672>>>>>>> avn/ubitvar
1673 } 1284 }
1674 1285
1675 private void InterfaceLoadTileFile(Object[] args) 1286 private void InterfaceLoadTileFile(Object[] args)
1676 { 1287 {
1677<<<<<<< HEAD
1678 LoadFromFile((string)args[0],
1679 (int)args[1],
1680 (int)args[2],
1681 (int)args[3],
1682 (int)args[4]);
1683=======
1684 LoadFromFile((string) args[0], 1288 LoadFromFile((string) args[0],
1685 (int) args[1], 1289 (int) args[1],
1686 (int) args[2], 1290 (int) args[2],
1687 (int) args[3], 1291 (int) args[3],
1688 (int) args[4]); 1292 (int) args[4]);
1689>>>>>>> avn/ubitvar
1690 } 1293 }
1691 1294
1692 private void InterfaceSaveFile(Object[] args) 1295 private void InterfaceSaveFile(Object[] args)
@@ -1711,15 +1314,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1711 private void InterfaceRevertTerrain(Object[] args) 1314 private void InterfaceRevertTerrain(Object[] args)
1712 { 1315 {
1713 int x, y; 1316 int x, y;
1714<<<<<<< HEAD
1715 for(x = 0; x < m_channel.Width; x++)
1716 for(y = 0; y < m_channel.Height; y++)
1717 m_channel[x, y] = m_revert[x, y];
1718=======
1719 for (x = 0; x < m_channel.Width; x++) 1317 for (x = 0; x < m_channel.Width; x++)
1720 for (y = 0; y < m_channel.Height; y++) 1318 for (y = 0; y < m_channel.Height; y++)
1721 m_channel[x, y] = m_baked[x, y]; 1319 m_channel[x, y] = m_baked[x, y];
1722>>>>>>> avn/ubitvar
1723 1320
1724 } 1321 }
1725 1322
@@ -1729,15 +1326,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1729 1326
1730 if (direction.ToLower().StartsWith("y")) 1327 if (direction.ToLower().StartsWith("y"))
1731 { 1328 {
1732<<<<<<< HEAD
1733 for(int x = 0; x < m_channel.Width; x++)
1734 {
1735 for(int y = 0; y < m_channel.Height / 2; y++)
1736=======
1737 for (int x = 0; x < m_channel.Width; x++) 1329 for (int x = 0; x < m_channel.Width; x++)
1738 { 1330 {
1739 for (int y = 0; y < m_channel.Height / 2; y++) 1331 for (int y = 0; y < m_channel.Height / 2; y++)
1740>>>>>>> avn/ubitvar
1741 { 1332 {
1742 double height = m_channel[x, y]; 1333 double height = m_channel[x, y];
1743 double flippedHeight = m_channel[x, (int)m_channel.Height - 1 - y]; 1334 double flippedHeight = m_channel[x, (int)m_channel.Height - 1 - y];
@@ -1749,15 +1340,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1749 } 1340 }
1750 else if (direction.ToLower().StartsWith("x")) 1341 else if (direction.ToLower().StartsWith("x"))
1751 { 1342 {
1752<<<<<<< HEAD
1753 for(int y = 0; y < m_channel.Height; y++)
1754 {
1755 for(int x = 0; x < m_channel.Width / 2; x++)
1756=======
1757 for (int y = 0; y < m_channel.Height; y++) 1343 for (int y = 0; y < m_channel.Height; y++)
1758 { 1344 {
1759 for (int x = 0; x < m_channel.Width / 2; x++) 1345 for (int x = 0; x < m_channel.Width / 2; x++)
1760>>>>>>> avn/ubitvar
1761 { 1346 {
1762 double height = m_channel[x, y]; 1347 double height = m_channel[x, y];
1763 double flippedHeight = m_channel[(int)m_channel.Width - 1 - x, y]; 1348 double flippedHeight = m_channel[(int)m_channel.Width - 1 - x, y];
@@ -1837,47 +1422,29 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1837 double val = (double)args[0]; 1422 double val = (double)args[0];
1838 1423
1839 int x, y; 1424 int x, y;
1840<<<<<<< HEAD
1841 for(x = 0; x < m_channel.Width; x++)
1842 for(y = 0; y < m_channel.Height; y++)
1843 m_channel[x, y] += (double)args[0];
1844=======
1845 for (x = 0; x < m_channel.Width; x++) 1425 for (x = 0; x < m_channel.Width; x++)
1846 for (y = 0; y < m_channel.Height; y++) 1426 for (y = 0; y < m_channel.Height; y++)
1847 m_channel[x, y] += val; 1427 m_channel[x, y] += val;
1848>>>>>>> avn/ubitvar
1849 } 1428 }
1850 1429
1851 private void InterfaceMultiplyTerrain(Object[] args) 1430 private void InterfaceMultiplyTerrain(Object[] args)
1852 { 1431 {
1853 int x, y; 1432 int x, y;
1854<<<<<<< HEAD
1855 for(x = 0; x < m_channel.Width; x++)
1856 for(y = 0; y < m_channel.Height; y++)
1857 m_channel[x, y] *= (double)args[0];
1858=======
1859 double val = (double)args[0]; 1433 double val = (double)args[0];
1860 1434
1861 for (x = 0; x < m_channel.Width; x++) 1435 for (x = 0; x < m_channel.Width; x++)
1862 for (y = 0; y < m_channel.Height; y++) 1436 for (y = 0; y < m_channel.Height; y++)
1863 m_channel[x, y] *= val; 1437 m_channel[x, y] *= val;
1864>>>>>>> avn/ubitvar
1865 } 1438 }
1866 1439
1867 private void InterfaceLowerTerrain(Object[] args) 1440 private void InterfaceLowerTerrain(Object[] args)
1868 { 1441 {
1869 int x, y; 1442 int x, y;
1870<<<<<<< HEAD
1871 for(x = 0; x < m_channel.Width; x++)
1872 for(y = 0; y < m_channel.Height; y++)
1873 m_channel[x, y] -= (double)args[0];
1874=======
1875 double val = (double)args[0]; 1443 double val = (double)args[0];
1876 1444
1877 for (x = 0; x < m_channel.Width; x++) 1445 for (x = 0; x < m_channel.Width; x++)
1878 for (y = 0; y < m_channel.Height; y++) 1446 for (y = 0; y < m_channel.Height; y++)
1879 m_channel[x, y] -= val; 1447 m_channel[x, y] -= val;
1880>>>>>>> avn/ubitvar
1881 } 1448 }
1882 1449
1883 public void InterfaceFillTerrain(Object[] args) 1450 public void InterfaceFillTerrain(Object[] args)
@@ -1885,26 +1452,16 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1885 int x, y; 1452 int x, y;
1886 double val = (double)args[0]; 1453 double val = (double)args[0];
1887 1454
1888<<<<<<< HEAD
1889 for(x = 0; x < m_channel.Width; x++)
1890 for(y = 0; y < m_channel.Height; y++)
1891 m_channel[x, y] = (double)args[0];
1892=======
1893 for (x = 0; x < m_channel.Width; x++) 1455 for (x = 0; x < m_channel.Width; x++)
1894 for (y = 0; y < m_channel.Height; y++) 1456 for (y = 0; y < m_channel.Height; y++)
1895 m_channel[x, y] = val; 1457 m_channel[x, y] = val;
1896>>>>>>> avn/ubitvar
1897 } 1458 }
1898 1459
1899 private void InterfaceMinTerrain(Object[] args) 1460 private void InterfaceMinTerrain(Object[] args)
1900 { 1461 {
1901 int x, y; 1462 int x, y;
1902<<<<<<< HEAD
1903 for(x = 0; x < m_channel.Width; x++)
1904=======
1905 double val = (double)args[0]; 1463 double val = (double)args[0];
1906 for (x = 0; x < m_channel.Width; x++) 1464 for (x = 0; x < m_channel.Width; x++)
1907>>>>>>> avn/ubitvar
1908 { 1465 {
1909 for(y = 0; y < m_channel.Height; y++) 1466 for(y = 0; y < m_channel.Height; y++)
1910 { 1467 {
@@ -1916,19 +1473,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1916 private void InterfaceMaxTerrain(Object[] args) 1473 private void InterfaceMaxTerrain(Object[] args)
1917 { 1474 {
1918 int x, y; 1475 int x, y;
1919<<<<<<< HEAD
1920 for(x = 0; x < m_channel.Width; x++)
1921=======
1922 double val = (double)args[0]; 1476 double val = (double)args[0];
1923 for (x = 0; x < m_channel.Width; x++) 1477 for (x = 0; x < m_channel.Width; x++)
1924>>>>>>> avn/ubitvar
1925 { 1478 {
1926 for(y = 0; y < m_channel.Height; y++) 1479 for(y = 0; y < m_channel.Height; y++)
1927 { 1480 {
1928 m_channel[x, y] = Math.Min(val, m_channel[x, y]); 1481 m_channel[x, y] = Math.Min(val, m_channel[x, y]);
1929 } 1482 }
1930 } 1483 }
1931<<<<<<< HEAD
1932 } 1484 }
1933 1485
1934 private void InterfaceShow(Object[] args) 1486 private void InterfaceShow(Object[] args)
@@ -1944,8 +1496,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
1944 double height = m_channel[(int)point.X, (int)point.Y]; 1496 double height = m_channel[(int)point.X, (int)point.Y];
1945 1497
1946 Console.WriteLine("Terrain height at {0} is {1}", point, height); 1498 Console.WriteLine("Terrain height at {0} is {1}", point, height);
1947=======
1948>>>>>>> avn/ubitvar
1949 } 1499 }
1950 1500
1951 private void InterfaceShowDebugStats(Object[] args) 1501 private void InterfaceShowDebugStats(Object[] args)
@@ -2157,6 +1707,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
2157 1707
2158 public void ModifyCommand(string module, string[] cmd) 1708 public void ModifyCommand(string module, string[] cmd)
2159 { 1709 {
1710 /*
2160 string result; 1711 string result;
2161 Scene scene = SceneManager.Instance.CurrentScene; 1712 Scene scene = SceneManager.Instance.CurrentScene;
2162 if ((scene != null) && (scene != m_scene)) 1713 if ((scene != null) && (scene != m_scene))
@@ -2196,6 +1747,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
2196 { 1747 {
2197 MainConsole.Instance.Output(result); 1748 MainConsole.Instance.Output(result);
2198 } 1749 }
1750 */
2199 } 1751 }
2200 1752
2201#endregion 1753#endregion
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
index 40db370..b209b33 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
@@ -60,12 +60,8 @@ 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
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, 63 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0,
67 0, midRegion - 1,0, (int)Constants.RegionSize -1); 64 0, midRegion - 1,0, (int)Constants.RegionSize -1);
68>>>>>>> avn/ubitvar
69 Assert.That(map[127, midRegion] > 0.0, "Raise brush should raising value at this point (127,128)."); 65 Assert.That(map[127, midRegion] > 0.0, "Raise brush should raising value at this point (127,128).");
70 Assert.That(map[125, midRegion] > 0.0, "Raise brush should raising value at this point (124,128)."); 66 Assert.That(map[125, midRegion] > 0.0, "Raise brush should raising value at this point (124,128).");
71 Assert.That(map[120, midRegion] == 0.0, "Raise brush should not change value at this point (120,128)."); 67 Assert.That(map[120, midRegion] == 0.0, "Raise brush should not change value at this point (120,128).");
@@ -84,12 +80,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain.Tests
84 } 80 }
85 effect = new LowerSphere(); 81 effect = new LowerSphere();
86 82
87<<<<<<< HEAD
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, 83 effect.PaintEffect(map, allowMask, midRegion, midRegion, -1.0, 2, 6.0,
91 0, (int)Constants.RegionSize -1,0, (int)Constants.RegionSize -1); 84 0, (int)Constants.RegionSize -1,0, (int)Constants.RegionSize -1);
92>>>>>>> avn/ubitvar
93 Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 0.0 at this point (127,128)."); 85 Assert.That(map[127, midRegion] >= 0.0, "Lower should not lowering value below 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)."); 86 Assert.That(map[127, midRegion] == 0.0, "Lower brush should lowering value to 0.0 at this point (127,128).");
95 Assert.That(map[125, midRegion] < 1.0, "Lower brush should lowering value at this point (124,128)."); 87 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 77c10b8..4719ba3 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs
@@ -79,13 +79,10 @@ 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
83 public static Bitmap Splat(ITerrainChannel terrain, 83 public static Bitmap Splat(ITerrainChannel terrain,
84 UUID[] textureIDs, float[] startHeights, float[] heightRanges, 84 UUID[] textureIDs, float[] startHeights, float[] heightRanges,
85 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
89 { 86 {
90 Debug.Assert(textureIDs.Length == 4); 87 Debug.Assert(textureIDs.Length == 4);
91 Debug.Assert(startHeights.Length == 4); 88 Debug.Assert(startHeights.Length == 4);
@@ -133,8 +130,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
133 asset = assetService.Get(textureIDs[i].ToString()); 130 asset = assetService.Get(textureIDs[i].ToString());
134 if (asset != null) 131 if (asset != null)
135 { 132 {
136// m_log.DebugFormat( 133 // m_log.DebugFormat(
137// "[TERRAIN SPLAT]: Got cached original JPEG2000 terrain texture {0} {1}", i, asset.ID); 134 // "[TERRAIN SPLAT]: Got cached original JPEG2000 terrain texture {0} {1}", i, asset.ID);
138 135
139 try { detailTexture[i] = (Bitmap)CSJ2K.J2kImage.FromBytes(asset.Data); } 136 try { detailTexture[i] = (Bitmap)CSJ2K.J2kImage.FromBytes(asset.Data); }
140 catch (Exception ex) 137 catch (Exception ex)
@@ -144,7 +141,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
144 } 141 }
145 142
146 if (detailTexture[i] != null) 143 if (detailTexture[i] != null)
147 { 144 {
148 // Make sure this texture is the correct size, otherwise resize 145 // Make sure this texture is the correct size, otherwise resize
149 if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256) 146 if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256)
150 { 147 {
@@ -199,74 +196,12 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
199 using (SolidBrush brush = new SolidBrush(DEFAULT_TERRAIN_COLOR[i])) 196 using (SolidBrush brush = new SolidBrush(DEFAULT_TERRAIN_COLOR[i]))
200 gfx.FillRectangle(brush, 0, 0, 256, 256); 197 gfx.FillRectangle(brush, 0, 0, 256, 256);
201 } 198 }
202 else
203 {
204 if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256)
205 {
206 detailTexture[i] = ResizeBitmap(detailTexture[i], 256, 256);
207 }
208 }
209 } 199 }
210<<<<<<< HEAD
211 else 200 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
223 { 201 {
224 if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256) 202 if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256)
225 { 203 {
226<<<<<<< HEAD
227 detailTexture[i] = ResizeBitmap(detailTexture[i], 256, 256); 204 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
270 } 205 }
271 } 206 }
272 } 207 }
@@ -286,7 +221,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
286 { 221 {
287 for (int x = 0; x < 256; x++) 222 for (int x = 0; x < 256; x++)
288 { 223 {
289<<<<<<< HEAD
290 float height = (float)terrain[x * xFactor, y * yFactor]; 224 float height = (float)terrain[x * xFactor, y * yFactor];
291 225
292 float pctX = (float)x / 255f; 226 float pctX = (float)x / 255f;
@@ -328,58 +262,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
328 if (Single.IsNaN(layer)) 262 if (Single.IsNaN(layer))
329 layer = 0f; 263 layer = 0f;
330 layermap[x, y] = Utils.Clamp(layer, 0f, 3f); 264 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
383 } 265 }
384 } 266 }
385 267
@@ -471,10 +353,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
471 b.Dispose(); 353 b.Dispose();
472 return result; 354 return result;
473 } 355 }
474<<<<<<< HEAD
475
476=======
477>>>>>>> avn/ubitvar
478 public static Bitmap SplatSimple(float[] heightmap) 356 public static Bitmap SplatSimple(float[] heightmap)
479 { 357 {
480 const float BASE_HSV_H = 93f / 360f; 358 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 d8420d9..8e843ee 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
@@ -156,13 +156,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
156 156
157 public Bitmap CreateMapTile() 157 public Bitmap CreateMapTile()
158 { 158 {
159<<<<<<< HEAD
160 // Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f);
161 // Camera above the middle of the region
162 Vector3 camPos = new Vector3(
163 m_scene.RegionInfo.RegionSizeX/2 - 0.5f,
164 m_scene.RegionInfo.RegionSizeY/2 - 0.5f,
165=======
166 /* this must be on all map, not just its image 159 /* this must be on all map, not just its image
167 if ((DateTime.Now - lastImageTime).TotalSeconds < 3600) 160 if ((DateTime.Now - lastImageTime).TotalSeconds < 3600)
168 { 161 {
@@ -179,16 +172,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
179 Vector3 camPos = new Vector3( 172 Vector3 camPos = new Vector3(
180 m_scene.RegionInfo.RegionSizeX / 2 - 0.5f, 173 m_scene.RegionInfo.RegionSizeX / 2 - 0.5f,
181 m_scene.RegionInfo.RegionSizeY / 2 - 0.5f, 174 m_scene.RegionInfo.RegionSizeY / 2 - 0.5f,
182>>>>>>> avn/ubitvar
183 221.7025033688163f); 175 221.7025033688163f);
184 // Viewport viewing down onto the region 176 // Viewport viewing down onto the region
185 Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, 177 Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f,
186 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY, 178 (int)m_scene.RegionInfo.RegionSizeX, (int)m_scene.RegionInfo.RegionSizeY,
187<<<<<<< HEAD
188 (float)m_scene.RegionInfo.RegionSizeX, (float)m_scene.RegionInfo.RegionSizeY );
189 // Fill the viewport and return the image
190 return CreateMapTile(viewport, false);
191=======
192 (float)m_scene.RegionInfo.RegionSizeX, (float)m_scene.RegionInfo.RegionSizeY); 179 (float)m_scene.RegionInfo.RegionSizeX, (float)m_scene.RegionInfo.RegionSizeY);
193 180
194 Bitmap tile = CreateMapTile(viewport, false); 181 Bitmap tile = CreateMapTile(viewport, false);
@@ -199,7 +186,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
199 lastImageTime = DateTime.Now; 186 lastImageTime = DateTime.Now;
200 return (Bitmap)lastImage.Clone(); 187 return (Bitmap)lastImage.Clone();
201 */ 188 */
202>>>>>>> avn/ubitvar
203 } 189 }
204 190
205 public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures) 191 public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures)
@@ -315,15 +301,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
315 float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; 301 float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight;
316 302
317 renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f); 303 renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f);
318<<<<<<< HEAD
319 renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX/2 - 0.5f,
320 waterHeight,
321 m_scene.RegionInfo.RegionSizeY/2 - 0.5f );
322=======
323 renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX / 2 - 0.5f, 304 renderer.Scene.sceneobject("Water").setPos(m_scene.RegionInfo.RegionSizeX / 2 - 0.5f,
324 waterHeight, 305 waterHeight,
325 m_scene.RegionInfo.RegionSizeY / 2 - 0.5f); 306 m_scene.RegionInfo.RegionSizeY / 2 - 0.5f);
326>>>>>>> avn/ubitvar
327 307
328 warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR)); 308 warp_Material waterColorMaterial = new warp_Material(ConvertColor(WATER_COLOR));
329 waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif 309 waterColorMaterial.setReflectivity(0); // match water color with standard map module thanks lkalif
@@ -352,11 +332,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
352 warp_Vector pos = ConvertVector(x, y, (float)terrain[(int)x, (int)y]); 332 warp_Vector pos = ConvertVector(x, y, (float)terrain[(int)x, (int)y]);
353 obj.addVertex(new warp_Vertex(pos, 333 obj.addVertex(new warp_Vertex(pos,
354 x / (float)m_scene.RegionInfo.RegionSizeX, 334 x / (float)m_scene.RegionInfo.RegionSizeX,
355<<<<<<< HEAD
356 (((float)m_scene.RegionInfo.RegionSizeY) - y) / m_scene.RegionInfo.RegionSizeY) );
357=======
358 (((float)m_scene.RegionInfo.RegionSizeY) - y) / m_scene.RegionInfo.RegionSizeY)); 335 (((float)m_scene.RegionInfo.RegionSizeY) - y) / m_scene.RegionInfo.RegionSizeY));
359>>>>>>> avn/ubitvar
360 } 336 }
361 } 337 }
362 338
@@ -424,12 +400,8 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
424 warp_Texture texture; 400 warp_Texture texture;
425 using ( 401 using (
426 Bitmap image 402 Bitmap image
427<<<<<<< HEAD
428 = TerrainSplat.Splat(terrain, textureIDs, startHeights, heightRanges,
429=======
430 = TerrainSplat.Splat( 403 = TerrainSplat.Splat(
431 terrain, textureIDs, startHeights, heightRanges, 404 terrain, textureIDs, startHeights, heightRanges,
432>>>>>>> avn/ubitvar
433 new Vector3d(globalX, globalY, 0.0), m_scene.AssetService, textureTerrain)) 405 new Vector3d(globalX, globalY, 0.0), m_scene.AssetService, textureTerrain))
434 { 406 {
435 texture = new warp_Texture(image); 407 texture = new warp_Texture(image);
@@ -711,12 +683,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
711 return new warp_Vector(x, z, y); 683 return new warp_Vector(x, z, y);
712 } 684 }
713 685
714 // Note: axis change.
715 private static warp_Vector ConvertVector(float x, float y, float z)
716 {
717 return new warp_Vector(x, z, y);
718 }
719
720 private static warp_Vector ConvertVector(Vector3 vector) 686 private static warp_Vector ConvertVector(Vector3 vector)
721 { 687 {
722 return new warp_Vector(vector.X, vector.Z, vector.Y); 688 return new warp_Vector(vector.X, vector.Z, vector.Y);
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index 553d057..e08bdc0 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -141,12 +141,7 @@ 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
145 List<MapBlockData> blocks = new List<MapBlockData>();
146 if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4))
147=======
148 Util.FireAndForget(x => 144 Util.FireAndForget(x =>
149>>>>>>> avn/ubitvar
150 { 145 {
151 List<MapBlockData> blocks = new List<MapBlockData>(); 146 List<MapBlockData> blocks = new List<MapBlockData>();
152 if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4)) 147 if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4))
@@ -232,74 +227,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
232 // they have different values depending on different viewers, apparently 227 // they have different values depending on different viewers, apparently
233 remoteClient.SendMapBlock(blocks, flags); 228 remoteClient.SendMapBlock(blocks, flags);
234 229
235<<<<<<< HEAD
236 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
237
238 string mapNameOrig = mapName;
239 if (regionInfos.Count == 0)
240 {
241 // Hack to get around the fact that ll V3 now drops the port from the
242 // map name. See https://jira.secondlife.com/browse/VWR-28570
243 //
244 // Caller, use this magic form instead:
245 // secondlife://http|!!mygrid.com|8002|Region+Name/128/128
246 // or url encode if possible.
247 // the hacks we do with this viewer...
248 //
249 if (mapName.Contains("|"))
250 mapName = mapName.Replace('|', ':');
251 if (mapName.Contains("+"))
252 mapName = mapName.Replace('+', ' ');
253 if (mapName.Contains("!"))
254 mapName = mapName.Replace('!', '/');
255
256 if (mapName != mapNameOrig)
257 regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
258 }
259
260 m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags);
261
262 if (regionInfos.Count > 0)
263 {
264 foreach (GridRegion info in regionInfos)
265 {
266 if ((flags & 2) == 2) // V2 sends this
267 {
268 List<MapBlockData> datas = WorldMap.Map2BlockFromGridRegion(info, flags);
269 // ugh! V2-3 is very sensitive about the result being
270 // exactly the same as the requested name
271 if (regionInfos.Count == 1 && (mapName != mapNameOrig))
272 datas.ForEach(d => d.Name = mapNameOrig);
273
274 blocks.AddRange(datas);
275 }
276 else
277 {
278 MapBlockData data = WorldMap.MapBlockFromGridRegion(info, flags);
279 blocks.Add(data);
280 }
281 }
282 }
283
284 // final block, closing the search result
285 AddFinalBlock(blocks);
286
287 // flags are agent flags sent from the viewer.
288 // they have different values depending on different viewers, apparently
289 remoteClient.SendMapBlock(blocks, flags);
290
291 // send extra user messages for V3
292 // because the UI is very confusing
293 // while we don't fix the hard-coded urls
294 if (flags == 2)
295 {
296 if (regionInfos.Count == 0)
297 remoteClient.SendAlertMessage("No regions found with that name.");
298 // this seems unnecessary because found regions will show up in the search results
299 //else if (regionInfos.Count == 1)
300 // remoteClient.SendAlertMessage("Region found!");
301 }
302=======
303 // send extra user messages for V3 230 // send extra user messages for V3
304 // because the UI is very confusing 231 // because the UI is very confusing
305 // while we don't fix the hard-coded urls 232 // while we don't fix the hard-coded urls
@@ -311,7 +238,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
311// remoteClient.SendAgentAlertMessage("Region found!", false); 238// remoteClient.SendAgentAlertMessage("Region found!", false);
312 } 239 }
313 }); 240 });
314>>>>>>> avn/ubitvar
315 } 241 }
316 242
317 private void AddFinalBlock(List<MapBlockData> blocks) 243 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 2fbd017..b6d96ac 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -68,12 +68,6 @@ 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
72 private IMapImageGenerator m_mapImageGenerator;
73 private IMapImageUploadModule m_mapImageServiceModule;
74
75 private OpenSim.Framework.BlockingQueue<MapRequestState> requests = new OpenSim.Framework.BlockingQueue<MapRequestState>();
76=======
77 private ManualResetEvent queueEvent = new ManualResetEvent(false); 71 private ManualResetEvent queueEvent = new ManualResetEvent(false);
78 private Queue<MapRequestState> requests = new Queue<MapRequestState>(); 72 private Queue<MapRequestState> requests = new Queue<MapRequestState>();
79 73
@@ -82,7 +76,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
82 76
83 private IMapImageGenerator m_mapImageGenerator; 77 private IMapImageGenerator m_mapImageGenerator;
84 private IMapImageUploadModule m_mapImageServiceModule; 78 private IMapImageUploadModule m_mapImageServiceModule;
85>>>>>>> avn/ubitvar
86 79
87 protected Scene m_scene; 80 protected Scene m_scene;
88 private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>(); 81 private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>();
@@ -154,14 +147,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
154 if (!m_Enabled) 147 if (!m_Enabled)
155 return; 148 return;
156 149
157<<<<<<< HEAD
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
164
165 m_mapImageGenerator = m_scene.RequestModuleInterface<IMapImageGenerator>(); 150 m_mapImageGenerator = m_scene.RequestModuleInterface<IMapImageGenerator>();
166 m_mapImageServiceModule = m_scene.RequestModuleInterface<IMapImageUploadModule>(); 151 m_mapImageServiceModule = m_scene.RequestModuleInterface<IMapImageUploadModule>();
167 } 152 }
@@ -275,56 +260,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
275 // 6/8/2011 -- I'm adding an explicit 2048 check, so that we never forget that there is 260 // 6/8/2011 -- I'm adding an explicit 2048 check, so that we never forget that there is
276 // a hack here, and so that regions below 4096 don't get spammed with unnecessary map blocks. 261 // a hack here, and so that regions below 4096 don't get spammed with unnecessary map blocks.
277 262
278<<<<<<< HEAD
279 if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048)
280 {
281 ScenePresence avatarPresence = null;
282
283 m_scene.TryGetScenePresence(agentID, out avatarPresence);
284
285 if (avatarPresence != null)
286 {
287 bool lookup = false;
288
289 lock (cachedMapBlocks)
290 {
291 if (cachedMapBlocks.Count > 0 && ((cachedTime + 1800) > Util.UnixTimeSinceEpoch()))
292 {
293 List<MapBlockData> mapBlocks;
294
295 mapBlocks = cachedMapBlocks;
296 avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0);
297 }
298 else
299 {
300 lookup = true;
301 }
302 }
303 if (lookup)
304 {
305 List<MapBlockData> mapBlocks = new List<MapBlockData>(); ;
306
307 // Get regions that are within 8 regions of here
308 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
309 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX - 8),
310 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocX + 8),
311 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY - 8),
312 (int)Util.RegionToWorldLoc(m_scene.RegionInfo.RegionLocY + 8) );
313 foreach (GridRegion r in regions)
314 {
315 MapBlockData block = MapBlockFromGridRegion(r, 0);
316 mapBlocks.Add(block);
317 }
318 avatarPresence.ControllingClient.SendMapBlock(mapBlocks, 0);
319
320 lock (cachedMapBlocks)
321 cachedMapBlocks = mapBlocks;
322
323 cachedTime = Util.UnixTimeSinceEpoch();
324 }
325 }
326 }
327=======
328 //if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048) 263 //if (m_scene.RegionInfo.RegionLocX >= 2048 || m_scene.RegionInfo.RegionLocY >= 2048)
329 //{ 264 //{
330 // ScenePresence avatarPresence = null; 265 // ScenePresence avatarPresence = null;
@@ -373,7 +308,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
373 // } 308 // }
374 // } 309 // }
375 //} 310 //}
376>>>>>>> avn/ubitvar
377 311
378 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse(); 312 LLSDMapLayerResponse mapResponse = new LLSDMapLayerResponse();
379 mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse()); 313 mapResponse.LayerData.Array.Add(GetOSDMapLayerResponse());
@@ -459,7 +393,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
459 ThreadPriority.BelowNormal, 393 ThreadPriority.BelowNormal,
460 true, 394 true,
461 true); 395 true);
462 Watchdog.StartThread( 396 WorkManager.StartThread(
463 MapBlockSendThread, 397 MapBlockSendThread,
464 string.Format("MapBlockSendThread ({0})", m_scene.RegionInfo.RegionName), 398 string.Format("MapBlockSendThread ({0})", m_scene.RegionInfo.RegionName),
465 ThreadPriority.BelowNormal, 399 ThreadPriority.BelowNormal,
@@ -516,12 +450,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
516 uint xstart = 0; 450 uint xstart = 0;
517 uint ystart = 0; 451 uint ystart = 0;
518 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); 452 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart);
519<<<<<<< HEAD
520 if (itemtype == (int)GridItemType.AgentLocations)
521=======
522 453
523 if (itemtype == 6) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots) 454 if (itemtype == (int)GridItemType.AgentLocations) // Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots)
524>>>>>>> avn/ubitvar
525 { 455 {
526 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle) 456 if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
527 { 457 {
@@ -531,22 +461,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
531 mapItemReply mapitem = new mapItemReply(); 461 mapItemReply mapitem = new mapItemReply();
532 if (m_scene.GetRootAgentCount() <= 1) 462 if (m_scene.GetRootAgentCount() <= 1)
533 { 463 {
534<<<<<<< HEAD
535 mapitem = new mapItemReply( 464 mapitem = new mapItemReply(
536 xstart + 1, 465 xstart + 1,
537 ystart + 1, 466 ystart + 1,
538 UUID.Zero, 467 UUID.Zero,
539 Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()), 468 Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()),
540 0, 0); 469 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
550 mapitems.Add(mapitem); 470 mapitems.Add(mapitem);
551 } 471 }
552 else 472 else
@@ -556,22 +476,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
556 // Don't send a green dot for yourself 476 // Don't send a green dot for yourself
557 if (sp.UUID != remoteClient.AgentId) 477 if (sp.UUID != remoteClient.AgentId)
558 { 478 {
559<<<<<<< HEAD
560 mapitem = new mapItemReply( 479 mapitem = new mapItemReply(
561 xstart + (uint)sp.AbsolutePosition.X, 480 xstart + (uint)sp.AbsolutePosition.X,
562 ystart + (uint)sp.AbsolutePosition.Y, 481 ystart + (uint)sp.AbsolutePosition.Y,
563 UUID.Zero, 482 UUID.Zero,
564 Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()), 483 Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()),
565 1, 0); 484 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
575 mapitems.Add(mapitem); 485 mapitems.Add(mapitem);
576 } 486 }
577 }); 487 });
@@ -615,8 +525,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
615 Vector3 max = parcel.AABBMax; 525 Vector3 max = parcel.AABBMax;
616 float x = (min.X+max.X)/2; 526 float x = (min.X+max.X)/2;
617 float y = (min.Y+max.Y)/2; 527 float y = (min.Y+max.Y)/2;
618
619<<<<<<< HEAD
620 mapitem = new mapItemReply( 528 mapitem = new mapItemReply(
621 xstart + (uint)x, 529 xstart + (uint)x,
622 ystart + (uint)y, 530 ystart + (uint)y,
@@ -625,16 +533,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
625 parcel.Area, 533 parcel.Area,
626 parcel.SalePrice 534 parcel.SalePrice
627 ); 535 );
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
638 mapitems.Add(mapitem); 536 mapitems.Add(mapitem);
639 } 537 }
640 } 538 }
@@ -659,7 +557,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
659 SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); 557 SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
660 if (sog != null) 558 if (sog != null)
661 { 559 {
662<<<<<<< HEAD
663 mapitem = new mapItemReply( 560 mapitem = new mapItemReply(
664 xstart + (uint)sog.AbsolutePosition.X, 561 xstart + (uint)sog.AbsolutePosition.X,
665 ystart + (uint)sog.AbsolutePosition.Y, 562 ystart + (uint)sog.AbsolutePosition.Y,
@@ -668,15 +565,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
668 0, // color (not used) 565 0, // color (not used)
669 0 // 0 = telehub / 1 = infohub 566 0 // 0 = telehub / 1 = infohub
670 ); 567 );
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
680 mapitems.Add(mapitem); 568 mapitems.Add(mapitem);
681 569
682 remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); 570 remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
@@ -763,126 +651,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
763 { 651 {
764 lock (requests) 652 lock (requests)
765 { 653 {
766<<<<<<< HEAD
767 if (st.agentID != UUID.Zero)
768 {
769 bool dorequest = true;
770 lock (m_rootAgents)
771 {
772 if (!m_rootAgents.Contains(st.agentID))
773 dorequest = false;
774 }
775
776 if (dorequest && !m_blacklistedregions.ContainsKey(st.regionhandle))
777 {
778 if (nAsyncRequests >= MAX_ASYNC_REQUESTS) // hit the break
779 {
780 // AH!!! Recursive !
781 // Put this request back in the queue and return
782 EnqueueMapItemRequest(st);
783 return;
784 }
785
786 RequestMapItemsDelegate d = RequestMapItemsAsync;
787 d.BeginInvoke(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle, RequestMapItemsCompleted, null);
788 //OSDMap response = RequestMapItemsAsync(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle);
789 //RequestMapItemsCompleted(response);
790 Interlocked.Increment(ref nAsyncRequests);
791 }
792 }
793 });
794 }
795
796 /// <summary>
797 /// Sends the mapitem response to the IClientAPI
798 /// </summary>
799 /// <param name="response">The OSDMap Response for the mapitem</param>
800 private void RequestMapItemsCompleted(IAsyncResult iar)
801 {
802 AsyncResult result = (AsyncResult)iar;
803 RequestMapItemsDelegate icon = (RequestMapItemsDelegate)result.AsyncDelegate;
804
805 OSDMap response = (OSDMap)icon.EndInvoke(iar);
806
807 Interlocked.Decrement(ref nAsyncRequests);
808
809 if (!response.ContainsKey("requestID"))
810 return;
811
812 UUID requestID = response["requestID"].AsUUID();
813
814 if (requestID != UUID.Zero)
815 {
816 MapRequestState mrs = new MapRequestState();
817 mrs.agentID = UUID.Zero;
818 lock (m_openRequests)
819 {
820 if (m_openRequests.ContainsKey(requestID))
821 {
822 mrs = m_openRequests[requestID];
823 m_openRequests.Remove(requestID);
824 }
825 }
826
827 if (mrs.agentID != UUID.Zero)
828 {
829 ScenePresence av = null;
830 m_scene.TryGetScenePresence(mrs.agentID, out av);
831 if (av != null)
832 {
833 if (response.ContainsKey(mrs.itemtype.ToString()))
834 {
835 List<mapItemReply> returnitems = new List<mapItemReply>();
836 OSDArray itemarray = (OSDArray)response[mrs.itemtype.ToString()];
837 for (int i = 0; i < itemarray.Count; i++)
838 {
839 OSDMap mapitem = (OSDMap)itemarray[i];
840 mapItemReply mi = new mapItemReply();
841 mi.FromOSD(mapitem);
842 returnitems.Add(mi);
843 }
844 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), mrs.itemtype, mrs.flags);
845 }
846
847 // Service 7 (MAP_ITEM_LAND_FOR_SALE)
848 uint itemtype = (uint)GridItemType.LandForSale;
849
850 if (response.ContainsKey(itemtype.ToString()))
851 {
852 List<mapItemReply> returnitems = new List<mapItemReply>();
853 OSDArray itemarray = (OSDArray)response[itemtype.ToString()];
854 for (int i = 0; i < itemarray.Count; i++)
855 {
856 OSDMap mapitem = (OSDMap)itemarray[i];
857 mapItemReply mi = new mapItemReply();
858 mi.FromOSD(mapitem);
859 returnitems.Add(mi);
860 }
861 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags);
862 }
863
864 // Service 1 (MAP_ITEM_TELEHUB)
865 itemtype = (uint)GridItemType.Telehub;
866
867 if (response.ContainsKey(itemtype.ToString()))
868 {
869 List<mapItemReply> returnitems = new List<mapItemReply>();
870 OSDArray itemarray = (OSDArray)response[itemtype.ToString()];
871 for (int i = 0; i < itemarray.Count; i++)
872 {
873 OSDMap mapitem = (OSDMap)itemarray[i];
874 mapItemReply mi = new mapItemReply();
875 mi.FromOSD(mapitem);
876 returnitems.Add(mi);
877 }
878 av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, mrs.flags);
879 }
880 }
881 }
882=======
883 queueEvent.Set(); 654 queueEvent.Set();
884 requests.Enqueue(state); 655 requests.Enqueue(state);
885>>>>>>> avn/ubitvar 656
886 } 657 }
887 } 658 }
888 659
@@ -1228,11 +999,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1228 /// <param name="maxY"></param> 999 /// <param name="maxY"></param>
1229 public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) 1000 public void RequestMapBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
1230 { 1001 {
1231<<<<<<< HEAD
1232=======
1233 m_log.DebugFormat("[WoldMapModule] RequestMapBlocks {0}={1}={2}={3} {4}", minX, minY, maxX, maxY, flag); 1002 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 1003/* this flag does not seem to mean what his says
1235>>>>>>> avn/ubitvar
1236 if ((flag & 0x10000) != 0) // user clicked on qthe map a tile that isn't visible 1004 if ((flag & 0x10000) != 0) // user clicked on qthe map a tile that isn't visible
1237 { 1005 {
1238 List<MapBlockData> response = new List<MapBlockData>(); 1006 List<MapBlockData> response = new List<MapBlockData>();
@@ -1241,34 +1009,15 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1241 // on an unloaded square. 1009 // on an unloaded square.
1242 // But make sure: Look whether the one we requested is in there 1010 // But make sure: Look whether the one we requested is in there
1243 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 1011 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
1244<<<<<<< HEAD
1245 (int)Util.RegionToWorldLoc((uint)minX), (int)Util.RegionToWorldLoc((uint)maxX),
1246 (int)Util.RegionToWorldLoc((uint)minY), (int)Util.RegionToWorldLoc((uint)maxY) );
1247
1248 m_log.DebugFormat("[WORLD MAP MODULE] RequestMapBlocks min=<{0},{1}>, max=<{2},{3}>, flag={4}, cntFound={5}",
1249 minX, minY, maxX, maxY, flag.ToString("X"), regions.Count);
1250=======
1251 (int)Util.RegionToWorldLoc((uint)minX), 1012 (int)Util.RegionToWorldLoc((uint)minX),
1252 (int)Util.RegionToWorldLoc((uint)maxX), 1013 (int)Util.RegionToWorldLoc((uint)maxX),
1253 (int)Util.RegionToWorldLoc((uint)minY), 1014 (int)Util.RegionToWorldLoc((uint)minY),
1254 (int)Util.RegionToWorldLoc((uint)maxY) ); 1015 (int)Util.RegionToWorldLoc((uint)maxY) );
1255 1016
1256>>>>>>> avn/ubitvar
1257 if (regions != null) 1017 if (regions != null)
1258 { 1018 {
1259 foreach (GridRegion r in regions) 1019 foreach (GridRegion r in regions)
1260 { 1020 {
1261<<<<<<< HEAD
1262 if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX)
1263 && r.RegionLocY == Util.RegionToWorldLoc((uint)minY) )
1264 {
1265 // found it => add it to response
1266 // Version 2 viewers can handle the larger regions
1267 if ((flag & 2) == 2)
1268 response.AddRange(Map2BlockFromGridRegion(r, flag));
1269 else
1270 response.Add(MapBlockFromGridRegion(r, flag));
1271=======
1272 if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX) && 1021 if (r.RegionLocX == Util.RegionToWorldLoc((uint)minX) &&
1273 r.RegionLocY == Util.RegionToWorldLoc((uint)minY)) 1022 r.RegionLocY == Util.RegionToWorldLoc((uint)minY))
1274 { 1023 {
@@ -1281,7 +1030,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1281 MapBlockFromGridRegion(block, r, flag); 1030 MapBlockFromGridRegion(block, r, flag);
1282 response.Add(block); 1031 response.Add(block);
1283 } 1032 }
1284>>>>>>> avn/ubitvar
1285 break; 1033 break;
1286 } 1034 }
1287 } 1035 }
@@ -1373,19 +1121,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1373 List<MapBlockData> allBlocks = new List<MapBlockData>(); 1121 List<MapBlockData> allBlocks = new List<MapBlockData>();
1374 List<MapBlockData> mapBlocks = new List<MapBlockData>(); 1122 List<MapBlockData> mapBlocks = new List<MapBlockData>();
1375 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, 1123 List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
1376<<<<<<< HEAD
1377 (int)Util.RegionToWorldLoc((uint)(minX - 4)), (int)Util.RegionToWorldLoc((uint)(maxX + 4)),
1378 (int)Util.RegionToWorldLoc((uint)(minY - 4)), (int)Util.RegionToWorldLoc((uint)(maxY + 4)) );
1379 //m_log.DebugFormat("{0} GetAndSendBlocks. min=<{1},{2}>, max=<{3},{4}>, cntFound={5}",
1380 // LogHeader, minX, minY, maxX, maxY, regions.Count);
1381 foreach (GridRegion r in regions)
1382 {
1383 // Version 2 viewers can handle the larger regions
1384 if ((flag & 2) == 2)
1385 mapBlocks.AddRange(Map2BlockFromGridRegion(r, flag));
1386 else
1387 mapBlocks.Add(MapBlockFromGridRegion(r, flag));
1388=======
1389 minX * (int)Constants.RegionSize, 1124 minX * (int)Constants.RegionSize,
1390 maxX * (int)Constants.RegionSize, 1125 maxX * (int)Constants.RegionSize,
1391 minY * (int)Constants.RegionSize, 1126 minY * (int)Constants.RegionSize,
@@ -1407,7 +1142,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1407 mapBlocks.Add(block); 1142 mapBlocks.Add(block);
1408 remoteClient.SendMapBlock(mapBlocks, flag & 0xffff); 1143 remoteClient.SendMapBlock(mapBlocks, flag & 0xffff);
1409 return allBlocks; 1144 return allBlocks;
1410>>>>>>> avn/ubitvar
1411 } 1145 }
1412 1146
1413 foreach (GridRegion r in regions) 1147 foreach (GridRegion r in regions)
@@ -1438,15 +1172,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1438 return allBlocks; 1172 return allBlocks;
1439 } 1173 }
1440 1174
1441<<<<<<< HEAD
1442 // Fill a passed MapBlockData from a GridRegion
1443 public MapBlockData MapBlockFromGridRegion(GridRegion r, uint flag)
1444=======
1445 public void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag) 1175 public void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag)
1446>>>>>>> avn/ubitvar
1447 { 1176 {
1448 MapBlockData block = new MapBlockData();
1449
1450 block.Access = r.Access; 1177 block.Access = r.Access;
1451 switch (flag & 0xffff) 1178 switch (flag & 0xffff)
1452 { 1179 {
@@ -1461,14 +1188,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1461 break; 1188 break;
1462 } 1189 }
1463 block.Name = r.RegionName; 1190 block.Name = r.RegionName;
1464<<<<<<< HEAD
1465 block.X = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocX);
1466 block.Y = (ushort)Util.WorldToRegionLoc((uint)r.RegionLocY);
1467 block.SizeX = (ushort) r.RegionSizeX;
1468 block.SizeY = (ushort) r.RegionSizeY;
1469
1470 return block;
1471=======
1472 block.X = (ushort)(r.RegionLocX / Constants.RegionSize); 1191 block.X = (ushort)(r.RegionLocX / Constants.RegionSize);
1473 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); 1192 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
1474 block.SizeX = (ushort)r.RegionSizeX; 1193 block.SizeX = (ushort)r.RegionSizeX;
@@ -1508,45 +1227,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1508 blocks.Add(block); 1227 blocks.Add(block);
1509 } 1228 }
1510 return blocks; 1229 return blocks;
1511>>>>>>> avn/ubitvar
1512 } 1230 }
1513 1231
1514 public List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag)
1515 {
1516 List<MapBlockData> blocks = new List<MapBlockData>();
1517 MapBlockData block = new MapBlockData();
1518 if (r == null)
1519 {
1520 block.Access = (byte)SimAccess.Down;
1521 block.MapImageId = UUID.Zero;
1522 blocks.Add(block);
1523 }
1524 else
1525 {
1526 block.Access = r.Access;
1527 switch (flag & 0xffff)
1528 {
1529 case 0:
1530 block.MapImageId = r.TerrainImage;
1531 break;
1532 case 2:
1533 block.MapImageId = r.ParcelImage;
1534 break;
1535 default:
1536 block.MapImageId = UUID.Zero;
1537 break;
1538 }
1539 block.Name = r.RegionName;
1540 block.X = (ushort)(r.RegionLocX / Constants.RegionSize);
1541 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
1542 block.SizeX = (ushort)r.RegionSizeX;
1543 block.SizeY = (ushort)r.RegionSizeY;
1544 blocks.Add(block);
1545 }
1546 return blocks;
1547 }
1548
1549
1550 public Hashtable OnHTTPThrottled(Hashtable keysvals) 1232 public Hashtable OnHTTPThrottled(Hashtable keysvals)
1551 { 1233 {
1552 Hashtable reply = new Hashtable(); 1234 Hashtable reply = new Hashtable();
@@ -1681,7 +1363,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1681 1363
1682 foreach (GridRegion r in regions) 1364 foreach (GridRegion r in regions)
1683 { 1365 {
1684 MapBlockData mapBlock = MapBlockFromGridRegion(r, 0); 1366 MapBlockData mapBlock = new MapBlockData();
1367 MapBlockFromGridRegion(mapBlock, r , 0);
1685 AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); 1368 AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
1686 1369
1687 if (texAsset != null) 1370 if (texAsset != null)
@@ -1752,13 +1435,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1752 uint xstart = 0; 1435 uint xstart = 0;
1753 uint ystart = 0; 1436 uint ystart = 0;
1754 1437
1755<<<<<<< HEAD
1756 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle,out xstart,out ystart);
1757 // m_log.DebugFormat("{0} HandleRemoteMapItemRequest. loc=<{1},{2}>",
1758 // LogHeader, Util.WorldToRegionLoc(xstart), Util.WorldToRegionLoc(ystart));
1759=======
1760 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); 1438 Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart);
1761>>>>>>> avn/ubitvar
1762 1439
1763 // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots) 1440 // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots)
1764 1441
@@ -1878,7 +1555,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1878 return; 1555 return;
1879 1556
1880 m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.Name); 1557 m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.Name);
1881<<<<<<< HEAD
1882 1558
1883 using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile()) 1559 using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTile())
1884 { 1560 {
@@ -1894,23 +1570,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1894 { 1570 {
1895 byte[] data; 1571 byte[] data;
1896 1572
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
1914 try 1573 try
1915 { 1574 {
1916 data = OpenJPEG.EncodeFromImage(mapbmp, true); 1575 data = OpenJPEG.EncodeFromImage(mapbmp, true);
@@ -2027,11 +1686,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
2027 int regionSizeX = (int)m_scene.RegionInfo.RegionSizeX; 1686 int regionSizeX = (int)m_scene.RegionInfo.RegionSizeX;
2028 int regionSizeY = (int)m_scene.RegionInfo.RegionSizeY; 1687 int regionSizeY = (int)m_scene.RegionInfo.RegionSizeY;
2029 1688
2030<<<<<<< HEAD
2031 int landTileSize = LandManagementModule.LandUnit; 1689 int landTileSize = LandManagementModule.LandUnit;
2032=======
2033 int landTileSize = LandManagementModule.landUnit;
2034>>>>>>> avn/ubitvar
2035 int regionLandTilesX = regionSizeX / landTileSize; 1690 int regionLandTilesX = regionSizeX / landTileSize;
2036 int regionLandTilesY = regionSizeY / landTileSize; 1691 int regionLandTilesY = regionSizeY / landTileSize;
2037 1692
@@ -2054,10 +1709,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
2054 { 1709 {
2055 using (SolidBrush transparent = new SolidBrush(background)) 1710 using (SolidBrush transparent = new SolidBrush(background))
2056 g.FillRectangle(transparent, 0, 0, regionSizeX, regionSizeY); 1711 g.FillRectangle(transparent, 0, 0, regionSizeX, regionSizeY);
2057<<<<<<< HEAD
2058=======
2059
2060>>>>>>> avn/ubitvar
2061 1712
2062 foreach (ILandObject land in parcels) 1713 foreach (ILandObject land in parcels)
2063 { 1714 {
@@ -2080,17 +1731,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
2080 1731
2081 using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9))) 1732 using (SolidBrush yellow = new SolidBrush(Color.FromArgb(255, 249, 223, 9)))
2082 { 1733 {
2083<<<<<<< HEAD
2084 for (int x = 0 ; x < regionLandTilesX ; x++)
2085 {
2086 for (int y = 0 ; y < regionLandTilesY ; y++)
2087 {
2088 if (saleBitmap[x, y])
2089 g.FillRectangle(
2090 yellow, x * landTileSize,
2091 regionSizeX - landTileSize - (y * landTileSize),
2092 landTileSize,
2093=======
2094 for (int x = 0; x < regionLandTilesX ; x++) 1734 for (int x = 0; x < regionLandTilesX ; x++)
2095 { 1735 {
2096 for (int y = 0; y < regionLandTilesY ; y++) 1736 for (int y = 0; y < regionLandTilesY ; y++)
@@ -2101,7 +1741,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
2101 x * landTileSize, 1741 x * landTileSize,
2102 regionSizeX - landTileSize - (y * landTileSize), 1742 regionSizeX - landTileSize - (y * landTileSize),
2103 landTileSize, 1743 landTileSize,
2104>>>>>>> avn/ubitvar
2105 landTileSize); 1744 landTileSize);
2106 } 1745 }
2107 } 1746 }