aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorDiva Canto2009-09-23 17:20:07 -0700
committerDiva Canto2009-09-23 17:20:07 -0700
commit67276589c883fe1a74d8d52057db1431d637dade (patch)
treedea80b87d7e11fb9a15c4b6e22c2c051e08eaf25 /OpenSim/Region/CoreModules
parentMerge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-67276589c883fe1a74d8d52057db1431d637dade.zip
opensim-SC_OLD-67276589c883fe1a74d8d52057db1431d637dade.tar.gz
opensim-SC_OLD-67276589c883fe1a74d8d52057db1431d637dade.tar.bz2
opensim-SC_OLD-67276589c883fe1a74d8d52057db1431d637dade.tar.xz
Changed IGridService to use the new GridRegion data structure instead of old SimpleRegionInfo.
Added grid configs to standalones.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs36
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs82
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs18
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs15
4 files changed, 82 insertions, 69 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs
index 2a862d4..36915ef 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGCommands.cs
@@ -37,6 +37,7 @@ using OpenSim.Framework.Console;
37using OpenSim.Region.Framework; 37using OpenSim.Region.Framework;
38using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Region.Framework.Scenes.Hypergrid; 39using OpenSim.Region.Framework.Scenes.Hypergrid;
40using GridRegion = OpenSim.Services.Interfaces.GridRegion;
40 41
41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid 42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
42{ 43{
@@ -121,12 +122,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
121 if (cmdparams[2].Contains(":")) 122 if (cmdparams[2].Contains(":"))
122 { 123 {
123 // New format 124 // New format
124 uint xloc, yloc; 125 int xloc, yloc;
125 string mapName; 126 string mapName;
126 try 127 try
127 { 128 {
128 xloc = Convert.ToUInt32(cmdparams[0]); 129 xloc = Convert.ToInt32(cmdparams[0]);
129 yloc = Convert.ToUInt32(cmdparams[1]); 130 yloc = Convert.ToInt32(cmdparams[1]);
130 mapName = cmdparams[2]; 131 mapName = cmdparams[2];
131 if (cmdparams.Length > 3) 132 if (cmdparams.Length > 3)
132 for (int i = 3; i < cmdparams.Length; i++) 133 for (int i = 3; i < cmdparams.Length; i++)
@@ -143,19 +144,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
143 return; 144 return;
144 } 145 }
145 146
147 // Convert cell coordinates given by the user to meters
148 xloc = xloc * (int)Constants.RegionSize;
149 yloc = yloc * (int)Constants.RegionSize;
146 m_HGGridConnector.TryLinkRegionToCoords(m_scene, null, mapName, xloc, yloc); 150 m_HGGridConnector.TryLinkRegionToCoords(m_scene, null, mapName, xloc, yloc);
147 } 151 }
148 else 152 else
149 { 153 {
150 // old format 154 // old format
151 SimpleRegionInfo regInfo; 155 GridRegion regInfo;
152 uint xloc, yloc; 156 int xloc, yloc;
153 uint externalPort; 157 uint externalPort;
154 string externalHostName; 158 string externalHostName;
155 try 159 try
156 { 160 {
157 xloc = Convert.ToUInt32(cmdparams[0]); 161 xloc = Convert.ToInt32(cmdparams[0]);
158 yloc = Convert.ToUInt32(cmdparams[1]); 162 yloc = Convert.ToInt32(cmdparams[1]);
159 externalPort = Convert.ToUInt32(cmdparams[3]); 163 externalPort = Convert.ToUInt32(cmdparams[3]);
160 externalHostName = cmdparams[2]; 164 externalHostName = cmdparams[2];
161 //internalPort = Convert.ToUInt32(cmdparams[4]); 165 //internalPort = Convert.ToUInt32(cmdparams[4]);
@@ -168,7 +172,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
168 return; 172 return;
169 } 173 }
170 174
171 //if (TryCreateLink(xloc, yloc, externalPort, externalHostName, out regInfo)) 175 // Convert cell coordinates given by the user to meters
176 xloc = xloc * (int)Constants.RegionSize;
177 yloc = yloc * (int)Constants.RegionSize;
172 if (m_HGGridConnector.TryCreateLink(m_scene, null, xloc, yloc, "", externalPort, externalHostName, out regInfo)) 178 if (m_HGGridConnector.TryCreateLink(m_scene, null, xloc, yloc, "", externalPort, externalHostName, out regInfo))
173 { 179 {
174 if (cmdparams.Length >= 5) 180 if (cmdparams.Length >= 5)
@@ -245,14 +251,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
245 251
246 private void ReadLinkFromConfig(IConfig config) 252 private void ReadLinkFromConfig(IConfig config)
247 { 253 {
248 SimpleRegionInfo regInfo; 254 GridRegion regInfo;
249 uint xloc, yloc; 255 int xloc, yloc;
250 uint externalPort; 256 uint externalPort;
251 string externalHostName; 257 string externalHostName;
252 uint realXLoc, realYLoc; 258 uint realXLoc, realYLoc;
253 259
254 xloc = Convert.ToUInt32(config.GetString("xloc", "0")); 260 xloc = Convert.ToInt32(config.GetString("xloc", "0"));
255 yloc = Convert.ToUInt32(config.GetString("yloc", "0")); 261 yloc = Convert.ToInt32(config.GetString("yloc", "0"));
256 externalPort = Convert.ToUInt32(config.GetString("externalPort", "0")); 262 externalPort = Convert.ToUInt32(config.GetString("externalPort", "0"));
257 externalHostName = config.GetString("externalHostName", ""); 263 externalHostName = config.GetString("externalHostName", "");
258 realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0")); 264 realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0"));
@@ -260,14 +266,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
260 266
261 if (m_enableAutoMapping) 267 if (m_enableAutoMapping)
262 { 268 {
263 xloc = (uint)((xloc % 100) + m_autoMappingX); 269 xloc = (int)((xloc % 100) + m_autoMappingX);
264 yloc = (uint)((yloc % 100) + m_autoMappingY); 270 yloc = (int)((yloc % 100) + m_autoMappingY);
265 } 271 }
266 272
267 if (((realXLoc == 0) && (realYLoc == 0)) || 273 if (((realXLoc == 0) && (realYLoc == 0)) ||
268 (((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) && 274 (((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) &&
269 ((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896)))) 275 ((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896))))
270 { 276 {
277 xloc = xloc * (int)Constants.RegionSize;
278 yloc = yloc * (int)Constants.RegionSize;
271 if ( 279 if (
272 m_HGGridConnector.TryCreateLink(m_scene, null, xloc, yloc, "", externalPort, 280 m_HGGridConnector.TryCreateLink(m_scene, null, xloc, yloc, "", externalPort,
273 externalHostName, out regInfo)) 281 externalHostName, out regInfo))
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
index c6ade15..0c2a835 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
@@ -36,6 +36,7 @@ using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Region.Framework.Scenes.Hypergrid; 37using OpenSim.Region.Framework.Scenes.Hypergrid;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39using GridRegion = OpenSim.Services.Interfaces.GridRegion;
39using OpenSim.Server.Base; 40using OpenSim.Server.Base;
40using OpenSim.Services.Connectors.Grid; 41using OpenSim.Services.Connectors.Grid;
41using OpenSim.Framework.Console; 42using OpenSim.Framework.Console;
@@ -59,13 +60,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
59 private HypergridServiceConnector m_HypergridServiceConnector; 60 private HypergridServiceConnector m_HypergridServiceConnector;
60 61
61 // Hyperlink regions are hyperlinks on the map 62 // Hyperlink regions are hyperlinks on the map
62 protected Dictionary<UUID, SimpleRegionInfo> m_HyperlinkRegions = new Dictionary<UUID, SimpleRegionInfo>(); 63 protected Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>();
63 64
64 // Known regions are home regions of visiting foreign users. 65 // Known regions are home regions of visiting foreign users.
65 // They are not on the map as static hyperlinks. They are dynamic hyperlinks, they go away when 66 // They are not on the map as static hyperlinks. They are dynamic hyperlinks, they go away when
66 // the visitor goes away. They are mapped to X=0 on the map. 67 // the visitor goes away. They are mapped to X=0 on the map.
67 // This is key-ed on agent ID 68 // This is key-ed on agent ID
68 protected Dictionary<UUID, SimpleRegionInfo> m_knownRegions = new Dictionary<UUID, SimpleRegionInfo>(); 69 protected Dictionary<UUID, GridRegion> m_knownRegions = new Dictionary<UUID, GridRegion>();
69 70
70 protected Dictionary<UUID, ulong> m_HyperlinkHandles = new Dictionary<UUID, ulong>(); 71 protected Dictionary<UUID, ulong> m_HyperlinkHandles = new Dictionary<UUID, ulong>();
71 72
@@ -184,7 +185,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
184 185
185 #region IGridService 186 #region IGridService
186 187
187 public bool RegisterRegion(UUID scopeID, SimpleRegionInfo regionInfo) 188 public bool RegisterRegion(UUID scopeID, GridRegion regionInfo)
188 { 189 {
189 // Region doesn't exist here. Trying to link remote region 190 // Region doesn't exist here. Trying to link remote region
190 if (regionInfo.RegionID.Equals(UUID.Zero)) 191 if (regionInfo.RegionID.Equals(UUID.Zero))
@@ -222,7 +223,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
222 } 223 }
223 // Try the foreign users home collection 224 // Try the foreign users home collection
224 225
225 foreach (SimpleRegionInfo r in m_knownRegions.Values) 226 foreach (GridRegion r in m_knownRegions.Values)
226 if (r.RegionID == regionID) 227 if (r.RegionID == regionID)
227 { 228 {
228 RemoveHyperlinkHomeRegion(regionID); 229 RemoveHyperlinkHomeRegion(regionID);
@@ -233,21 +234,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
233 return m_GridServiceConnector.DeregisterRegion(regionID); 234 return m_GridServiceConnector.DeregisterRegion(regionID);
234 } 235 }
235 236
236 public List<SimpleRegionInfo> GetNeighbours(UUID scopeID, UUID regionID) 237 public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
237 { 238 {
238 // No serving neighbours on hyperliked regions. 239 // No serving neighbours on hyperliked regions.
239 // Just the regular regions. 240 // Just the regular regions.
240 return m_GridServiceConnector.GetNeighbours(scopeID, regionID); 241 return m_GridServiceConnector.GetNeighbours(scopeID, regionID);
241 } 242 }
242 243
243 public SimpleRegionInfo GetRegionByUUID(UUID scopeID, UUID regionID) 244 public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
244 { 245 {
245 // Try the hyperlink collection 246 // Try the hyperlink collection
246 if (m_HyperlinkRegions.ContainsKey(regionID)) 247 if (m_HyperlinkRegions.ContainsKey(regionID))
247 return m_HyperlinkRegions[regionID]; 248 return m_HyperlinkRegions[regionID];
248 249
249 // Try the foreign users home collection 250 // Try the foreign users home collection
250 foreach (SimpleRegionInfo r in m_knownRegions.Values) 251 foreach (GridRegion r in m_knownRegions.Values)
251 if (r.RegionID == regionID) 252 if (r.RegionID == regionID)
252 return m_knownRegions[regionID]; 253 return m_knownRegions[regionID];
253 254
@@ -255,19 +256,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
255 return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID); 256 return m_GridServiceConnector.GetRegionByUUID(scopeID, regionID);
256 } 257 }
257 258
258 public SimpleRegionInfo GetRegionByPosition(UUID scopeID, int x, int y) 259 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
259 { 260 {
260 int snapX = (int) (x / Constants.RegionSize) * (int)Constants.RegionSize; 261 int snapX = (int) (x / Constants.RegionSize) * (int)Constants.RegionSize;
261 int snapY = (int) (y / Constants.RegionSize) * (int)Constants.RegionSize; 262 int snapY = (int) (y / Constants.RegionSize) * (int)Constants.RegionSize;
262 // Try the hyperlink collection 263 // Try the hyperlink collection
263 foreach (SimpleRegionInfo r in m_HyperlinkRegions.Values) 264 foreach (GridRegion r in m_HyperlinkRegions.Values)
264 { 265 {
265 if ((r.RegionLocX == snapX) && (r.RegionLocY == snapY)) 266 if ((r.RegionLocX == snapX) && (r.RegionLocY == snapY))
266 return r; 267 return r;
267 } 268 }
268 269
269 // Try the foreign users home collection 270 // Try the foreign users home collection
270 foreach (SimpleRegionInfo r in m_knownRegions.Values) 271 foreach (GridRegion r in m_knownRegions.Values)
271 { 272 {
272 if ((r.RegionLocX == snapX) && (r.RegionLocY == snapY)) 273 if ((r.RegionLocX == snapX) && (r.RegionLocY == snapY))
273 return r; 274 return r;
@@ -277,22 +278,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
277 return m_GridServiceConnector.GetRegionByPosition(scopeID, x, y); 278 return m_GridServiceConnector.GetRegionByPosition(scopeID, x, y);
278 } 279 }
279 280
280 public SimpleRegionInfo GetRegionByName(UUID scopeID, string regionName) 281 public GridRegion GetRegionByName(UUID scopeID, string regionName)
281 { 282 {
282 // Try normal grid first 283 // Try normal grid first
283 SimpleRegionInfo region = m_GridServiceConnector.GetRegionByName(scopeID, regionName); 284 GridRegion region = m_GridServiceConnector.GetRegionByName(scopeID, regionName);
284 if (region != null) 285 if (region != null)
285 return region; 286 return region;
286 287
287 // Try the hyperlink collection 288 // Try the hyperlink collection
288 foreach (SimpleRegionInfo r in m_HyperlinkRegions.Values) 289 foreach (GridRegion r in m_HyperlinkRegions.Values)
289 { 290 {
290 if (r.RegionName == regionName) 291 if (r.RegionName == regionName)
291 return r; 292 return r;
292 } 293 }
293 294
294 // Try the foreign users home collection 295 // Try the foreign users home collection
295 foreach (SimpleRegionInfo r in m_knownRegions.Values) 296 foreach (GridRegion r in m_knownRegions.Values)
296 { 297 {
297 if (r.RegionName == regionName) 298 if (r.RegionName == regionName)
298 return r; 299 return r;
@@ -300,9 +301,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
300 return null; 301 return null;
301 } 302 }
302 303
303 public List<SimpleRegionInfo> GetRegionsByName(UUID scopeID, string name, int maxNumber) 304 public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
304 { 305 {
305 List<SimpleRegionInfo> rinfos = new List<SimpleRegionInfo>(); 306 List<GridRegion> rinfos = new List<GridRegion>();
306 307
307 // Commenting until regionname exists 308 // Commenting until regionname exists
308 //foreach (SimpleRegionInfo r in m_HyperlinkRegions.Values) 309 //foreach (SimpleRegionInfo r in m_HyperlinkRegions.Values)
@@ -313,15 +314,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
313 return rinfos; 314 return rinfos;
314 } 315 }
315 316
316 public List<SimpleRegionInfo> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) 317 public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
317 { 318 {
318 int snapXmin = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize; 319 int snapXmin = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize;
319 int snapXmax = (int)(xmax / Constants.RegionSize) * (int)Constants.RegionSize; 320 int snapXmax = (int)(xmax / Constants.RegionSize) * (int)Constants.RegionSize;
320 int snapYmin = (int)(ymin / Constants.RegionSize) * (int)Constants.RegionSize; 321 int snapYmin = (int)(ymin / Constants.RegionSize) * (int)Constants.RegionSize;
321 int snapYmax = (int)(ymax / Constants.RegionSize) * (int)Constants.RegionSize; 322 int snapYmax = (int)(ymax / Constants.RegionSize) * (int)Constants.RegionSize;
322 323
323 List<SimpleRegionInfo> rinfos = new List<SimpleRegionInfo>(); 324 List<GridRegion> rinfos = new List<GridRegion>();
324 foreach (SimpleRegionInfo r in m_HyperlinkRegions.Values) 325 foreach (GridRegion r in m_HyperlinkRegions.Values)
325 if ((r.RegionLocX > snapXmin) && (r.RegionLocX < snapYmax) && 326 if ((r.RegionLocX > snapXmin) && (r.RegionLocX < snapYmax) &&
326 (r.RegionLocY > snapYmin) && (r.RegionLocY < snapYmax)) 327 (r.RegionLocY > snapYmin) && (r.RegionLocY < snapYmax))
327 rinfos.Add(r); 328 rinfos.Add(r);
@@ -335,7 +336,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
335 336
336 #region Auxiliary 337 #region Auxiliary
337 338
338 private void AddHyperlinkRegion(SimpleRegionInfo regionInfo, ulong regionHandle) 339 private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
339 { 340 {
340 m_HyperlinkRegions.Add(regionInfo.RegionID, regionInfo); 341 m_HyperlinkRegions.Add(regionInfo.RegionID, regionInfo);
341 m_HyperlinkHandles.Add(regionInfo.RegionID, regionHandle); 342 m_HyperlinkHandles.Add(regionInfo.RegionID, regionHandle);
@@ -347,7 +348,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
347 m_HyperlinkHandles.Remove(regionID); 348 m_HyperlinkHandles.Remove(regionID);
348 } 349 }
349 350
350 private void AddHyperlinkHomeRegion(UUID userID, SimpleRegionInfo regionInfo, ulong regionHandle) 351 private void AddHyperlinkHomeRegion(UUID userID, GridRegion regionInfo, ulong regionHandle)
351 { 352 {
352 m_knownRegions.Add(userID, regionInfo); 353 m_knownRegions.Add(userID, regionInfo);
353 m_HyperlinkHandles.Add(regionInfo.RegionID, regionHandle); 354 m_HyperlinkHandles.Add(regionInfo.RegionID, regionHandle);
@@ -355,7 +356,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
355 356
356 private void RemoveHyperlinkHomeRegion(UUID regionID) 357 private void RemoveHyperlinkHomeRegion(UUID regionID)
357 { 358 {
358 foreach (KeyValuePair<UUID, SimpleRegionInfo> kvp in m_knownRegions) 359 foreach (KeyValuePair<UUID, GridRegion> kvp in m_knownRegions)
359 { 360 {
360 if (kvp.Value.RegionID == regionID) 361 if (kvp.Value.RegionID == regionID)
361 { 362 {
@@ -370,7 +371,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
370 371
371 private static Random random = new Random(); 372 private static Random random = new Random();
372 373
373 public SimpleRegionInfo TryLinkRegionToCoords(Scene m_scene, IClientAPI client, string mapName, uint xloc, uint yloc) 374 public GridRegion TryLinkRegionToCoords(Scene m_scene, IClientAPI client, string mapName, int xloc, int yloc)
374 { 375 {
375 string host = "127.0.0.1"; 376 string host = "127.0.0.1";
376 string portstr; 377 string portstr;
@@ -404,7 +405,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
404 if ((ipaddr != null) && 405 if ((ipaddr != null) &&
405 !((m_scene.RegionInfo.ExternalEndPoint.Address.Equals(ipaddr)) && (m_scene.RegionInfo.HttpPort == port))) 406 !((m_scene.RegionInfo.ExternalEndPoint.Address.Equals(ipaddr)) && (m_scene.RegionInfo.HttpPort == port)))
406 { 407 {
407 SimpleRegionInfo regInfo; 408 GridRegion regInfo;
408 bool success = TryCreateLink(m_scene, client, xloc, yloc, regionName, port, host, out regInfo); 409 bool success = TryCreateLink(m_scene, client, xloc, yloc, regionName, port, host, out regInfo);
409 if (success) 410 if (success)
410 { 411 {
@@ -417,18 +418,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
417 } 418 }
418 419
419 // From the map search and secondlife://blah 420 // From the map search and secondlife://blah
420 public SimpleRegionInfo TryLinkRegion(Scene m_scene, IClientAPI client, string mapName) 421 public GridRegion TryLinkRegion(Scene m_scene, IClientAPI client, string mapName)
421 { 422 {
422 uint xloc = (uint)(random.Next(0, Int16.MaxValue)); 423 int xloc = random.Next(0, Int16.MaxValue);
423 return TryLinkRegionToCoords(m_scene, client, mapName, xloc, 0); 424 return TryLinkRegionToCoords(m_scene, client, mapName, xloc, 0);
424 } 425 }
425 426
426 public bool TryCreateLink(Scene m_scene, IClientAPI client, uint xloc, uint yloc, 427 public bool TryCreateLink(Scene m_scene, IClientAPI client, int xloc, int yloc,
427 string externalRegionName, uint externalPort, string externalHostName, out SimpleRegionInfo regInfo) 428 string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo)
428 { 429 {
429 m_log.DebugFormat("[HGrid]: Link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc); 430 m_log.DebugFormat("[HGrid]: Link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc);
430 431
431 regInfo = new SimpleRegionInfo(); 432 regInfo = new GridRegion();
432 regInfo.RegionName = externalRegionName; 433 regInfo.RegionName = externalRegionName;
433 regInfo.HttpPort = externalPort; 434 regInfo.HttpPort = externalPort;
434 regInfo.ExternalHostName = externalHostName; 435 regInfo.ExternalHostName = externalHostName;
@@ -456,7 +457,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
456 return false; 457 return false;
457 } 458 }
458 459
459 uint x, y; 460 int x, y;
460 if (!Check4096(m_scene, regInfo, out x, out y)) 461 if (!Check4096(m_scene, regInfo, out x, out y))
461 { 462 {
462 DeregisterRegion(regInfo.RegionID); 463 DeregisterRegion(regInfo.RegionID);
@@ -481,7 +482,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
481 482
482 public bool TryUnlinkRegion(Scene m_scene, string mapName) 483 public bool TryUnlinkRegion(Scene m_scene, string mapName)
483 { 484 {
484 SimpleRegionInfo regInfo = null; 485 GridRegion regInfo = null;
485 if (mapName.Contains(":")) 486 if (mapName.Contains(":"))
486 { 487 {
487 string host = "127.0.0.1"; 488 string host = "127.0.0.1";
@@ -504,13 +505,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
504 // { 505 // {
505 // regionName = parts[2]; 506 // regionName = parts[2];
506 // } 507 // }
507 foreach (SimpleRegionInfo r in m_HyperlinkRegions.Values) 508 foreach (GridRegion r in m_HyperlinkRegions.Values)
508 if (host.Equals(r.ExternalHostName) && (port == r.HttpPort)) 509 if (host.Equals(r.ExternalHostName) && (port == r.HttpPort))
509 regInfo = r; 510 regInfo = r;
510 } 511 }
511 else 512 else
512 { 513 {
513 foreach (SimpleRegionInfo r in m_HyperlinkRegions.Values) 514 foreach (GridRegion r in m_HyperlinkRegions.Values)
514 if (r.RegionName.Equals(mapName)) 515 if (r.RegionName.Equals(mapName))
515 regInfo = r; 516 regInfo = r;
516 } 517 }
@@ -530,22 +531,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
530 /// </summary> 531 /// </summary>
531 /// <param name="regInfo"></param> 532 /// <param name="regInfo"></param>
532 /// <returns></returns> 533 /// <returns></returns>
533 public bool Check4096(Scene m_scene, SimpleRegionInfo regInfo, out uint x, out uint y) 534 public bool Check4096(Scene m_scene, GridRegion regInfo, out int x, out int y)
534 { 535 {
535 ulong realHandle = m_HyperlinkHandles[regInfo.RegionID]; 536 ulong realHandle = m_HyperlinkHandles[regInfo.RegionID];
536 Utils.LongToUInts(realHandle, out x, out y); 537 uint ux = 0, uy = 0;
537 x = x / Constants.RegionSize; 538 Utils.LongToUInts(realHandle, out ux, out uy);
538 y = y / Constants.RegionSize; 539 x = (int)(ux / Constants.RegionSize);
540 y = (int)(uy / Constants.RegionSize);
539 541
540 if ((Math.Abs((int)m_scene.RegionInfo.RegionLocX - (int)x) >= 4096) || 542 if ((Math.Abs((int)(m_scene.RegionInfo.RegionLocX / Constants.RegionSize) - x) >= 4096) ||
541 (Math.Abs((int)m_scene.RegionInfo.RegionLocY - (int)y) >= 4096)) 543 (Math.Abs((int)(m_scene.RegionInfo.RegionLocY / Constants.RegionSize) - y) >= 4096))
542 { 544 {
543 return false; 545 return false;
544 } 546 }
545 return true; 547 return true;
546 } 548 }
547 549
548 public bool CheckCoords(uint thisx, uint thisy, uint x, uint y) 550 public bool CheckCoords(uint thisx, uint thisy, int x, int y)
549 { 551 {
550 if ((thisx == x) && (thisy == y)) 552 if ((thisx == x) && (thisy == y))
551 return false; 553 return false;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index c1b7235..743d3b9 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -35,6 +35,7 @@ using OpenSim.Server.Base;
35using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
38using GridRegion = OpenSim.Services.Interfaces.GridRegion;
38using OpenMetaverse; 39using OpenMetaverse;
39 40
40namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid 41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
@@ -56,6 +57,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
56 57
57 public LocalGridServicesConnector(IConfigSource source) 58 public LocalGridServicesConnector(IConfigSource source)
58 { 59 {
60 m_log.Debug("[LOCAL GRID CONNECTOR]: LocalGridServicesConnector instantiated");
59 InitialiseService(source); 61 InitialiseService(source);
60 } 62 }
61 63
@@ -111,7 +113,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
111 113
112 if (m_GridService == null) 114 if (m_GridService == null)
113 { 115 {
114 m_log.Error("[LOCAL GRID CONNECTOR]: Can't load asset service"); 116 m_log.Error("[LOCAL GRID CONNECTOR]: Can't load grid service");
115 return; 117 return;
116 } 118 }
117 } 119 }
@@ -144,7 +146,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
144 146
145 #region IGridService 147 #region IGridService
146 148
147 public bool RegisterRegion(UUID scopeID, SimpleRegionInfo regionInfo) 149 public bool RegisterRegion(UUID scopeID, GridRegion regionInfo)
148 { 150 {
149 return m_GridService.RegisterRegion(scopeID, regionInfo); 151 return m_GridService.RegisterRegion(scopeID, regionInfo);
150 } 152 }
@@ -154,32 +156,32 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
154 return m_GridService.DeregisterRegion(regionID); 156 return m_GridService.DeregisterRegion(regionID);
155 } 157 }
156 158
157 public List<SimpleRegionInfo> GetNeighbours(UUID scopeID, UUID regionID) 159 public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
158 { 160 {
159 return m_GridService.GetNeighbours(scopeID, regionID); 161 return m_GridService.GetNeighbours(scopeID, regionID);
160 } 162 }
161 163
162 public SimpleRegionInfo GetRegionByUUID(UUID scopeID, UUID regionID) 164 public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
163 { 165 {
164 return m_GridService.GetRegionByUUID(scopeID, regionID); 166 return m_GridService.GetRegionByUUID(scopeID, regionID);
165 } 167 }
166 168
167 public SimpleRegionInfo GetRegionByPosition(UUID scopeID, int x, int y) 169 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
168 { 170 {
169 return m_GridService.GetRegionByPosition(scopeID, x, y); 171 return m_GridService.GetRegionByPosition(scopeID, x, y);
170 } 172 }
171 173
172 public SimpleRegionInfo GetRegionByName(UUID scopeID, string regionName) 174 public GridRegion GetRegionByName(UUID scopeID, string regionName)
173 { 175 {
174 return m_GridService.GetRegionByName(scopeID, regionName); 176 return m_GridService.GetRegionByName(scopeID, regionName);
175 } 177 }
176 178
177 public List<SimpleRegionInfo> GetRegionsByName(UUID scopeID, string name, int maxNumber) 179 public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
178 { 180 {
179 return m_GridService.GetRegionsByName(scopeID, name, maxNumber); 181 return m_GridService.GetRegionsByName(scopeID, name, maxNumber);
180 } 182 }
181 183
182 public List<SimpleRegionInfo> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) 184 public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
183 { 185 {
184 return m_GridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax); 186 return m_GridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax);
185 } 187 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index 4303fa8..91a808b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -37,6 +37,7 @@ using OpenSim.Services.Connectors;
37using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Services.Interfaces; 39using OpenSim.Services.Interfaces;
40using GridRegion = OpenSim.Services.Interfaces.GridRegion;
40 41
41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid 42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
42{ 43{
@@ -129,7 +130,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
129 130
130 #region IGridService 131 #region IGridService
131 132
132 public override bool RegisterRegion(UUID scopeID, SimpleRegionInfo regionInfo) 133 public override bool RegisterRegion(UUID scopeID, GridRegion regionInfo)
133 { 134 {
134 if (m_LocalGridService.RegisterRegion(scopeID, regionInfo)) 135 if (m_LocalGridService.RegisterRegion(scopeID, regionInfo))
135 return base.RegisterRegion(scopeID, regionInfo); 136 return base.RegisterRegion(scopeID, regionInfo);
@@ -147,27 +148,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
147 148
148 // Let's not override GetNeighbours -- let's get them all from the grid server 149 // Let's not override GetNeighbours -- let's get them all from the grid server
149 150
150 public override SimpleRegionInfo GetRegionByUUID(UUID scopeID, UUID regionID) 151 public override GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
151 { 152 {
152 SimpleRegionInfo rinfo = m_LocalGridService.GetRegionByUUID(scopeID, regionID); 153 GridRegion rinfo = m_LocalGridService.GetRegionByUUID(scopeID, regionID);
153 if (rinfo == null) 154 if (rinfo == null)
154 rinfo = base.GetRegionByUUID(scopeID, regionID); 155 rinfo = base.GetRegionByUUID(scopeID, regionID);
155 156
156 return rinfo; 157 return rinfo;
157 } 158 }
158 159
159 public override SimpleRegionInfo GetRegionByPosition(UUID scopeID, int x, int y) 160 public override GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
160 { 161 {
161 SimpleRegionInfo rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y); 162 GridRegion rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y);
162 if (rinfo == null) 163 if (rinfo == null)
163 rinfo = base.GetRegionByPosition(scopeID, x, y); 164 rinfo = base.GetRegionByPosition(scopeID, x, y);
164 165
165 return rinfo; 166 return rinfo;
166 } 167 }
167 168
168 public override SimpleRegionInfo GetRegionByName(UUID scopeID, string regionName) 169 public override GridRegion GetRegionByName(UUID scopeID, string regionName)
169 { 170 {
170 SimpleRegionInfo rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName); 171 GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName);
171 if (rinfo == null) 172 if (rinfo == null)
172 rinfo = base.GetRegionByName(scopeID, regionName); 173 rinfo = base.GetRegionByName(scopeID, regionName);
173 174