diff options
author | Adam Frisby | 2008-04-29 18:00:25 +0000 |
---|---|---|
committer | Adam Frisby | 2008-04-29 18:00:25 +0000 |
commit | faccbf4994801273af6359e3d83a5a15405d8273 (patch) | |
tree | 279bccfe8099660fb64c22f1bbe9ad5b6e1bc60e | |
parent | * Implemented new InterRegion comms method in the form of InterregionModule (diff) | |
download | opensim-SC-faccbf4994801273af6359e3d83a5a15405d8273.zip opensim-SC-faccbf4994801273af6359e3d83a5a15405d8273.tar.gz opensim-SC-faccbf4994801273af6359e3d83a5a15405d8273.tar.bz2 opensim-SC-faccbf4994801273af6359e3d83a5a15405d8273.tar.xz |
* Missed a file in previous commit. Sorry!
-rw-r--r-- | OpenSim/Framework/Location.cs | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/OpenSim/Framework/Location.cs b/OpenSim/Framework/Location.cs new file mode 100644 index 0000000..24430c6 --- /dev/null +++ b/OpenSim/Framework/Location.cs | |||
@@ -0,0 +1,65 @@ | |||
1 | using System; | ||
2 | |||
3 | namespace OpenSim.Framework | ||
4 | { | ||
5 | [Serializable] | ||
6 | public class Location : ICloneable | ||
7 | { | ||
8 | private readonly int m_x; | ||
9 | private readonly int m_y; | ||
10 | |||
11 | public Location(int x, int y) | ||
12 | { | ||
13 | m_x = x; | ||
14 | m_y = y; | ||
15 | } | ||
16 | |||
17 | public int X | ||
18 | { | ||
19 | get { return m_x; } | ||
20 | } | ||
21 | |||
22 | public int Y | ||
23 | { | ||
24 | get { return m_y; } | ||
25 | } | ||
26 | |||
27 | public override bool Equals(object obj) | ||
28 | { | ||
29 | if (ReferenceEquals(obj, this)) | ||
30 | return true; | ||
31 | |||
32 | if (obj is Location) | ||
33 | { | ||
34 | return Equals((Location) obj); | ||
35 | } | ||
36 | |||
37 | return base.Equals(obj); | ||
38 | } | ||
39 | |||
40 | public bool Equals(Location loc) | ||
41 | { | ||
42 | return loc.X == X && loc.Y == Y; | ||
43 | } | ||
44 | |||
45 | public bool Equals(int x, int y) | ||
46 | { | ||
47 | return X == x && y == Y; | ||
48 | } | ||
49 | |||
50 | public UInt64 RegionHandle | ||
51 | { | ||
52 | get { return UInt64.MinValue; } | ||
53 | } | ||
54 | |||
55 | public override int GetHashCode() | ||
56 | { | ||
57 | return X.GetHashCode() * 29 + Y.GetHashCode(); | ||
58 | } | ||
59 | |||
60 | public object Clone() | ||
61 | { | ||
62 | return new Location(X, Y); | ||
63 | } | ||
64 | } | ||
65 | } \ No newline at end of file | ||