From 58d79b33ff507a1d861d1196a925d2d09ad1c3f2 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Sun, 7 Sep 2008 20:09:11 +0000
Subject: Mantis #2142 Thank you, HomerHorwitz, for a patch that fixes landmark
teleport and about landmarks with the new OMV types.
---
OpenSim/Framework/AssetLandmark.cs | 3 +-
OpenSim/Framework/Util.cs | 15 ++++++
.../Region/Communications/OGS1/OGS1GridServices.cs | 63 +++++++++++-----------
.../Modules/World/Land/LandManagementModule.cs | 2 +-
4 files changed, 51 insertions(+), 32 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/AssetLandmark.cs b/OpenSim/Framework/AssetLandmark.cs
index cf663ee..d636d34 100644
--- a/OpenSim/Framework/AssetLandmark.cs
+++ b/OpenSim/Framework/AssetLandmark.cs
@@ -53,7 +53,8 @@ namespace OpenSim.Framework
string[] parts = temp.Split('\n');
int.TryParse(parts[0].Substring(17, 1), out Version);
UUID.TryParse(parts[1].Substring(10, 36), out RegionID);
- Vector3.TryParse(parts[2].Substring(10, parts[2].Length - 10), out Position);
+ // the vector is stored with spaces as separators, not with commas ("10.3 32.5 43" instead of "10.3, 32.5, 43")
+ Vector3.TryParse(parts[2].Substring(10, parts[2].Length - 10).Replace(" ", ","), out Position);
ulong.TryParse(parts[3].Substring(14, parts[3].Length - 14), out RegionHandle);
}
}
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index de42bf8..427832d 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -727,6 +727,21 @@ namespace OpenSim.Framework
return client.Send(url, 6000);
}
+ ///
+ /// Converts a byte array in big endian order into an ulong.
+ ///
+ ///
+ /// The array of bytes
+ ///
+ ///
+ /// The extracted ulong
+ ///
+ public static ulong BytesToUInt64Big(byte[] bytes) {
+ if(bytes.Length < 8) return 0;
+ return ((ulong)bytes[0] << 56) | ((ulong)bytes[1] << 48) | ((ulong)bytes[2] << 40) | ((ulong)bytes[3] << 32) |
+ ((ulong)bytes[4] << 24) | ((ulong)bytes[5] << 16) | ((ulong)bytes[6] << 8) | (ulong)bytes[7];
+ }
+
// used for RemoteParcelRequest (for "About Landmark")
public static UUID BuildFakeParcelID(ulong regionHandle, uint x, uint y) {
byte[] bytes = {
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index aaeca4b..2538eaf 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -1674,42 +1674,45 @@ namespace OpenSim.Region.Communications.OGS1
IList paramList = new ArrayList();
paramList.Add(hash);
- // this might be cached, as we probably requested it just a moment ago...
- RegionInfo info = RequestNeighbourInfo(regionHandle);
-
try
{
- XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
- string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
- XmlRpcResponse response = request.Send(uri, 10000);
- if (response.IsFault)
- {
- m_log.ErrorFormat("[OGS1 GRID SERVICES] remote call returned an error: {0}", response.FaultString);
- }
- else
- {
- hash = (Hashtable)response.Value;
- try {
- landData = new LandData();
- landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]);
- landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]);
- landData.Area = Convert.ToInt32(hash["Area"]);
- landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]);
- landData.Description = (string)hash["Description"];
- landData.Flags = Convert.ToUInt32(hash["Flags"]);
- landData.GlobalID = new UUID((string)hash["GlobalID"]);
- landData.Name = (string)hash["Name"];
- landData.OwnerID = new UUID((string)hash["OwnerID"]);
- landData.SalePrice = Convert.ToInt32(hash["SalePrice"]);
- landData.SnapshotID = new UUID((string)hash["SnapshotID"]);
- landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]);
- m_log.DebugFormat("[OGS1 GRID SERVICES] Got land data for parcel {0}", landData.Name);
+ // this might be cached, as we probably requested it just a moment ago...
+ RegionInfo info = RequestNeighbourInfo(regionHandle);
+ if (info != null) // just to be sure
+ {
+ XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
+ string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
+ XmlRpcResponse response = request.Send(uri, 10000);
+ if (response.IsFault)
+ {
+ m_log.ErrorFormat("[OGS1 GRID SERVICES] remote call returned an error: {0}", response.FaultString);
}
- catch (Exception e)
+ else
{
- m_log.Error("[OGS1 GRID SERVICES] Got exception while parsing land-data:", e);
+ hash = (Hashtable)response.Value;
+ try {
+ landData = new LandData();
+ landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]);
+ landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]);
+ landData.Area = Convert.ToInt32(hash["Area"]);
+ landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]);
+ landData.Description = (string)hash["Description"];
+ landData.Flags = Convert.ToUInt32(hash["Flags"]);
+ landData.GlobalID = new UUID((string)hash["GlobalID"]);
+ landData.Name = (string)hash["Name"];
+ landData.OwnerID = new UUID((string)hash["OwnerID"]);
+ landData.SalePrice = Convert.ToInt32(hash["SalePrice"]);
+ landData.SnapshotID = new UUID((string)hash["SnapshotID"]);
+ landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]);
+ m_log.DebugFormat("[OGS1 GRID SERVICES] Got land data for parcel {0}", landData.Name);
+ }
+ catch (Exception e)
+ {
+ m_log.Error("[OGS1 GRID SERVICES] Got exception while parsing land-data:", e);
+ }
}
}
+ else m_log.WarnFormat("[OGS1 GRID SERVICES] Couldn't find region with handle {0}", regionHandle);
}
catch (Exception e)
{
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
index e5bdafc..f4ba9a3 100644
--- a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs
@@ -1111,7 +1111,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
{
// if you do a "About Landmark" on a landmark a second time, the viewer sends the
// region_handle it got earlier via RegionHandleRequest
- ulong regionHandle = Helpers.BytesToUInt64((byte[])hash["region_handle"]);
+ ulong regionHandle = Util.BytesToUInt64Big((byte[])hash["region_handle"]);
parcelID = Util.BuildFakeParcelID(regionHandle, x, y);
}
else if (regionID == m_scene.RegionInfo.RegionID)
--
cgit v1.1