aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs28
1 files changed, 24 insertions, 4 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 8e7eac7..7217ece 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -806,8 +806,19 @@ namespace OpenSim.Framework
806 { 806 {
807 (byte)regionHandle, (byte)(regionHandle >> 8), (byte)(regionHandle >> 16), (byte)(regionHandle >> 24), 807 (byte)regionHandle, (byte)(regionHandle >> 8), (byte)(regionHandle >> 16), (byte)(regionHandle >> 24),
808 (byte)(regionHandle >> 32), (byte)(regionHandle >> 40), (byte)(regionHandle >> 48), (byte)(regionHandle << 56), 808 (byte)(regionHandle >> 32), (byte)(regionHandle >> 40), (byte)(regionHandle >> 48), (byte)(regionHandle << 56),
809 (byte)x, (byte)(x >> 8), (byte)(x >> 16), (byte)(x >> 24), 809 (byte)x, (byte)(x >> 8), 0, 0,
810 (byte)y, (byte)(y >> 8), (byte)(y >> 16), (byte)(y >> 24) }; 810 (byte)y, (byte)(y >> 8), 0, 0 };
811 return new UUID(bytes, 0);
812 }
813
814 public static UUID BuildFakeParcelID(ulong regionHandle, uint x, uint y, uint z)
815 {
816 byte[] bytes =
817 {
818 (byte)regionHandle, (byte)(regionHandle >> 8), (byte)(regionHandle >> 16), (byte)(regionHandle >> 24),
819 (byte)(regionHandle >> 32), (byte)(regionHandle >> 40), (byte)(regionHandle >> 48), (byte)(regionHandle << 56),
820 (byte)x, (byte)(x >> 8), (byte)z, (byte)(z >> 8),
821 (byte)y, (byte)(y >> 8), 0, 0 };
811 return new UUID(bytes, 0); 822 return new UUID(bytes, 0);
812 } 823 }
813 824
@@ -815,8 +826,17 @@ namespace OpenSim.Framework
815 { 826 {
816 byte[] bytes = parcelID.GetBytes(); 827 byte[] bytes = parcelID.GetBytes();
817 regionHandle = Utils.BytesToUInt64(bytes); 828 regionHandle = Utils.BytesToUInt64(bytes);
818 x = Utils.BytesToUInt(bytes, 8); 829 x = Utils.BytesToUInt(bytes, 8) & 0xffff;
819 y = Utils.BytesToUInt(bytes, 12); 830 y = Utils.BytesToUInt(bytes, 12) & 0xffff;
831 }
832
833 public static void ParseFakeParcelID(UUID parcelID, out ulong regionHandle, out uint x, out uint y, out uint z)
834 {
835 byte[] bytes = parcelID.GetBytes();
836 regionHandle = Utils.BytesToUInt64(bytes);
837 x = Utils.BytesToUInt(bytes, 8) & 0xffff;
838 z = (Utils.BytesToUInt(bytes, 8) & 0xffff0000) >> 16;
839 y = Utils.BytesToUInt(bytes, 12) & 0xffff;
820 } 840 }
821 841
822 public static void FakeParcelIDToGlobalPosition(UUID parcelID, out uint x, out uint y) 842 public static void FakeParcelIDToGlobalPosition(UUID parcelID, out uint x, out uint y)