From e3157e61aa50d057b4345cb9d49c973afeb26b15 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Thu, 14 Aug 2008 00:04:37 +0000
Subject: Mantis #1946 Thank you, HomerHorwitz, for a patch that corrects and
improves TP to landmark and home position handling.
---
OpenSim/Region/Environment/Scenes/Scene.cs | 42 +++++++++++++++++++---
.../Scenes/SceneCommunicationService.cs | 23 ++++++++----
2 files changed, 55 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/Environment/Scenes')
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 3b961a5..b4bb2f6 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2104,10 +2104,34 @@ namespace OpenSim.Region.Environment.Scenes
UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(AgentId);
if (UserProfile != null)
{
- ulong homeRegion = UserProfile.HomeRegion;
+ LLUUID homeRegionID = UserProfile.HomeRegionID;
LLVector3 homePostion = new LLVector3(UserProfile.HomeLocationX,UserProfile.HomeLocationY,UserProfile.HomeLocationZ);
LLVector3 homeLookat = new LLVector3(UserProfile.HomeLookAt);
- RequestTeleportLocation(client, homeRegion, homePostion,homeLookat,(uint)0);
+ ulong homeRegionHandle = UserProfile.HomeRegion;
+ if(homeRegionID == LLUUID.Zero)
+ {
+ RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(UserProfile.HomeRegion);
+ if(info == null)
+ {
+ // can't find the region: Tell viewer and abort
+ client.SendTeleportFailed("Your home-region could not be found.");
+ return;
+ }
+ UserProfile.HomeRegionID = info.RegionID;
+ CommsManager.UserService.UpdateUserProfileProperties(UserProfile);
+ }
+ else
+ {
+ RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(homeRegionID);
+ if(info == null)
+ {
+ // can't find the region: Tell viewer and abort
+ client.SendTeleportFailed("Your home-region could not be found.");
+ return;
+ }
+ homeRegionHandle = info.RegionHandle;
+ }
+ RequestTeleportLocation(client, homeRegionHandle, homePostion,homeLookat,(uint)0);
}
}
@@ -2189,6 +2213,9 @@ namespace OpenSim.Region.Environment.Scenes
{
// I know I'm ignoring the regionHandle provided by the teleport location request.
// reusing the TeleportLocationRequest delegate, so regionHandle isn't valid
+ UserProfile.HomeRegionID = RegionInfo.RegionID;
+ // TODO: The next line can be removed, as soon as only homeRegionID based UserServers are around.
+ // TODO: The HomeRegion property can be removed then, too
UserProfile.HomeRegion = RegionInfo.RegionHandle;
// We cast these to an int so as not to cause a breaking change with old regions
@@ -2718,13 +2745,20 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public void RequestTeleportLandmark(IClientAPI remoteClient, ulong regionHandle, LLVector3 position)
+ public void RequestTeleportLandmark(IClientAPI remoteClient, LLUUID regionID, LLVector3 position)
{
+ RegionInfo info = CommsManager.GridService.RequestNeighbourInfo(regionID);
+ if(info == null)
+ {
+ // can't find the region: Tell viewer and abort
+ remoteClient.SendTeleportFailed("The teleport destination could not be found.");
+ return;
+ }
lock (m_scenePresences)
{
if (m_scenePresences.ContainsKey(remoteClient.AgentId))
{
- m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], regionHandle,
+ m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], info.RegionHandle,
position, LLVector3.Zero, 0);
}
}
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 348b643..008d67a 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -532,6 +532,17 @@ namespace OpenSim.Region.Environment.Scenes
}
///
+ /// Helper function to request neighbors from grid-comms
+ ///
+ ///
+ ///
+ public virtual RegionInfo RequestNeighbouringRegionInfo(LLUUID regionID)
+ {
+ //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending Grid Services Request about neighbor " + regionID);
+ return m_commsProvider.GridService.RequestNeighbourInfo(regionID);
+ }
+
+ ///
/// Requests map blocks in area of minX, maxX, minY, MaxY in world cordinates
///
///
@@ -597,8 +608,8 @@ namespace OpenSim.Region.Environment.Scenes
// once we reach here...
avatar.Scene.RemoveCapsHandler(avatar.UUID);
- m_commsProvider.InterRegion.InformRegionOfChildAgent(regionHandle, agent);
- m_commsProvider.InterRegion.ExpectAvatarCrossing(regionHandle, avatar.ControllingClient.AgentId,
+ m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agent);
+ m_commsProvider.InterRegion.ExpectAvatarCrossing(reg.RegionHandle, avatar.ControllingClient.AgentId,
position, false);
AgentCircuitData circuitdata = avatar.ControllingClient.RequestClientInfo();
@@ -610,17 +621,17 @@ namespace OpenSim.Region.Environment.Scenes
m_log.DebugFormat(
"[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID);
- avatar.ControllingClient.SendRegionTeleport(regionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
+ avatar.ControllingClient.SendRegionTeleport(reg.RegionHandle, 13, reg.ExternalEndPoint, 4, (1 << 4),
capsPath);
avatar.MakeChildAgent();
Thread.Sleep(5000);
- avatar.CrossAttachmentsIntoNewRegion(regionHandle);
+ avatar.CrossAttachmentsIntoNewRegion(reg.RegionHandle);
if (KillObject != null)
{
KillObject(avatar.LocalId);
}
- uint newRegionX = (uint)(regionHandle >> 40);
- uint newRegionY = (((uint)(regionHandle)) >> 8);
+ uint newRegionX = (uint)(reg.RegionHandle >> 40);
+ uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
uint oldRegionX = (uint)(m_regionInfo.RegionHandle >> 40);
uint oldRegionY = (((uint)(m_regionInfo.RegionHandle)) >> 8);
if (Util.fast_distance2d((int)(newRegionX - oldRegionX), (int)(newRegionY - oldRegionY)) > 3)
--
cgit v1.1