From 8c3eb324c4b666e7abadef4a714d1bd8d5f71ac2 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 29 Jul 2011 00:00:35 +0100
Subject: When using osTeleportAgent() and osTeleportAvatar(), only teleport if
the region name exactly matches (not near matches)
This is to prevent situations where the first name returned by GridService.GetRegionsByName is not one that exactly matches the given region name, even when there is an exact match later on in the list.
Only the above two functions call this teleport method (the map uses a different routine) so this seems safe to change.
Addresses http://opensimulator.org/mantis/view.php?id=5606
---
OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 1a32510..b84c3d5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3881,8 +3881,11 @@ namespace OpenSim.Region.Framework.Scenes
}
///
- /// Tries to teleport agent to other region.
+ /// Tries to teleport agent to another region.
///
+ ///
+ /// The region name must exactly match that given.
+ ///
///
///
///
@@ -3891,15 +3894,16 @@ namespace OpenSim.Region.Framework.Scenes
public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position,
Vector3 lookat, uint teleportFlags)
{
- List regions = GridService.GetRegionsByName(RegionInfo.ScopeID, regionName, 1);
- if (regions == null || regions.Count == 0)
+ GridRegion region = GridService.GetRegionByName(RegionInfo.ScopeID, regionName);
+
+ if (region == null)
{
// can't find the region: Tell viewer and abort
remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found.");
return;
}
- RequestTeleportLocation(remoteClient, regions[0].RegionHandle, position, lookat, teleportFlags);
+ RequestTeleportLocation(remoteClient, region.RegionHandle, position, lookat, teleportFlags);
}
///
--
cgit v1.1