Files
opensim/OpenSim/Framework/Location.cs
Adam Frisby c6236b5cf3 * Refactored ClientView into LLClientView. Removed all direct references to UDPServer and replaced with IClientNetworkServer.
* This should, in theory, let us make new servers with different protocols very easily (rather than the challenge we would have faced before).
* BREAKS LoadBalancing module for the moment.
* Commit 1/3 - Please dont attempt to update to this revision until all 3 are in.
2008-05-02 16:40:17 +00:00

71 lines
1.4 KiB
C#

using System;
namespace OpenSim.Framework
{
[Serializable]
public class Location : ICloneable
{
private readonly int m_x;
private readonly int m_y;
public Location(int x, int y)
{
m_x = x;
m_y = y;
}
public Location(ulong regionHandle)
{
m_x = (int) regionHandle;
m_y = (int) (regionHandle >> 32);
}
public ulong RegionHandle
{
get { return ((ulong) m_x << 32 & (ulong) m_y); }
}
public int X
{
get { return m_x; }
}
public int Y
{
get { return m_y; }
}
public override bool Equals(object obj)
{
if (ReferenceEquals(obj, this))
return true;
if (obj is Location)
{
return Equals((Location) obj);
}
return base.Equals(obj);
}
public bool Equals(Location loc)
{
return loc.X == X && loc.Y == Y;
}
public bool Equals(int x, int y)
{
return X == x && y == Y;
}
public override int GetHashCode()
{
return X.GetHashCode() * 29 + Y.GetHashCode();
}
public object Clone()
{
return new Location(X, Y);
}
}
}