aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Location.cs
blob: 24430c67128507e03109549e8a97ba00d5e66e27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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 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 UInt64 RegionHandle
        {
            get { return UInt64.MinValue; }
        }

        public override int GetHashCode()
        {
            return X.GetHashCode() * 29 + Y.GetHashCode();
        }

        public object Clone()
        {
            return new Location(X, Y);
        }
    }
}