diff options
author | teravus | 2013-08-01 16:30:29 -0500 |
---|---|---|
committer | teravus | 2013-08-01 16:32:36 -0500 |
commit | 7b9a50721da3ac51ee3aa60ea946278d38a18426 (patch) | |
tree | 91bbf87ce09e2c17a7d8f9a34d2a96c9991f1d33 /OpenSim/Framework | |
parent | Add experimental "debug attachments throttle <ms>" setting (command line) and... (diff) | |
download | opensim-SC_OLD-7b9a50721da3ac51ee3aa60ea946278d38a18426.zip opensim-SC_OLD-7b9a50721da3ac51ee3aa60ea946278d38a18426.tar.gz opensim-SC_OLD-7b9a50721da3ac51ee3aa60ea946278d38a18426.tar.bz2 opensim-SC_OLD-7b9a50721da3ac51ee3aa60ea946278d38a18426.tar.xz |
* Thanks Plugh for pointing out that the constructor that takes a ulong regionhandle and saves it to to X,Y vars in the OpenSim.Framework.Location object was inverting the X and Y resulting in X and Y confusion. The test also used 256x256 in the uint,uint constructor so it was unable to determine if the X and Y components swapped. I don't expect much upheaval from this commit, not a lot of features were using the ulong Location object constructor. The database never stores the ulong regionhandle... the prims are loaded by region Guid. LLUDPServer used it to determine regions that it handled in a service definition where there was simply a X == X test which has the same logical result un-switched as it did switched. Again, thanks LibOMV for the regionhandle code.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Location.cs | 16 | ||||
-rw-r--r-- | OpenSim/Framework/Tests/LocationTest.cs | 14 |
2 files changed, 15 insertions, 15 deletions
diff --git a/OpenSim/Framework/Location.cs b/OpenSim/Framework/Location.cs index 9504e03..0b88834 100644 --- a/OpenSim/Framework/Location.cs +++ b/OpenSim/Framework/Location.cs | |||
@@ -33,10 +33,10 @@ namespace OpenSim.Framework | |||
33 | [Serializable] | 33 | [Serializable] |
34 | public class Location : ICloneable | 34 | public class Location : ICloneable |
35 | { | 35 | { |
36 | private readonly int m_x; | 36 | private readonly uint m_x; |
37 | private readonly int m_y; | 37 | private readonly uint m_y; |
38 | 38 | ||
39 | public Location(int x, int y) | 39 | public Location(uint x, uint y) |
40 | { | 40 | { |
41 | m_x = x; | 41 | m_x = x; |
42 | m_y = y; | 42 | m_y = y; |
@@ -44,21 +44,21 @@ namespace OpenSim.Framework | |||
44 | 44 | ||
45 | public Location(ulong regionHandle) | 45 | public Location(ulong regionHandle) |
46 | { | 46 | { |
47 | m_x = (int) regionHandle; | 47 | m_x = (uint)(regionHandle >> 32); |
48 | m_y = (int) (regionHandle >> 32); | 48 | m_y = (uint)(regionHandle & (ulong)uint.MaxValue); |
49 | } | 49 | } |
50 | 50 | ||
51 | public ulong RegionHandle | 51 | public ulong RegionHandle |
52 | { | 52 | { |
53 | get { return Utils.UIntsToLong((uint)m_x, (uint)m_y); } | 53 | get { return Utils.UIntsToLong(m_x, m_y); } |
54 | } | 54 | } |
55 | 55 | ||
56 | public int X | 56 | public uint X |
57 | { | 57 | { |
58 | get { return m_x; } | 58 | get { return m_x; } |
59 | } | 59 | } |
60 | 60 | ||
61 | public int Y | 61 | public uint Y |
62 | { | 62 | { |
63 | get { return m_y; } | 63 | get { return m_y; } |
64 | } | 64 | } |
diff --git a/OpenSim/Framework/Tests/LocationTest.cs b/OpenSim/Framework/Tests/LocationTest.cs index a56ecb4..af5f164 100644 --- a/OpenSim/Framework/Tests/LocationTest.cs +++ b/OpenSim/Framework/Tests/LocationTest.cs | |||
@@ -51,21 +51,21 @@ namespace OpenSim.Framework.Tests | |||
51 | [Test] | 51 | [Test] |
52 | public void locationXYRegionHandle() | 52 | public void locationXYRegionHandle() |
53 | { | 53 | { |
54 | Location TestLocation1 = new Location(256000,256000); | 54 | Location TestLocation1 = new Location(255000,256000); |
55 | Location TestLocation2 = new Location(1099511628032000); | 55 | Location TestLocation2 = new Location(1095216660736000); |
56 | Assert.That(TestLocation1 == TestLocation2); | 56 | Assert.That(TestLocation1 == TestLocation2); |
57 | 57 | ||
58 | Assert.That(TestLocation2.X == 256000 && TestLocation2.Y == 256000, "Test xy location doesn't match regionhandle provided"); | 58 | Assert.That(TestLocation2.X == 255000 && TestLocation2.Y == 256000, "Test xy location doesn't match regionhandle provided"); |
59 | 59 | ||
60 | Assert.That(TestLocation2.RegionHandle == 1099511628032000, | 60 | Assert.That(TestLocation2.RegionHandle == 1095216660736000, |
61 | "Location RegionHandle Property didn't match regionhandle provided in constructor"); | 61 | "Location RegionHandle Property didn't match regionhandle provided in constructor"); |
62 | 62 | ||
63 | 63 | ||
64 | TestLocation1 = new Location(256001, 256001); | 64 | TestLocation1 = new Location(255001, 256001); |
65 | TestLocation2 = new Location(1099511628032000); | 65 | TestLocation2 = new Location(1095216660736000); |
66 | Assert.That(TestLocation1 != TestLocation2); | 66 | Assert.That(TestLocation1 != TestLocation2); |
67 | 67 | ||
68 | Assert.That(TestLocation1.Equals(256001, 256001), "Equals(x,y) failed to match the position in the constructor"); | 68 | Assert.That(TestLocation1.Equals(255001, 256001), "Equals(x,y) failed to match the position in the constructor"); |
69 | 69 | ||
70 | Assert.That(TestLocation2.GetHashCode() == (TestLocation2.X.GetHashCode() ^ TestLocation2.Y.GetHashCode()), "GetHashCode failed to produce the expected hashcode"); | 70 | Assert.That(TestLocation2.GetHashCode() == (TestLocation2.X.GetHashCode() ^ TestLocation2.Y.GetHashCode()), "GetHashCode failed to produce the expected hashcode"); |
71 | 71 | ||