aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs39
1 files changed, 26 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
index ae76288..7ae4771 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs
@@ -82,21 +82,34 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
82 return new List<GridRegion>(m_neighbours.Values); 82 return new List<GridRegion>(m_neighbours.Values);
83 } 83 }
84 84
85 // Get a region given its base coordinates (in meters). 85
86 // NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST
87 // be the base coordinate of the region.
88 // The snapping is technically unnecessary but is harmless because regions are always
89 // multiples of the legacy region size (256).
90 public GridRegion GetRegionByPosition(int x, int y) 86 public GridRegion GetRegionByPosition(int x, int y)
91 { 87 {
92 uint xsnap = (uint)(x / Constants.RegionSize) * Constants.RegionSize; 88 /*
93 uint ysnap = (uint)(y / Constants.RegionSize) * Constants.RegionSize; 89 uint xsnap = (uint)(x / Constants.RegionSize) * Constants.RegionSize;
94 ulong handle = Util.RegionWorldLocToHandle(xsnap, ysnap); 90 uint ysnap = (uint)(y / Constants.RegionSize) * Constants.RegionSize;
95 91 ulong handle = Util.RegionWorldLocToHandle(xsnap, ysnap);
96 if (m_neighbours.ContainsKey(handle)) 92
97 return m_neighbours[handle]; 93 if (m_neighbours.ContainsKey(handle))
98 94 return m_neighbours[handle];
99 return null; 95
96 return null;
97 */
98
99 // do actual search by position
100 // not the best, but this will not hold that many regions
101 GridRegion foundRegion = null;
102 foreach(GridRegion r in m_neighbours.Values)
103 {
104 if (x >= r.RegionLocX && x < r.RegionLocX + r.RegionSizeX
105 && y >= r.RegionLocY && y < r.RegionLocY + r.RegionSizeY)
106 {
107 foundRegion = r;
108 break;
109 }
110 }
111
112 return foundRegion;
100 } 113 }
101 } 114 }
102} 115}