* Fixes Location == Location, and Location != Location
parent
dfbec673a4
commit
c9a5215d6d
|
@ -86,6 +86,16 @@ namespace OpenSim.Framework
|
||||||
return X == x && y == Y;
|
return X == x && y == Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool operator ==(Location o, object o2)
|
||||||
|
{
|
||||||
|
return o.Equals(o2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator !=(Location o, object o2)
|
||||||
|
{
|
||||||
|
return !o.Equals(o2);
|
||||||
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
return X.GetHashCode() * 29 + Y.GetHashCode();
|
return X.GetHashCode() * 29 + Y.GetHashCode();
|
||||||
|
|
|
@ -45,6 +45,22 @@ namespace OpenSim.Framework.Tests
|
||||||
Location TestLocation1 = new Location(1099511628032000);
|
Location TestLocation1 = new Location(1099511628032000);
|
||||||
Location TestLocation2 = new Location(1099511628032000);
|
Location TestLocation2 = new Location(1099511628032000);
|
||||||
Assert.That(TestLocation1 == TestLocation2);
|
Assert.That(TestLocation1 == TestLocation2);
|
||||||
|
|
||||||
|
TestLocation1 = new Location(1099511628032001);
|
||||||
|
TestLocation2 = new Location(1099511628032000);
|
||||||
|
Assert.That(TestLocation1 != TestLocation2);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void locationXYRegionHandle()
|
||||||
|
{
|
||||||
|
Location TestLocation1 = new Location(256000,256000);
|
||||||
|
Location TestLocation2 = new Location(1099511628032000);
|
||||||
|
Assert.That(TestLocation1 == TestLocation2);
|
||||||
|
|
||||||
|
TestLocation1 = new Location(256001, 256001);
|
||||||
|
TestLocation2 = new Location(1099511628032000);
|
||||||
|
Assert.That(TestLocation1 != TestLocation2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,8 +106,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
public bool HandlesRegion(Location x)
|
public bool HandlesRegion(Location x)
|
||||||
{
|
{
|
||||||
return x.RegionHandle == m_location.RegionHandle;
|
//return x.RegionHandle == m_location.RegionHandle;
|
||||||
//return x == m_location;
|
return x == m_location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddScene(Scene x)
|
public void AddScene(Scene x)
|
||||||
|
|
Loading…
Reference in New Issue