Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

TeleportWork
Justin Clark-Casey (justincc) 2013-08-01 23:17:21 +01:00
commit 7a5d11f8a7
2 changed files with 15 additions and 15 deletions

View File

@ -33,10 +33,10 @@ namespace OpenSim.Framework
[Serializable]
public class Location : ICloneable
{
private readonly int m_x;
private readonly int m_y;
private readonly uint m_x;
private readonly uint m_y;
public Location(int x, int y)
public Location(uint x, uint y)
{
m_x = x;
m_y = y;
@ -44,21 +44,21 @@ namespace OpenSim.Framework
public Location(ulong regionHandle)
{
m_x = (int) regionHandle;
m_y = (int) (regionHandle >> 32);
m_x = (uint)(regionHandle >> 32);
m_y = (uint)(regionHandle & (ulong)uint.MaxValue);
}
public ulong RegionHandle
{
get { return Utils.UIntsToLong((uint)m_x, (uint)m_y); }
get { return Utils.UIntsToLong(m_x, m_y); }
}
public int X
public uint X
{
get { return m_x; }
}
public int Y
public uint Y
{
get { return m_y; }
}

View File

@ -51,21 +51,21 @@ namespace OpenSim.Framework.Tests
[Test]
public void locationXYRegionHandle()
{
Location TestLocation1 = new Location(256000,256000);
Location TestLocation2 = new Location(1099511628032000);
Location TestLocation1 = new Location(255000,256000);
Location TestLocation2 = new Location(1095216660736000);
Assert.That(TestLocation1 == TestLocation2);
Assert.That(TestLocation2.X == 256000 && TestLocation2.Y == 256000, "Test xy location doesn't match regionhandle provided");
Assert.That(TestLocation2.X == 255000 && TestLocation2.Y == 256000, "Test xy location doesn't match regionhandle provided");
Assert.That(TestLocation2.RegionHandle == 1099511628032000,
Assert.That(TestLocation2.RegionHandle == 1095216660736000,
"Location RegionHandle Property didn't match regionhandle provided in constructor");
TestLocation1 = new Location(256001, 256001);
TestLocation2 = new Location(1099511628032000);
TestLocation1 = new Location(255001, 256001);
TestLocation2 = new Location(1095216660736000);
Assert.That(TestLocation1 != TestLocation2);
Assert.That(TestLocation1.Equals(256001, 256001), "Equals(x,y) failed to match the position in the constructor");
Assert.That(TestLocation1.Equals(255001, 256001), "Equals(x,y) failed to match the position in the constructor");
Assert.That(TestLocation2.GetHashCode() == (TestLocation2.X.GetHashCode() ^ TestLocation2.Y.GetHashCode()), "GetHashCode failed to produce the expected hashcode");